svn commit: r231760 - head/sys/netgraph

Gleb Smirnoff glebius at FreeBSD.org
Wed Feb 15 15:27:31 UTC 2012


On Thu, Feb 16, 2012 at 02:19:37AM +1100, Bruce Evans wrote:
B> On Wed, 15 Feb 2012, Gleb Smirnoff wrote:
B> 
B> > Log:
B> >  style(9): sort includes.
B> > Modified: head/sys/netgraph/ng_base.c
B> > ==============================================================================
B> > --- head/sys/netgraph/ng_base.c	Wed Feb 15 14:23:01 2012	(r231759)
B> > +++ head/sys/netgraph/ng_base.c	Wed Feb 15 14:26:50 2012	(r231760)
B> > @@ -43,25 +43,25 @@
B> >  */
B> >
B> > #include <sys/param.h>
B> > -#include <sys/systm.h>
B> 
B> systm was already sorted.  Like param.h, it defines important macros that
B> may be needed by other headers.  For example, many headers use KASSERT().
B> KASSERT() happens to be a macro, so this happens to work if the other
B> headers only use it in other macros, but this would fail if any of the
B> other headers started using it in an inline functions.
B> 
B> > #include <sys/ctype.h>
B> > #include <sys/errno.h>
B> 
B> errno.h is standard pollution in param.h.  Including it directly is a
B> style bug.  This style bug was not very common.  It was in 7 files
B> in kern in 4.4BSD-Lite2, 1 in kern in FreeBSD-3 (after I fixed it in
B> FreeBSD-2), 4 in kern in FreeBSD-4, and 8 in kern in -current.  But
B> in the top level directory of netgraph, it is in all 49 of 49 .c files
B> in -current.
B> 
B> > #include <sys/kdb.h>
B> > #include <sys/kernel.h>
B> > +#include <sys/kthread.h>
B> > #include <sys/ktr.h>
B> > #include <sys/limits.h>
B> > #include <sys/lock.h>
B> > #include <sys/malloc.h>
B> > #include <sys/mbuf.h>
B> > +#include <sys/proc.h>
B> > #include <sys/queue.h>
B> 
B> queue.h is nonstandard pollution in many headers.  It has already been
B> included (guarded) many times before here.  Unfortunately, since it
B> is nonstandard, this can't be depended on, though many .c files do.

Bruce,

is this patch okay?

Index: ng_base.c
===================================================================
--- ng_base.c   (revision 231765)
+++ ng_base.c   (working copy)
@@ -43,8 +43,8 @@
  */
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/ctype.h>
-#include <sys/errno.h>
 #include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
@@ -60,7 +60,6 @@
 #include <sys/smp.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
-#include <sys/systm.h>
 #include <sys/unistd.h>
 #include <machine/cpu.h>

I'd prefer to leave sys/queue.h included explicitly.

-- 
Totus tuus, Glebius.


More information about the svn-src-head mailing list