Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Aug 2002 02:21:47 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        "M. Warner Losh" <imp@bsdimp.com>, <net@FreeBSD.ORG>
Subject:   Re: switching to if_xname from if_name and if_unit
Message-ID:  <20020802015442.S2977-100000@gamplex.bde.org>
In-Reply-To: <20020730113044.A7396@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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_<name>" 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020802015442.S2977-100000>