From owner-freebsd-net Thu Aug 1 9:17:12 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5016437B400 for ; Thu, 1 Aug 2002 09:17:09 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E6A4C43E77 for ; Thu, 1 Aug 2002 09:17:07 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id CAA20957; Fri, 2 Aug 2002 02:16:49 +1000 Date: Fri, 2 Aug 2002 02:21:47 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Brooks Davis Cc: "M. Warner Losh" , Subject: Re: switching to if_xname from if_name and if_unit In-Reply-To: <20020730113044.A7396@Odin.AC.HMC.Edu> Message-ID: <20020802015442.S2977-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Tue, 30 Jul 2002, Brooks Davis wrote: > On Wed, Jul 31, 2002 at 04:22:23AM +1000, Bruce Evans wrote: > > On Tue, 30 Jul 2002, Brooks Davis wrote: > > > > > On Mon, Jul 29, 2002 at 10:38:34PM -0600, M. Warner Losh wrote: > > > > : @@ -280,8 +280,7 @@ ep_attach(sc) > > > > : attached = (ifp->if_softc != 0); > > > > : > > > > : ifp->if_softc = sc; > > > > : - ifp->if_unit = sc->unit; > > > > : - ifp->if_name = "ep"; > > > > : + sprintf(ifp->if_xname, "ep%d", sc->unit); > > > > > > > > strcpy(ifp->if_xname, device_get_name(sc->dev)); > > > > > > > > might be better, don't you think? > > > > I think this point has already been covered better by noticing that the > > name is already stored in several other places (not just new-bus). > > I don't think it's stored elsewhere for pure pseudo interfaces like lo > or gif though (except as "if_" in the module decleration.) I > don't see name that is consistantly associated with all interfaces. Right. I was a little confused about this, partly because device_get_name() only applies to device_t's. I just checked that there is no newbus device for typical synthetic devices like tun* and tap*. There is (kernel) dev_t, but it is not always accessible. However, you could make it accessible by storing it in *ifp and/or *scp and then access its name using devtoname(xxp->xx_devp). A pointer would take a bit less space than the proposed if_xname size on most machines and be more flexible. devtoname() is certainly closer to working here than device_get_name() or device_get_nameunit(). I've noticed that the newbus name interfaces also can't handle disk device names (partly because disks are partitioned below newbus and partly because the names have more structure than name+unit). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message