dev_t / udev_t confusion ?

Bruce Evans bde at zeta.org.au
Thu Jun 10 06:32:45 GMT 2004


On Wed, 9 Jun 2004, Peter Wemm wrote:

> On Wednesday 09 June 2004 08:55 am, Poul-Henning Kamp wrote:
> > In message <53993.1086779790 at critter.freebsd.dk>, Poul-Henning Kamp
> writes:
> > >The change proposed is more or less to do:
> > >	s/dev_t/struct cdev */
> > >	s/udev_t/dev_t/
> > >over all the kernel sources (366 files or so).
> >
> > Looks like a "yea" so far, so I have a couple of follow-up questions:
>
> I had a slight preference for 'kdev_t *' in the kernel, but 'struct cdev
> *' works for me as well so I've changed my mind.  No objection from me
> then.

This would be a large style bug (more of a design error, but not doing it
is documented in style(9)):

%%%
STYLE(9)               FreeBSD Kernel Developer's Manual              STYLE(9)

NAME
     style -- kernel source file style guide
...
     Avoid using typedefs for structure types.  Typedefs are problematic
     because they do not properly hide their underlying type; for example you
     need to know if the typedef is the structure itself or a pointer to the
     structure.  In addition they must be declared exactly once, whereas an
     incomplete structure type can be mentioned as many times as necessary.
     Typedefs are difficult to use in stand-alone header files: the header
     that defines the typedef must be included before the header that uses it,
     or by the header that uses it (which causes namespace pollution), or
     there must be a back-door mechanism for obtaining the typedef.
%%%

Bruce


More information about the freebsd-arch mailing list