Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2002 23:12:17 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Jonathan Lemon <jlemon@flugsvamp.com>
Cc:        Brooks Davis <brooks@one-eyed-alien.net>, net@FreeBSD.ORG
Subject:   Re: switching to if_xname from if_name and if_unit
Message-ID:  <20020726231217.A8038@Odin.AC.HMC.Edu>
In-Reply-To: <20020727005801.D6547@prism.flugsvamp.com>; from jlemon@flugsvamp.com on Sat, Jul 27, 2002 at 12:58:01AM -0500
References:  <20020726211050.A30598@Odin.AC.HMC.Edu> <20020727005801.D6547@prism.flugsvamp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jul 27, 2002 at 12:58:01AM -0500, Jonathan Lemon wrote:
> On Fri, Jul 26, 2002 at 09:10:50PM -0700, Brooks Davis wrote:
> > [Bcc to -arch for interested people not on -net]
> >=20
> > NetBSD and OpenBSD have replaced the "char *if_name" and "int if_unit"
> > members of struct ifnet with "char if_xname[IFNAMESIZ]".  I propose that
> > we follow suit.
> >=20
>=20
> Note that the unit/name appears to be stored at three places right now:
>=20
>    - interface	(if_name, if_unit)
>    - device_t	(dev->devclass->name, dev->unit, dev->nameunit)
>    - dev_t	(dev->si_name)
>=20
> I'd prefer if we could figure out how to do away with the names at the
> interface level completely and see if it is possible to use the dev->name=
unit
> instead.  Perhaps it would be feasible to add a device_t to the ifp?

The only problem I can see there is that not all interfaces have devices
associated with them.  lo(4) and vlan(4) are examples of that.  A useful
compromise might be to create a helper function/macro that takes an ifp
and dev and sets the if_xname member of the ifp.  That way we'll have
the same code in all the functions have have device_t's available in
if_attach without requiring new device_t's for each pseudo interface
just to have something to hang a name off of.

> Most uses of the if_name seem to be for error messages, and many newer
> drivers now use device_printf(dev, ...) for driver messages.

I've been thinking we need an if_printf(ifp, ...) function to get rid of
some of this uglyness.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--bg08WKrSYDhXBjb5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9QjnBXY6L6fI4GtQRAomuAKCT9y6x7vFtHFaiIq6NUZnlQ+HwcQCfTxdE
ebu+RF/MeVRUYu9g38R++dw=
=UIVX
-----END PGP SIGNATURE-----

--bg08WKrSYDhXBjb5--

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?20020726231217.A8038>