Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2001 08:07:12 -0600
From:      Warner Losh <imp@harmony.village.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        arch@FreeBSD.org
Subject:   Re: Proposed change: d_thread_t for driver portability between 4.x and 5.x 
Message-ID:  <200109281407.f8SE7C781171@harmony.village.org>
In-Reply-To: Your message of "Fri, 28 Sep 2001 19:39:33 %2B1000." <20010928192532.M52718-100000@delplex.bde.org> 
References:  <20010928192532.M52718-100000@delplex.bde.org>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20010928192532.M52718-100000@delplex.bde.org> Bruce Evans writes:
: This breaks 2 style rules :-).  From style(9):
: 
:      Avoid using typedefs for structure types.	Such typedefs make it impossi-
:      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:      ble for applications to use pointers to such a structure opaquely, which
:      is both possible and beneficial when using an ordinary struct tag.  When
:      convention requires a typedef, make its name match the struct tag.  Avoid
: 									 ^^^^^
:      typedefs ending in ``_t'', except as specified in Standard C or by POSIX.
:      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: 
: These are wollman's rules, not KNF.  I strongly agree with them, but we have
: too many of these personal rules which not everyone agreed to.

I know.  But you can't typedef a struct to be another struct.  And it
is no more broken than then d_open_t and this file isn't used by
userland progarms.

: I can see the use of d_thread_t^Hs if it is truly opaque.  Declaring it
: only in <sys/conf.h> or even including <sys/conf.h> breaks its opaqueness.
: Unfortunately, the other rule-breaking declarations like d_open_t require
: including the full <sys/conf.h> in device drivers.  It's another bug
: that dev_t is not either truly opaque or declared as "struct foo *".

Right.  This is a portability aid that we need because it is clear
that doing drivers for -current and -stable is going to be a big pita
and people will invent their own, possibly wrong, ways of doing this.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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