netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Joe Perches <joe@perches.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	akpm@osdl.org, torvalds@osdl.org, viro@zeniv.linux.org.uk,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH] proc_fs.h redux
Date: Sun, 28 Oct 2007 19:58:22 +0200	[thread overview]
Message-ID: <200710281858.23705.zippel@linux-m68k.org> (raw)
In-Reply-To: <20071028103415.GA12554@flint.arm.linux.org.uk>

Hi,

On Sunday 28 October 2007, Russell King wrote:

> On Sat, Oct 27, 2007 at 03:40:04PM -0700, Joe Perches wrote:
> > and forward declarations of
> >
> > struct proc_dir_entry;
> > struct file_operations;
> >
> > As a general rule, I think it better to use includes
> > than use naked forward declarations.
>
> If you go down that route, you end up with _lots_ of circular
> dependencies - header file X needs Y needs Z which needs X.  We've
> been there, several times.  It very quickly becomes quite
> unmaintainable - you end up with hard to predict behaviour from
> include files.
>
> The only realistic solution is to use forward declarations.

It's unfortunately more complicated than that. What basically needs to be done 
is to separate declarations from its users (usually inline functions). The 
problem is to correctly pull the declarations from the <asm/...> and 
<linux/...> header in the correct order. A typical mistake is to put 
declarations and inline functions in the same linux header and then include 
some additional from an asm header. For most high level header it's not much 
of a problem, but let's take <linux/list.h> as example. struct list_head is 
used everywhere, but just to get this one definition one also gets quite a 
few other dependencies as well.

bye, Roman

      parent reply	other threads:[~2007-10-28 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27 19:47 [PATCH] proc_fs.h redux Alexey Dobriyan
2007-10-27 22:40 ` Joe Perches
2007-10-28  7:02   ` Alexey Dobriyan
2007-10-28  8:44   ` Sam Ravnborg
2007-10-29 13:03     ` Arnaldo Carvalho de Melo
2007-10-28 10:34   ` Russell King
2007-10-28 10:43     ` Jan Engelhardt
2007-10-28 11:59     ` Bernhard Walle
2007-10-28 13:04       ` Russell King
2007-10-28 13:25         ` Bernhard Walle
2007-10-28 17:58     ` Roman Zippel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710281858.23705.zippel@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=joe@perches.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).