Re: [RFC] Splitting kernel headers and deprecating __KERNEL__

Kyle Moffett
2004-11-27T03:10:02Z

On Nov 25, 2004, at 10:13, David Howells wrote:
> We've been discussing splitting the kernel headers into userspace API
> headers
> and kernel internal headers and deprecating the __KERNEL__ macro. This
> will
> permit a cleaner interface between the kernel and userspace; and one
> that's
> easier to keep up to date.

Yay!!! Finally!!!

> NEW DIRECTORY DIRECTORY SHADOWED
> ============= ==================
> include/user/ include/linux/
> include/user-*/ include/asm-*/

How about include/abi for the platform-independent headers and
include/arch-*
for the platform-specific headers? Then include/arch would be
symlinked to the
correct arch-* directory.

> Note that this doesn't take account of the other directories under
> include/, but I don't think they're relevant.

Perhaps such directories should either be broken out into
abi/foo<->linux/foo
pieces, or put into their own top-level directories.

> (2) Take each file from the shadowed directory. If it has any
> userspace
> relevant stuff, then:
[...snip...]

Something like this would warn about incorrect uses of the linux/
headers, yet
still allow for a period of backwards compatibility. Once such period
has passed,
then linux/* would not even be installed, only abi/* and arch/*

include/linux/foo.h:
#ifndef _LINUX_FOO_H
#define _LINUX_FOO_H 1

#ifndef __KERNEL__
# warning "Directly including <kernel/foo.h> is deprecated!!!"
# warning "Please change your program to include <abi/foo.h> instead!!!"
#endif

#include <abi/foo.h>

#ifdef __KERNEL__
/* Old __KERNEL__ contents of include/linux/foo.h */
#endif

#endif /* not _LINUX_FOO_H */

include/abi/foo.h:
#ifndef _ABI_FOO_H
#define_ABI_FOO_H 1

#include <abi/bar.h>
#include <arch/baz.h>

/* Old non-__KERNEL__ contents of include/linux/foo.h */

#endif /* not _ABI_FOO_H */

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a17 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r
!y?(-)
------END GEEK CODE BLOCK------