Subject: Re: [PATCH] proc_fs.h redux

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Mon, 29 Oct 2007 11:03:04 -0200

Em Sun, Oct 28, 2007 at 09:44:41AM +0100, Sam Ravnborg escreveu:
> > 
> > As a general rule, I think it better to use includes
> > than use naked forward declarations.
> 
> Quite the opposite - at least in the kernel source.
> The general rule is that a .h file shall include the
> .h files which contain declarations used by said .h files.
> But naked declarations as above is preferred over including
> a full header file.

yup
 
> We see the full header dependency thing to blow off when
> inline function are used - which is more and more the case.
> In several cases we have converted inline functions to macros
> just to simplify the nightmare of header dependencies we have.
> 
> Arnaldo have a nice script that generate a .ps file
> showing all the dependencies.
> He lately posted this URL: http://oops.ghostprotocols.net:81/acme/tcp.h.ps

Well, not "lately", it has been quite a while. But lets celebrate the
fact that there is somebody trying to fight this battle one more time
and update this tcp.h dependency tree... /me looks for hviz... and if
graphviz is installed, ok:

http://www.kernel.org/pub/linux/kernel/people/acme/hviz

hviz include/linux/tcp.h 10 | dot -Tpdf > /tmp/tcp.h.2007_11.pdf

http://oops.ghostprotocols.net:81/acme/tcp.h.2007_11.pdf

We still get to sched.h, but before it was:

linux/tcp.h -> linux/skbuff.h -> linux/mm.h -> linux/sched.h

Nowadays its:

linux/tcp.h -> linux/sock.h -> linux/netdevice.h -> linux/interrupt.h -> linux/sched.h

And I just removed "#include <linux/sched.h> from linux/interrupt.h,
because as far as I checked it is completely unnecessary, and the
kernel builds just fine :-)

- Arnaldo