On Thu, Nov 25, 2004 at 03:13:12PM +0000, 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. > > What we've come up with is this: > > (1) Create new directories in the linux sources to shadow existing include > directories: > > NEW DIRECTORY DIRECTORY SHADOWED > ============= ================== > include/user/ include/linux/ > include/user-*/ include/asm-*/ > > Note that this doesn't take account of the other directories under > include/, but I don't think they're relevant. If we go for some resturcturing of include/ then we should get rid of the annoying asm symlink. Following layout deals with that: include//asm <= Files from include/asm- include//mach* <= Files from include/mach-* This layout solve the symlink issue in an elegant way. We need to do trivial changes to compiler options to make it work. Changing compiler options is much more relaible than using symlinks. Then the userspace part would then be located in: include//user-asm Userspace shall not be 'allowed' to include files from asm-generic direct, but asm-generic shall be part of the userspace api. > (2) Take each file from the shadowed directory. If it has any userspace > relevant stuff, then: > > (b) Make kernel file #include the user file. So: > > [include/asm-i386/unistd.h] > ... > #include In example above it would become: #include With repsect to consistency of the userspace header files then we could define a few simple rules: 1) Files in include/user must be able to compile standalone - so they include all files they need. 2) They are not allowed to use any files outside the kernel 3) Must not use __KERNEL__ in any place Writing a small script / Makefile that does these checks should be trivial. Jörn wrote something similar for include/linux at one point in time. If it is fast then we just let it be part of the standard compile so it is checked often. Sam