Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262388AbUKZW7Q (ORCPT ); Fri, 26 Nov 2004 17:59:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262372AbUKZW5M (ORCPT ); Fri, 26 Nov 2004 17:57:12 -0500 Received: from zeus.kernel.org ([204.152.189.113]:49861 "EHLO zeus.kernel.org") by vger.kernel.org with ESMTP id S263360AbUKZTth (ORCPT ); Fri, 26 Nov 2004 14:49:37 -0500 From: David Howells To: torvalds@osdl.org, hch@infradead.org, matthew@wil.cx, dwmw2@infradead.org, aoliva@redhat.com cc: linux-kernel@vger.kernel.org, libc-hacker@sources.redhat.com Subject: [RFC] Splitting kernel headers and deprecating __KERNEL__ User-Agent: EMH/1.14.1 SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Date: Thu, 25 Nov 2004 15:13:12 +0000 Message-ID: <19865.1101395592@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3049 Lines: 98 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. (2) Take each file from the shadowed directory. If it has any userspace relevant stuff, then: (a) Transfer this stuff into a file of the same name in the new directory. So, for example, the syscall number list from include/asm-i386/unistd.h will be transferred to include/user-i386/unistd.h. (b) Make kernel file #include the user file. So: [include/asm-i386/unistd.h] ... #include ... (c) Where a user header file requires something from another header file (such as a type), that file should include a suitable user header file directly: [include/user-i386/termio.h] ... #include ... (d) stdint types should be used where possible. [include/user-i386/termios.h] struct winsize { uint16_t ws_row; uint16_t ws_col; uint16_t ws_xpixel; uint16_t ws_ypixel; }; (e) These header files should be bounded with __USER_XXXXX_H conditionals: [include/user-i386/termios.h] #ifndef __USER_I386_TERMIOS_H #define __USER_I386_TERMIOS_H ... #endif /* __USER_I386_TERMIOS_H */ (3) Remove all #if(n)def __KERNEL__ clauses. (4) Remove the -D__KERNEL__ from the master kernel Makefile. (5) For userspace use (such as for glibc), the appropriate include/user*/ directories should be selected and installed in /usr/include/ or wherever, and symlinks made. For example, on i386 arch boxes, you might find: SOURCE INSTALLED AS ====================== ============ include/user/ /usr/include/user/ include/user-i386/ /usr/include/user-i386/ /usr/include/linux -> user /usr/include/asm -> user-i386 (6) On multi-arch archs (such as ppc64 which can also support ppc), you might find: SOURCE INSTALLED AS ====================== ============ include/user/ /usr/include/user/ include/user-ppc/ /usr/include/user-ppc/ include/user-ppc64/ /usr/include/user-ppc64/ /usr/include/linux -> user /usr/include/asm-ppc -> user-ppc /usr/include/asm-ppc64 -> user-ppc64 And then /usr/include/asm/ might contain files that do arch-size dependent switching between user-ppc and user-ppc64. David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/