From owner-freebsd-drivers@FreeBSD.ORG Sun Oct 27 12:13:01 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B55E2C2 for ; Sun, 27 Oct 2013 12:13:01 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D2CA255B for ; Sun, 27 Oct 2013 12:13:01 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id r9RCD0mA072450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 27 Oct 2013 05:13:00 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id r9RCD0B7072449; Sun, 27 Oct 2013 05:13:00 -0700 (PDT) (envelope-from jmg) Date: Sun, 27 Oct 2013 05:13:00 -0700 From: John-Mark Gurney To: Nomad Esst Subject: Re: Changing igb to foo in if_igb.c Message-ID: <20131027121300.GD58155@funkthat.com> Mail-Followup-To: Nomad Esst , freebsd-drivers@freebsd.org References: <1382869003.10661.YahooMailBasic@web162706.mail.bf1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1382869003.10661.YahooMailBasic@web162706.mail.bf1.yahoo.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sun, 27 Oct 2013 05:13:00 -0700 (PDT) Cc: freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 12:13:01 -0000 Nomad Esst wrote this message on Sun, Oct 27, 2013 at 03:16 -0700: > Hi list > I'm new here and I want you to excuse me for newish questions. > We have to types of igb cards(fiber and Ethernet) on our systems. Both of these cards are name igb# I want to change fiber ones to foo. I have took look at if_igb.c file, how can I detect the type of cards before filling driver_t structure out? e.g. If type=bar then filling with igb as name else if type=foo then filling with foo as name. > > static device_method_t igb_methods[] = { > /* Device interface */ > DEVMETHOD(device_probe, igb_probe), > DEVMETHOD(device_attach, igb_attach), > DEVMETHOD(device_detach, igb_detach), > DEVMETHOD(device_shutdown, igb_shutdown), > DEVMETHOD(device_suspend, igb_suspend), > DEVMETHOD(device_resume, igb_resume), > {0, 0} > }; > > static driver_t igb_driver = { > "igb", igb_methods, sizeof(struct adapter), > }; > > static devclass_t igb_devclass; > DRIVER_MODULE(igb, pci, igb_driver, igb_devclass, 0, 0); > MODULE_DEPEND(igb, pci, 1, 1, 1); > MODULE_DEPEND(igb, ether, 1, 1, 1); Why don't you use ifconfig igb0 name foo0 to do that? You can use rc.conf's ifconfig_igb0_name="foo0" to do that automaticly on boot everytime. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."