finishing the if.h/if_var.h split

Doug Rabson dfr at nlsystems.com
Tue Sep 30 10:25:59 PDT 2003


On Tue, 2003-09-30 at 09:22, Bruce Evans wrote:

> That's one alternative.  (Far too) many places already use the simple
> alternative of just using "struct device *".  Grep shows 68 lines
> containing "struct device" in *.h and 32 in *.c.  For "device_t", the
> numbers are 2140 in *.h and 5089 in *.c.  This is in a sys tree with
> about 1000 matches of "device_t" in generated files.  There are non-bogus
> uses of "struct device" to avoid namespace pollution in <sys/rman.h>.
> Most other uses are just bogus (modulo the existence of device_t being
> non-bogus -- its opaqueness is negative since anything that wants to
> use it must include <sys/bus.h> and thus can see its internals.  style(9)
> says to not use negatively opaque typedefs).

The internals of struct device are not contained in <sys/bus.h> - it is
completely opaque to users outside subr_bus.c. The main 'bug' here is
the idea that its a good thing to export kernel data structures (struct
ifnet) to userland. The layout of struct ifnet is an implementation
detail - it shouldn't form part of the userland api.





More information about the freebsd-net mailing list