linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, containers@lists.linux-foundation.org,
	xemul@parallels.com, serue@us.ibm.com, dave@linux.vnet.ibm.com,
	orenl@cs.columbia.edu, hch@infradead.org,
	torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h
Date: Fri, 10 Apr 2009 10:47:47 +0200	[thread overview]
Message-ID: <20090410084747.GB17962@elte.hu> (raw)
In-Reply-To: <20090410023248.GB27788@x200.localdomain>


* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> cred.h uses __init
> ipc_namespace.h uses kern_ipc_perm.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  include/linux/cred.h          |    1 +
>  include/linux/ipc_namespace.h |    2 ++
>  2 files changed, 3 insertions(+)
> 
> --- a/include/linux/cred.h
> +++ b/include/linux/cred.h
> @@ -13,6 +13,7 @@
>  #define _LINUX_CRED_H
>  
>  #include <linux/capability.h>
> +#include <linux/init.h>
>  #include <linux/key.h>
>  #include <asm/atomic.h>
>  
> --- a/include/linux/ipc_namespace.h
> +++ b/include/linux/ipc_namespace.h
> @@ -6,6 +6,8 @@
>  #include <linux/rwsem.h>
>  #include <linux/notifier.h>
>  
> +struct kern_ipc_perm;
> +

Please, not yet another forward declaration...

I believe this should be cleaned up properly, instead of sprinkling 
the kernel with random placed forward declarations.

In a cleanly structured piace of code there's rarely any need for 
forward declarations like this. There's two basic header types 
needed:

   foo_types.h       declares all the data types and constants
                     [no complex inline functions]

   foo.h             externs, complex inlines

foo.h includes all foo_types.h and bar_types.h headers it needs.

The foo_types.h file includes all other bar_types.h headers it 
depends on for its data type definitions.

foo_types.h never includes a bar.h file.

The end result will be a clean hieararchy of data types, separated 
from methods. Complex inlines dont create the incestous 
cross-dependency hell anymore and dont contaminate the foo_types.h 
files.

Yes, this is quite a bit of work, but this has been done before for 
several complex headers so it's possible to do it. Also, you 
namespace guys compounded this particular IPC headers sub-problem to 
begin with:

 | commit ae5e1b22f17983da929a0d0178896269e19da186
 | Author: Pavel Emelyanov <xemul@openvz.org>
 | Date:   Fri Feb 8 04:18:22 2008 -0800
 |
 |     namespaces: move the IPC namespace under IPC_NS option

So when touching the IPC header code please clean it up all 
properly. We need separate ipc_types.h and ipc.h headers with clean 
rules and a clean, consistent looking total presentation.

To borrow a recent phrase of hch, right now when i look at all the 
ipc related headers it looks like as if a cat barfed all over the 
place ;-)

Thanks,

	Ingo

  reply	other threads:[~2009-04-10  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-10  2:32 [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h Alexey Dobriyan
2009-04-10  8:47 ` Ingo Molnar [this message]
2009-04-10 13:17   ` Alexey Dobriyan

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=20090410084747.GB17962@elte.hu \
    --to=mingo@elte.hu \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orenl@cs.columbia.edu \
    --cc=serue@us.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xemul@parallels.com \
    /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).