mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h
@ 2009-04-10  2:32 Alexey Dobriyan
  2009-04-10  8:47 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2009-04-10  2:32 UTC (permalink / raw)
  To: akpm, containers
  Cc: xemul, serue, dave, mingo, orenl, hch, torvalds, linux-kernel

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;
+
 /*
  * ipc namespace events
  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h
  2009-04-10  2:32 [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h Alexey Dobriyan
@ 2009-04-10  8:47 ` Ingo Molnar
  2009-04-10 13:17   ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2009-04-10  8:47 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: akpm, containers, xemul, serue, dave, orenl, hch, torvalds, linux-kernel


* 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h
  2009-04-10  8:47 ` Ingo Molnar
@ 2009-04-10 13:17   ` Alexey Dobriyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2009-04-10 13:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: akpm, containers, xemul, serue, dave, orenl, hch, torvalds, linux-kernel

On Fri, Apr 10, 2009 at 10:47:47AM +0200, Ingo Molnar wrote:
> 
> * Alexey Dobriyan <adobriyan@gmail.com> wrote:

> > +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.

It's at the top of the file, there is no random placing going on.

> 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.

This can be viewed as bad precedent created by mm_types.h.

Look how many headers mm_types.h includes. It doesn't change much
if one includes mm.h or mm_types.h.

Look how many places includes spinlock_types.h

> 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.

Forward declarations are currently well established.

Want to change rules? Fine, do it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-10 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-10  2:32 [PATCH 01/30] headers: fixup cred.h, ipc_namespace.h Alexey Dobriyan
2009-04-10  8:47 ` Ingo Molnar
2009-04-10 13:17   ` Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®