Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jul 2004 22:43:09 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Subject:   Re: cvs commit: src/sys/sys _task.h
Message-ID:  <20040730222815.B2631@epsplex.bde.org>
In-Reply-To: <20040728180711.GA31842@Odin.AC.HMC.Edu>
References:  <Pine.NEB.3.96L.1040728125025.26103B-100000@fledge.watson.org> <4107E0F6.8060902@samsco.org> <20040728180711.GA31842@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Jul 2004, Brooks Davis wrote:

> On Wed, Jul 28, 2004 at 11:23:02AM -0600, Scott Long wrote:
> > I'd be quite happy with
> >
> > #ifndef _KERNEL
> > #error "No user-servicable parts inside"
> >
> > or similar as is in /sys/sys/timetc.h.  Either way, pollution bad,
> > fluffy bunnies good.

This would add 2 style bugs that are not as in /sys/sys/timetc.h:
- capitalization of an error message
- misspelling of "serviceable"

> First we need to get our house in order.  I count at least 52 includes
> of net/if_var.h in our userland.  We could go ahead and add:
>
> #if defined(BURN_BRIDGES) && !defined(_KERNEL)
> #error "No user-servicable parts inside"
> #endif
>
> That would break all the offenders when we branch without forcing us to
> deal with yet another thing before 5.3.

Another way to properly break them is to put the user-serviceable
#error in kernel-only headers like <sys/mutex.h>.  This shows that
mounds of kernel interfaces are exported to userland via the nested
pollution in <net/if_var.h> (not just the mutex and task structs
which can be obtained without collateral pollution by including
just <sys/_mutex.h> and <sys/_task.h> (and their prerequisites...).

I never got much further than the following in cleaning this up:

%%%
Index: if_var.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_var.h,v
retrieving revision 1.80
diff -u -2 -r1.80 if_var.h
--- if_var.h	22 Jun 2004 20:13:25 -0000	1.80
+++ if_var.h	23 Jun 2004 02:00:09 -0000
@@ -59,25 +60,22 @@
  */

-#ifdef __STDC__
-/*
- * Forward structure declarations for function prototypes [sic].
- */
-struct	mbuf;
-struct	thread;
+struct	ether_header;
 struct	rtentry;
 struct	rt_addrinfo;
 struct	socket;
-struct	ether_header;
-#endif
+struct	thread;

-#include <sys/queue.h>		/* get TAILQ macros */
+#include <sys/event.h>			/* XXX XXX */
+#include <sys/queue.h>

 #ifdef _KERNEL
-#include <sys/mbuf.h>
-#include <sys/eventhandler.h>
-#endif /* _KERNEL */
-#include <sys/lock.h>		/* XXX */
-#include <sys/mutex.h>		/* XXX */
-#include <sys/event.h>		/* XXX */
+#include <sys/eventhandler.h>		/* XXX XXX */
+#include <sys/lock.h>			/* XXX XXX */
+#include <sys/mbuf.h>			/* XXX XXX */
+#include <sys/mutex.h>			/* XXX XXX */
+#else
+#include <sys/_lock.h>			/* XXX */
+#include <sys/_mutex.h>			/* XXX */
+#endif

 #define	IF_DUNIT_NONE	-1
%%%

(2 XXX's means that the pollution is worse than for 1 XXX.)

This may depend on other depollution.  Pollution in <sys/eventhandler.h>
is especially bad because lots of kernel files depend on it.

Bruce



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