Skip to contentSkip to conversation

All arch maintainers: 'make headers_check' fails on most architectures.

PATCH In review David Woodhouse 11 participants 40 messages Sep 12, 2006 – Sep 23, 2006

Subsystems (30)
lore
Share & tools
lore
#0 lore raw

Basically all but PowerPC and i386 have problems; and the latter works only if you apply the patches I sent to Linus a few days ago.

This is just a basic check that the headers which _are_ exported don't try to include other headers which aren't. This can happen either because the former should not, or the latter _should_ be exported. Mostly, however, the solution is just to make sure the latter is included only within #ifdef __KERNEL__, because it's only needed within that ifdef anyway.

Admittedly, much of the time this is only seen in files like asm/page.h or asm/elf.h which we really don't expect anyone in userspace to be using anyway -- but it would be good to fix them anyway.

Omitting the headers for which I've already sent patches to Linus, these are the remaining problems found by running the scripts/hdrcheck.sh over the exported kernel headers (automatically exported from Linus' current tree, and available from
git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/kernel-headers.git )

$ for ARCH in `ls -d asm* | cut -c5- | grep -v generic`; do rm -f asm ; ln -sf asm-$ARCH asm ; for FILE in asm-$ARCH/*.h ; do ../linux-2.6/scripts/hdrcheck.sh . $FILE  ; done ; done
asm-alpha/byteorder.h requires asm/compiler.h, which does not exist
asm-alpha/page.h requires asm-generic/memory_model.h, which does not exist
asm-arm/elf.h requires asm/procinfo.h, which does not exist
asm-arm/page.h requires asm-generic/page.h, which does not exist
asm-arm26/elf.h requires asm/procinfo.h, which does not exist
asm-arm26/page.h requires asm-generic/page.h, which does not exist
asm-cris/byteorder.h requires asm/arch/byteorder.h, which does not exist
asm-cris/elf.h requires asm/arch/elf.h, which does not exist
asm-cris/page.h requires asm/arch/page.h, which does not exist
asm-cris/posix_types.h requires asm/bitops.h, which does not exist
asm-cris/ptrace.h requires asm/arch/ptrace.h, which does not exist
asm-cris/termios.h requires asm/rs485.h, which does not exist
asm-cris/unistd.h requires asm/arch/unistd.h, which does not exist
asm-cris/user.h requires asm/arch/user.h, which does not exist
asm-frv/page.h requires asm-generic/memory_model.h, which does not exist
asm-frv/ptrace.h requires asm/registers.h, which does not exist
asm-frv/sigcontext.h requires asm/registers.h, which does not exist
asm-frv/termios.h requires asm-generic/termios.h, which does not exist
asm-frv/user.h requires asm/registers.h, which does not exist
asm-h8300/page.h requires asm-generic/memory_model.h, which does not exist
asm-ia64/ptrace.h requires asm/asm-offsets.h, which does not exist
asm-ia64/resource.h requires asm/ustack.h, which does not exist
asm-m32r/page.h requires asm-generic/memory_model.h, which does not exist
asm-m32r/ptrace.h requires asm/m32r.h, which does not exist
asm-m32r/signal.h requires linux/linkage.h, which does not exist
asm-m32r/unistd.h requires asm/syscall.h, which does not exist
asm-m32r/user.h requires asm/processor.h, which does not exist
asm-m68k/page.h requires asm-generic/page.h, which does not exist
asm-m68knommu/page.h requires asm-generic/page.h, which does not exist
asm-mips/page.h requires asm-generic/memory_model.h, which does not exist
asm-mips/posix_types.h requires asm/sgidefs.h, which does not exist
asm-mips/ptrace.h requires asm/isadep.h, which does not exist
asm-mips/sigcontext.h requires asm/sgidefs.h, which does not exist
asm-mips/statfs.h requires asm/sgidefs.h, which does not exist
asm-mips/stat.h requires asm/sgidefs.h, which does not exist
asm-mips/unistd.h requires asm/sgidefs.h, which does not exist
asm-mips/user.h requires asm/reg.h, which does not exist
asm-parisc/page.h requires asm-generic/memory_model.h, which does not exist
asm-s390/debug.h requires linux/string.h, which does not exist
asm-s390/elf.h requires asm/system.h, which does not exist
asm-sh/page.h requires asm-generic/memory_model.h, which does not exist
asm-sh/ptrace.h requires asm/ubc.h, which does not exist
asm-sh64/page.h requires asm-generic/memory_model.h, which does not exist
asm-sh64/shmparam.h requires asm/cache.h, which does not exist
asm-sh64/signal.h requires asm/processor.h, which does not exist
asm-sh64/user.h requires asm/processor.h, which does not exist
asm-sparc/auxio.h requires asm/system.h, which does not exist
asm-sparc/page.h requires asm-generic/memory_model.h, which does not exist
asm-sparc/pbm.h requires asm/oplib.h, which does not exist
asm-sparc/pgtsun4.h requires asm/contregs.h, which does not exist
asm-sparc/turbosparc.h requires asm/pgtsrmmu.h, which does not exist
asm-sparc64/floppy.h requires linux/init.h, which does not exist
asm-sparc64/kdebug.h requires linux/notifier.h, which does not exist
asm-sparc64/mostek.h requires asm/idprom.h, which does not exist
asm-sparc64/page.h requires asm/const.h, which does not exist
asm-sparc64/parport.h requires asm/ebus.h, which does not exist
asm-sparc64/pstate.h requires asm/const.h, which does not exist
asm-sparc64/shmparam.h requires asm/spitfire.h, which does not exist
asm-um/page.h requires asm/vm-flags.h, which does not exist
asm-um/unistd.h requires linux/syscalls.h, which does not exist
asm-v850/page.h requires asm/machdep.h, which does not exist
asm-v850/param.h requires asm/machdep.h, which does not exist
asm-x86_64/elf.h requires asm/processor.h, which does not exist
asm-x86_64/signal.h requires linux/linkage.h, which does not exist
asm-x86_64/unistd.h requires linux/linkage.h, which does not exist
asm-x86_64/vsyscall.h requires linux/seqlock.h, which does not exist
asm-xtensa/byteorder.h requires asm/processor.h, which does not exist
asm-xtensa/elf.h requires asm/coprocessor.h, which does not exist
asm-xtensa/page.h requires asm-generic/memory_model.h, which does not exist
asm-xtensa/shmparam.h requires asm/processor.h, which does not exist
asm-xtensa/sigcontext.h requires asm/processor.h, which does not exist
Signature · 1 line
dwmw2
#1 lore raw

PATCH 1/5 Fix 'make headers_check' on biarch architectures for 2.6.18

We generate an <asm/foo.h> which includes either <asm-$ARCH/foo.h> or <asm-$ALTARCH/foo.h> as appropriate. But we were doing this dependent on whether the file in question existed in the _unexported_ tree, not the exported tree. So if a file was exported to userspace in one asm- directory but not the other, the generated file in asm/ was incorrect.

This only changed the failure mode if it _was_ included from a nice #error to a less explicable #include failure -- but it also gave false errors in 'make headers_check' output. Fix it by looking in the right place instead.

scripts/Makefile.headersinst +5 -3
index aa9990a..12e1daf 100644
@@ -93,14 +93,14 @@ (echo "/* File autogenerated by 'make he
 echo "\#ifndef $$STUBDEF" ;						\
 echo "\#define $$STUBDEF" ;						\
 echo "\# if $(ARCHDEF)" ;						\
-if [ -r $(srctree)/include/$(archasm)/$@ ]; then			\
+if [ -r $(INSTALL_HDR_PATH)/include/$(archasm)/$@ ]; then		\
 	echo "\#  include <$(archasm)/$@>" ;				\
 else									\
 	echo "\#  error $(archasm)/$@ does not exist in"		\
 			"the $(ARCH) architecture" ;			\
 fi ;									\
 echo "\# elif $(ALTARCHDEF)" ;						\
-if [ -r $(srctree)/include/$(altarchasm)/$@ ]; then			\
+if [ -r $(INSTALL_HDR_PATH)/include/$(altarchasm)/$@ ]; then		\
 	echo "\#  include <$(altarchasm)/$@>" ;				\
 else									\
 	echo "\#  error $(altarchasm)/$@ does not exist in"		\
@@ -149,7 +149,9 @@ endif
 hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
 
 .PHONY: altarch-dir
-altarch-dir:
+# All the files in the normal arch dir must be created first, since we test
+# for their existence.
+altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y)
 	$(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
 	$(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm
 
Signature · 1 line
dwmw2
#2 lore raw

PATCH 2/5 Fix 'make headers_check' on s390 for 2.6.18

In reply to David Woodhouse
Quoted 2 lines · David Woodhouse

asm-s390/debug.h requires linux/string.h, which does not exist asm-s390/elf.h requires asm/system.h, which does not exist

Move things around slightly so the right things end up within #ifdef __KERNEL__ and thus don't pollute the exported headers.

include/asm-s390/debug.h +1 -1
index 7f1ef99..c00dd2b 100644
@@ -10,7 +10,6 @@ #ifndef DEBUG_H
 #define DEBUG_H
 
 #include <linux/fs.h>
-#include <linux/string.h>
 
 /* Note:
  * struct __debug_entry must be defined outside of #ifdef __KERNEL__ 
@@ -35,6 +34,7 @@ struct __debug_entry{
 #define __DEBUG_FEATURE_VERSION      2  /* version of debug feature */
 
 #ifdef __KERNEL__
+#include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/kernel.h>
 #include <linux/time.h>
include/asm-s390/elf.h +14 -14
index 710646e..c0d629d 100644
@@ -93,19 +93,6 @@ #define R_390_TLS_GOTIE20	60	/* 20 bit G
 #define R_390_NUM	61
 
 /*
- * ELF register definitions..
- */
-
-#include <linux/sched.h>	/* for task_struct */
-#include <asm/ptrace.h>
-#include <asm/user.h>
-#include <asm/system.h>		/* for save_access_regs */
-
-
-typedef s390_fp_regs elf_fpregset_t;
-typedef s390_regs elf_gregset_t;
-
-/*
  * These are used to set parameters in the core dumps.
  */
 #ifndef __s390x__
@@ -117,6 +104,20 @@ #define ELF_DATA	ELFDATA2MSB
 #define ELF_ARCH	EM_S390
 
 /*
+ * ELF register definitions..
+ */
+
+#include <asm/ptrace.h>
+#include <asm/user.h>
+
+typedef s390_fp_regs elf_fpregset_t;
+typedef s390_regs elf_gregset_t;
+
+#ifdef __KERNEL__
+#include <linux/sched.h>	/* for task_struct */
+#include <asm/system.h>		/* for save_access_regs */
+
+/*
  * This is used to ensure we don't load something for the wrong architecture.
  */
 #define elf_check_arch(x) \
@@ -198,7 +199,6 @@ #define ELF_HWCAP (0)
 
 #define ELF_PLATFORM (NULL)
 
-#ifdef __KERNEL__
 #ifndef __s390x__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
 #else /* __s390x__ */
Signature · 1 line
dwmw2
#3 lore raw

Re: [PATCH] [2/5] Fix 'make headers_check' on s390 for 2.6.18

Quoted 5 lines · David Woodhouse
Quoted 2 lines

asm-s390/debug.h requires linux/string.h, which does not exist asm-s390/elf.h requires asm/system.h, which does not exist

Move things around slightly so the right things end up within #ifdef __KERNEL__ and thus don't pollute the exported headers.

Thanks David, looks good.

Signature · 8 lines
blue skies,
  Martin.

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH

"Reality continues to ruin my life." - Calvin.
#4 lore raw

PATCH 3/5 Fix 'make headers_check' on ia64 for 2.6.18

In reply to David Woodhouse
Quoted 2 lines · David Woodhouse

asm-ia64/ptrace.h requires asm/asm-offsets.h, which does not exist asm-ia64/resource.h requires asm/ustack.h, which does not exist

Hide parts which shouldn't be visible to userspace.

index 85d6f80..f1cb00f 100644

include/asm-ia64/Kbuild +1 -1
@@ -4,4 +4,4 @@ header-y += break.h fpu.h fpswa.h gcc_in
 	 intel_intrin.h intrinsics.h perfmon_default_smpl.h	\
 	 ptrace_offsets.h rse.h setup.h ucontext.h
 
-unifdef-y += perfmon.h
+unifdef-y += perfmon.h ustack.h
include/asm-ia64/page.h +2 -2
index f5a949e..947cb72 100644
@@ -7,6 +7,7 @@ #define _ASM_IA64_PAGE_H
  *	David Mosberger-Tang <[email protected]>
  */
 
+# ifdef __KERNEL__
 
 #include <asm/intrinsics.h>
 #include <asm/types.h>
@@ -64,7 +65,6 @@ #ifdef __ASSEMBLY__
 # define __pa(x)		((x) - PAGE_OFFSET)
 # define __va(x)		((x) + PAGE_OFFSET)
 #else /* !__ASSEMBLY */
-# ifdef __KERNEL__
 #  define STRICT_MM_TYPECHECKS
 
 extern void clear_page (void *page);
@@ -174,7 +174,6 @@ get_order (unsigned long size)
 	return order;
 }
 
-# endif /* __KERNEL__ */
 #endif /* !__ASSEMBLY__ */
 
 #ifdef STRICT_MM_TYPECHECKS
@@ -228,4 +227,5 @@ #define VM_DATA_DEFAULT_FLAGS		(VM_READ 
 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
 					  ? VM_EXEC : 0))
 
+# endif /* __KERNEL__ */
 #endif /* _ASM_IA64_PAGE_H */
include/asm-ia64/ptrace.h +7 -3
index 415abb2..1414316 100644
@@ -56,6 +56,8 @@ #define _ASM_IA64_PTRACE_H
 
 
 #include <asm/fpu.h>
+
+#ifdef __KERNEL__
 #ifndef ASM_OFFSETS_C
 #include <asm/asm-offsets.h>
 #endif
@@ -79,10 +81,9 @@ #define IA64_STK_OFFSET			((1 << KERNEL_
 
 #define KERNEL_STACK_SIZE		IA64_STK_OFFSET
 
-#ifndef __ASSEMBLY__
+#endif /* __KERNEL__ */
 
-#include <asm/current.h>
-#include <asm/page.h>
+#ifndef __ASSEMBLY__
 
 /*
  * This struct defines the way the registers are saved on system
@@ -229,6 +230,9 @@ struct switch_stack {
 
 #ifdef __KERNEL__
 
+#include <asm/current.h>
+#include <asm/page.h>
+
 #define __ARCH_SYS_PTRACE	1
 
 /*
include/asm-ia64/ustack.h +5 -2
index da55c91..a349467 100644
@@ -5,12 +5,15 @@ #define _ASM_IA64_USTACK_H
  * Constants for the user stack size
  */
 
+#ifdef __KERNEL__
 #include <asm/page.h>
 
 /* The absolute hard limit for stack size is 1/2 of the mappable space in the region */
 #define MAX_USER_STACK_SIZE	(RGN_MAP_LIMIT/2)
-/* Make a default stack size of 2GB */
-#define DEFAULT_USER_STACK_SIZE	(1UL << 31)
 #define STACK_TOP		(0x6000000000000000UL + RGN_MAP_LIMIT)
+#endif
+
+/* Make a default stack size of 2GiB */
+#define DEFAULT_USER_STACK_SIZE	(1UL << 31)
 
 #endif /* _ASM_IA64_USTACK_H */
Signature · 1 line
dwmw2
#5 lore raw

PATCH 4/5 Fix 'make headers_check' on x86_64 for 2.6.18

In reply to David Woodhouse
Quoted 4 lines · David Woodhouse

asm-x86_64/elf.h requires asm/processor.h, which does not exist asm-x86_64/signal.h requires linux/linkage.h, which does not exist asm-x86_64/unistd.h requires linux/linkage.h, which does not exist asm-x86_64/vsyscall.h requires linux/seqlock.h, which does not exist

Again, move stuff which shouldn't be visible inside (mostly already existing) #ifdef __KERNEL__.

This fixes a bunch of mislabelled and unlabelled #endifs in unistd.h and also cleans that up to conform with what's visible on other architectures, since the minimal fix for the error reported about would have involved a more intrusive patch, renesting other ifdefs.

include/asm-x86_64/Kbuild +0 -0
include/asm-x86_64/elf.h +11 -9
index b4f8f4a..a406fcb 100644
@@ -7,8 +7,6 @@ #define __ASM_X86_64_ELF_H
 
 #include <asm/ptrace.h>
 #include <asm/user.h>
-#include <asm/processor.h>
-#include <asm/compat.h>
 
 /* x86-64 relocation types */
 #define R_X86_64_NONE		0	/* No reloc */
@@ -39,18 +37,23 @@ typedef elf_greg_t elf_gregset_t[ELF_NGR
 typedef struct user_i387_struct elf_fpregset_t;
 
 /*
- * This is used to ensure we don't load something for the wrong architecture.
- */
-#define elf_check_arch(x) \
-	((x)->e_machine == EM_X86_64)
-
-/*
  * These are used to set parameters in the core dumps.
  */
 #define ELF_CLASS	ELFCLASS64
 #define ELF_DATA	ELFDATA2LSB
 #define ELF_ARCH	EM_X86_64
 
+#ifdef __KERNEL__
+#include <asm/processor.h>
+#include <asm/compat.h>
+
+/*
+ * This is used to ensure we don't load something for the wrong architecture.
+ */
+#define elf_check_arch(x) \
+	((x)->e_machine == EM_X86_64)
+
+
 /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
    contains a pointer to a function which might be registered using `atexit'.
    This provides a mean for the dynamic linker to call DT_FINI functions for
@@ -141,7 +144,6 @@ #define ELF_HWCAP	(boot_cpu_data.x86_cap
 /* I'm not sure if we can use '-' here */
 #define ELF_PLATFORM  ("x86_64")
 
-#ifdef __KERNEL__
 extern void set_personality_64bit(void);
 #define SET_PERSONALITY(ex, ibcs2) set_personality_64bit()
 /*
include/asm-x86_64/signal.h +1 -1
index cef7a7d..3ede2a6 100644
@@ -3,13 +3,13 @@ #define _ASMx8664_SIGNAL_H
 
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
-#include <linux/linkage.h>
 #include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
 
 #ifdef __KERNEL__
+#include <linux/linkage.h>
 /* Most things should be clean enough to redefine this at will, if care
    is taken to make libc match.  */
 
include/asm-x86_64/unistd.h +8 -8
index 2d89d30..80fd48e 100644
@@ -620,6 +620,8 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice)
 #define __NR_move_pages		279
 __SYSCALL(__NR_move_pages, sys_move_pages)
 
+#ifdef __KERNEL__
+
 #define __NR_syscall_max __NR_move_pages
 
 #ifndef __NO_STUBS
@@ -744,8 +746,6 @@ __syscall_return(type,__res); \
 
 #else /* __KERNEL_SYSCALLS__ */
 
-#ifdef __KERNEL__
-
 #include <linux/syscalls.h>
 #include <asm/ptrace.h>
 
@@ -821,8 +821,6 @@ asmlinkage long sys_fork(struct pt_regs 
 asmlinkage long sys_vfork(struct pt_regs regs);
 asmlinkage long sys_pipe(int *fildes);
 
-#endif /* __KERNEL_SYSCALLS__ */
-
 #ifndef __ASSEMBLY__
 
 #include <linux/linkage.h>
@@ -838,9 +836,9 @@ asmlinkage long sys_rt_sigaction(int sig
 				struct sigaction __user *oact,
 				size_t sigsetsize);
 
-#endif
+#endif  /* __ASSEMBLY__ */
 
-#endif
+#endif /* __KERNEL_SYSCALLS__ */
 
 /*
  * "Conditional" syscalls
@@ -850,6 +848,8 @@ #endif
  */
 #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
 
-#endif
+#endif /* __NO_STUBS */
 
-#endif
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_X86_64_UNISTD_H_ */
include/asm-x86_64/vsyscall.h +1 -2
index a85e16f..146b244 100644
@@ -1,8 +1,6 @@
 #ifndef _ASM_X86_64_VSYSCALL_H_
 #define _ASM_X86_64_VSYSCALL_H_
 
-#include <linux/seqlock.h>
-
 enum vsyscall_num {
 	__NR_vgettimeofday,
 	__NR_vtime,
@@ -14,6 +12,7 @@ #define VSYSCALL_END (-2UL << 20)
 #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
 
 #ifdef __KERNEL__
+#include <linux/seqlock.h>
 
 #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
 #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16)))
Signature · 1 line
dwmw2
#6 lore raw

PATCH 5/5 Fix 'make headers_check' on i386 for 2.6.18

In reply to David Woodhouse

This brings i386 asm/unistd.h into consistency with other architectures by not exporting functionality which is not necessary.

include/asm-i386/unistd.h +2 -2
index d983b74..fc1c8dd 100644
@@ -324,6 +324,8 @@ #define __NR_tee		315
 #define __NR_vmsplice		316
 #define __NR_move_pages		317
 
+#ifdef __KERNEL__
+
 #define NR_syscalls 318
 
 /*
@@ -423,8 +425,6 @@ __asm__ volatile ("push %%ebp ; push %%e
 __syscall_return(type,__res); \
 }
 
-#ifdef __KERNEL__
-
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
Signature · 1 line
dwmw2
#7 lore raw
In reply to David Woodhouse
Quoted 9 lines · David Woodhouse

Basically all but PowerPC and i386 have problems; and the latter works only if you apply the patches I sent to Linus a few days ago.

This is just a basic check that the headers which _are_ exported don't try to include other headers which aren't. This can happen either because the former should not, or the latter _should_ be exported. Mostly, however, the solution is just to make sure the latter is included only within #ifdef __KERNEL__, because it's only needed within that ifdef anyway.

As of today, a number of other architectures are fixed and we're left with a few stragglers whose headers may not be clean in the linux-kernel-headers tarball I intend to make based on the 2.6.18 release.

These have been fixed in patches which the architecture maintainer has already sent to Linus:

asm-mips/posix_types.h requires asm/sgidefs.h, which does not exist in exported headers asm-mips/ptrace.h requires asm/isadep.h, which does not exist in exported headers asm-mips/sigcontext.h requires asm/sgidefs.h, which does not exist in exported headers asm-mips/statfs.h requires asm/sgidefs.h, which does not exist in exported headers asm-mips/stat.h requires asm/sgidefs.h, which does not exist in exported headers asm-mips/unistd.h requires asm/sgidefs.h, which does not exist in exported headers asm-mips/user.h requires asm/reg.h, which does not exist in exported headers

asm-parisc/page.h requires asm-generic/memory_model.h, which does not exist in exported headers

asm-frv/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-frv/ptrace.h requires asm/registers.h, which does not exist in exported headers asm-frv/sigcontext.h requires asm/registers.h, which does not exist in exported headers asm-frv/termios.h requires asm-generic/termios.h, which does not exist in exported headers asm-frv/user.h requires asm/registers.h, which does not exist in exported headers

These have patches which have been sent to the arch maintainer but which I believe have not yet been forwarded to Linus:

asm-arm/elf.h requires asm/procinfo.h, which does not exist in exported headers asm-arm/page.h requires asm-generic/page.h, which does not exist in exported headers

And these remain broken with no word from the maintainer. I've directly Cc'd some arch maintainers this time in case they're not subscribed to linux-arch:

asm-arm26/elf.h requires asm/procinfo.h, which does not exist in exported headers asm-arm26/page.h requires asm-generic/page.h, which does not exist in exported headers asm-cris/byteorder.h requires asm/arch/byteorder.h, which does not exist in exported headers asm-cris/elf.h requires asm/arch/elf.h, which does not exist in exported headers asm-cris/page.h requires asm/arch/page.h, which does not exist in exported headers asm-cris/posix_types.h requires asm/bitops.h, which does not exist in exported headers asm-cris/ptrace.h requires asm/arch/ptrace.h, which does not exist in exported headers asm-cris/termios.h requires asm/rs485.h, which does not exist in exported headers asm-cris/unistd.h requires asm/arch/unistd.h, which does not exist in exported headers asm-cris/user.h requires asm/arch/user.h, which does not exist in exported headers asm-h8300/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-m32r/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-m32r/ptrace.h requires asm/m32r.h, which does not exist in exported headers asm-m32r/signal.h requires linux/linkage.h, which does not exist in exported headers asm-m32r/unistd.h requires asm/syscall.h, which does not exist in exported headers asm-m32r/user.h requires asm/processor.h, which does not exist in exported headers asm-m68k/page.h requires asm-generic/page.h, which does not exist in exported headers asm-m68knommu/page.h requires asm-generic/page.h, which does not exist in exported headers asm-sh/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-sh/ptrace.h requires asm/ubc.h, which does not exist in exported headers asm-sh64/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-sh64/shmparam.h requires asm/cache.h, which does not exist in exported headers asm-sh64/signal.h requires asm/processor.h, which does not exist in exported headers asm-sh64/user.h requires asm/processor.h, which does not exist in exported headers asm-sparc/auxio.h requires asm/system.h, which does not exist in exported headers asm-sparc/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-sparc/pbm.h requires asm/oplib.h, which does not exist in exported headers asm-sparc/pgtsun4.h requires asm/contregs.h, which does not exist in exported headers asm-sparc/turbosparc.h requires asm/pgtsrmmu.h, which does not exist in exported headers asm-sparc64/floppy.h requires linux/init.h, which does not exist in exported headers asm-sparc64/kdebug.h requires linux/notifier.h, which does not exist in exported headers asm-sparc64/mostek.h requires asm/idprom.h, which does not exist in exported headers asm-sparc64/page.h requires asm/const.h, which does not exist in exported headers asm-sparc64/parport.h requires asm/ebus.h, which does not exist in exported headers asm-sparc64/pstate.h requires asm/const.h, which does not exist in exported headers asm-sparc64/shmparam.h requires asm/spitfire.h, which does not exist in exported headers asm-um/page.h requires asm/vm-flags.h, which does not exist in exported headers asm-um/unistd.h requires linux/syscalls.h, which does not exist in exported headers asm-v850/page.h requires asm/machdep.h, which does not exist in exported headers asm-v850/param.h requires asm/machdep.h, which does not exist in exported headers asm-xtensa/byteorder.h requires asm/processor.h, which does not exist in exported headers asm-xtensa/elf.h requires asm/coprocessor.h, which does not exist in exported headers asm-xtensa/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-xtensa/shmparam.h requires asm/processor.h, which does not exist in exported headers asm-xtensa/sigcontext.h requires asm/processor.h, which does not exist in exported headers

It may be that UM and ARM26 don't need to be exporting headers, because they can use headers from the host architecture and from ARM32, respectively. If that's the case, we should just remove the Kbuild files from those architectures' include directories.

Signature · 1 line
dwmw2
#8 lore raw
Quoted 2 lines · David Woodhouse

asm-sh/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-sh/ptrace.h requires asm/ubc.h, which does not exist in exported headers

Ok, these are fixed, patch attached.

Quoted 1 line

asm-sh64/page.h requires asm-generic/memory_model.h, which does not exist in exported headers

Fixed.

Quoted 1 line

asm-sh64/shmparam.h requires asm/cache.h, which does not exist in exported headers

This is going to need a little bit more work, but I've just bumped the mask up for now. I just took care of the same issue on sh, so I'll carry over the same fix for that later. SHMLBA at 0x4000 is "good enough" for these caches for the time being, and fixes this issue.

Quoted 2 lines

asm-sh64/signal.h requires asm/processor.h, which does not exist in exported headers asm-sh64/user.h requires asm/processor.h, which does not exist in exported headers

Dead headers, fixed.

Patches follow..

arch/sh/kernel/process.c +1 -0
index 22dc9c2..f203131 100644
@@ -26,6 +26,7 @@ #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/elf.h>
+#include <asm/ubc.h>
 
 static int hlt_counter=0;
 
include/asm-sh/page.h +1 -2
index 5a057b0..6f7eb8a 100644
@@ -112,9 +112,8 @@ #define virt_addr_valid(kaddr)	pfn_valid
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-#endif /* __KERNEL__ */
-
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PAGE_H */
include/asm-sh/ptrace.h +0 -2
index 792fc35..ed358a3 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_SH_PTRACE_H
 #define __ASM_SH_PTRACE_H
 
-#include <asm/ubc.h>
-
 /*
  * Copyright (C) 1999, 2000  Niibe Yutaka
  *
include/asm-sh64/page.h +1 -2
index 34fb347..472089a 100644
@@ -112,9 +112,8 @@ #define virt_addr_valid(kaddr)	pfn_valid
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-#endif /* __KERNEL__ */
-
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#endif /* __KERNEL__ */
 #endif /* __ASM_SH64_PAGE_H */
include/asm-sh64/shmparam.h +4 -12
index d3a99a4..1bb820c 100644
@@ -2,19 +2,11 @@ #ifndef __ASM_SH64_SHMPARAM_H
 #define __ASM_SH64_SHMPARAM_H
 
 /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * include/asm-sh64/shmparam.h
- *
- * Copyright (C) 2000, 2001  Paolo Alberelli
- *
+ * Set this to a sensible safe default, we'll work out the specifics for the
+ * align mask from the cache descriptor at run-time.
  */
+#define	SHMLBA	0x4000
 
-#include <asm/cache.h>
-
-/* attach addr a multiple of this */
-#define	SHMLBA	(cpu_data->dcache.sets * L1_CACHE_BYTES)
+#define __ARCH_FORCE_SHMLBA
 
 #endif /* __ASM_SH64_SHMPARAM_H */
include/asm-sh64/signal.h +0 -1
index a5a2820..244e134 100644
@@ -13,7 +13,6 @@ #define __ASM_SH64_SIGNAL_H
  */
 
 #include <linux/types.h>
-#include <asm/processor.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
include/asm-sh64/user.h +0 -1
index 8f32f39..eb3b33e 100644
@@ -13,7 +13,6 @@ #define __ASM_SH64_USER_H
  */
 
 #include <linux/types.h>
-#include <asm/processor.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
 
#9 lore raw
Quoted 4 lines · Paul Mundt

This is going to need a little bit more work, but I've just bumped the mask up for now. I just took care of the same issue on sh, so I'll carry over the same fix for that later. SHMLBA at 0x4000 is "good enough" for these caches for the time being, and fixes this issue.

According to
http://git.kernel.org/git/?p=linux/kernel/git/dwmw2/kernel-headers.git;a=blob;h=2ff7b41d3f154ef8c44fce542929a6ac02bd6c67;hb=2c461ab5bc8d3334d4dc97412c974bf09412fccd;f=asm-sh/shmparam.h
you don't define SHMLBA in the exported headers at all for SH[34] -- the equivalent would be just putting #ifdef __KERNEL__ around what you currently have in include/asm-sh64/shmparam.h (before your patch).

That's probably not such an unreasonable response. If you're going to make it depend on the CPU cache, then libc is going to have to either work it out for itself or query the kernel somehow. Or just use the maximum of all possible values.

I'm not averse to removing <asm/shmparam.h> from view on _all_ architectures. The less we have to export, the better :)

A bunch of architectures define it as PAGE_SIZE anyway, which is broken when PAGE_SIZE gets killed off -- which we're doing either because it's dynamic on the arch in question or just because we're killing it on a bunch of architectures so we should kill it on all for consistency. Userspace needs to learn to use getpagesize() or sysconf(_SC_PAGE_SIZE).

Hm, is there a sysconf(_SC_SHMLBA) ?

Signature · 1 line
dwmw2
#10 lore raw
Quoted 6 lines · David Woodhouse
Quoted 4 lines · Paul Mundt

This is going to need a little bit more work, but I've just bumped the mask up for now. I just took care of the same issue on sh, so I'll carry over the same fix for that later. SHMLBA at 0x4000 is "good enough" for these caches for the time being, and fixes this issue.

Quoted 6 lines

According to
http://git.kernel.org/git/?p=linux/kernel/git/dwmw2/kernel-headers.git;a=blob;h=2ff7b41d3f154ef8c44fce542929a6ac02bd6c67;hb=2c461ab5bc8d3334d4dc97412c974bf09412fccd;f=asm-sh/shmparam.h
you don't define SHMLBA in the exported headers at all for SH[34] -- the equivalent would be just putting #ifdef __KERNEL__ around what you currently have in include/asm-sh64/shmparam.h (before your patch).

Yes, I've changed that for sh, it was broken.

Quoted 5 lines

That's probably not such an unreasonable response. If you're going to make it depend on the CPU cache, then libc is going to have to either work it out for itself or query the kernel somehow. Or just use the maximum of all possible values.

I opted for the latter. The problem was that we can have varying configurations where the aliases need to be handled differently (or not at all), and rather than having shmparam.h turn in to ifdef hell, I opted for run-time probing and setting up an shm_align_mask (as MIPS also does), and then wrapping arch_get_unmapped_area() around it.

Quoted 2 lines

Userspace needs to learn to use getpagesize() or sysconf(_SC_PAGE_SIZE).

uClibc does that now, so it's not an issue there. As an alternative solution, I was playing with handing the cache desc through the ELF auxvt and doing similar run-time setup for the mask there, since most architectures with an aliasing dcache will have special hacks anyways.

It seems cleaner to simply use the "big enough to covering aliasing constraints if they exist" case and let get_arch_unmapped_area() pack it a bit tighter based off of run-time discovery in the cases where we really care about it.

#11 lore raw
In reply to David Woodhouse
Quoted 6 lines · David Woodhouse

A bunch of architectures define it as PAGE_SIZE anyway, which is broken when PAGE_SIZE gets killed off -- which we're doing either because it's dynamic on the arch in question or just because we're killing it on a bunch of architectures so we should kill it on all for consistency. Userspace needs to learn to use getpagesize() or sysconf(_SC_PAGE_SIZE).

The other thing I forgot to mention is that PAGE_SIZE is really the wrong thing here anyways. On the systems with an aliasing dcache, it's the 4k pages that are generally the problem. On those platforms you can still switch to larger page sizes and then not have to worry about it.

So something like:

Quoted 1 line

Hm, is there a sysconf(_SC_SHMLBA) ?

would be much more useful. This would stop userspace libc's from doing things like #define SHMLBA (getpagesize() * 4)..

In the 4k PAGE_SIZE case you still need the dcache specifics to figure out whether to bump up SHMLBA or not. So you either go with the safe route of using a "big enough" size that covers the worst-case aliasing scenario, or find a way to do it at run-time (ie, via the auxvt or _SC_SHMLBA).

#12 lore raw
In reply to David Woodhouse
Quoted 5 lines · David Woodhouse

As of today, a number of other architectures are fixed and we're left with a few stragglers whose headers may not be clean in the linux-kernel-headers tarball I intend to make based on the 2.6.18 release.

One minor nit, can we get unifdef shoved in to scripts/? Gentoo at least didn't have it, and while Fedora and Debian both seem to, I suspect most of the other distributions will not. It took at least a couple of minutes to hunt down sensible source for it. It wouldn't be a bad idea to include it until other distributions have a chance to integrate it..

#13 lore raw
Quoted 5 lines · Paul Mundt

One minor nit, can we get unifdef shoved in to scripts/? Gentoo at least didn't have it, and while Fedora and Debian both seem to, I suspect most of the other distributions will not. It took at least a couple of minutes to hunt down sensible source for it. It wouldn't be a bad idea to include it until other distributions have a chance to integrate it..

git-pull git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

Signature · 1 line
dwmw2
#14 lore raw
In reply to David Woodhouse
Quoted 2 lines · David Woodhouse

asm-sparc64/shmparam.h requires asm/spitfire.h, which does not exist in exported headers asm-xtensa/shmparam.h requires asm/processor.h, which does not exist in exported headers

For what it's worth, I suspect these two will have to do something similar, as the dcache way size specifics won't be visible to userspace under conventional means. This leaves the auxvt (alpha sets precedent for this), or setting a value big enough to handle the aliasing constraints.

#15 lore raw
In reply to David Woodhouse

From: David Woodhouse <[email protected]>
Subject: Re: All arch maintainers: 'make headers_check' fails on most architectures.
Date: Sun, 17 Sep 2006 08:39:39 +0100

Quoted 5 lines

asm-m32r/page.h requires asm-generic/memory_model.h, which does not exist in exported headers asm-m32r/ptrace.h requires asm/m32r.h, which does not exist in exported headers asm-m32r/signal.h requires linux/linkage.h, which does not exist in exported headers asm-m32r/unistd.h requires asm/syscall.h, which does not exist in exported headers asm-m32r/user.h requires asm/processor.h, which does not exist in exported headers

OK, I've checked.
Here is a patch to fix them.

Thanks,

[PATCH] Fix 'make headers_check' on m32r

---
 include/asm-m32r/page.h   |    3 +--
 include/asm-m32r/ptrace.h |    4 ++--
 include/asm-m32r/signal.h |    1 -
 include/asm-m32r/unistd.h |    4 ++--
 include/asm-m32r/user.h   |    1 -
 5 files changed, 5 insertions(+), 8 deletions(-)
include/asm-m32r/page.h +1 -2
index 9688be0..404a4c2 100644
@@ -87,10 +87,9 @@ #define VM_DATA_DEFAULT_FLAGS	(VM_READ |
 
 #define devmem_is_allowed(x) 1
 
-#endif /* __KERNEL__ */
-
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#endif /* __KERNEL__ */
 #endif /* _ASM_M32R_PAGE_H */
 
include/asm-m32r/ptrace.h +2 -2
index a07fa90..2d2a6c9 100644
@@ -12,8 +12,6 @@ #define _ASM_M32R_PTRACE_H
  *   Copyright (C) 2001-2002, 2004  Hirokazu Takata <takata at linux-m32r.org>
  */
 
-#include <asm/m32r.h>		/* M32R_PSW_BSM, M32R_PSW_BPM */
-
 /* 0 - 13 are integer registers (general purpose registers).  */
 #define PT_R4		0
 #define PT_R5		1
@@ -140,6 +138,8 @@ #define PTRACE_O_TRACESYSGOOD	0x00000001
 
 #ifdef __KERNEL__
 
+#include <asm/m32r.h>		/* M32R_PSW_BSM, M32R_PSW_BPM */
+
 #define __ARCH_SYS_PTRACE	1
 
 #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
include/asm-m32r/signal.h +0 -1
index e750045..65423be 100644
@@ -6,7 +6,6 @@ #define _ASM_M32R_SIGNAL_H
 /* orig : i386 2.4.18 */
 
 #include <linux/types.h>
-#include <linux/linkage.h>
 #include <linux/time.h>
 #include <linux/compiler.h>
 
include/asm-m32r/unistd.h +2 -2
index cc31790..89f376e 100644
@@ -3,8 +3,6 @@ #define _ASM_M32R_UNISTD_H
 
 /* $Id$ */
 
-#include <asm/syscall.h>	/* SYSCALL_* */
-
 /*
  * This file contains the system call numbers.
  */
@@ -303,6 +301,8 @@ #define NR_syscalls 285
  * <asm-m32r/errno.h>
  */
 
+#include <asm/syscall.h>	/* SYSCALL_* */
+
 #define __syscall_return(type, res) \
 do { \
 	if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \
include/asm-m32r/user.h +0 -1
index 2ffd0c6..1ad4ded 100644
@@ -8,7 +8,6 @@ #define _ASM_M32R_USER_H
  */
 
 #include <linux/types.h>
-#include <asm/processor.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
 
Signature · 2 lines
Hirokazu Takata <[email protected]>
Linux/M32R Project:  http://www.linux-m32r.org/
#17 lore raw
In reply to David Woodhouse
Quoted 2 lines · David Woodhouse

It may be that UM and ARM26 don't need to be exporting headers, because they can use headers from the host architecture

Yup.

Quoted 2 lines

If that's the case, we should just remove the Kbuild files from those architectures' include directories.

Is it OK that this happens when I do that:

	/home/jdike/linux/2.6/linux-2.6.17/scripts/Makefile.headersinst:42: /home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild: No such file or directory
	make[3]: *** No rule to make target `/home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild'.  Stop.

				Jeff
#18 lore raw
Quoted 5 lines · Jeff Dike

Is it OK that this happens when I do that:

/home/jdike/linux/2.6/linux-2.6.17/scripts/Makefile.headersinst:42: /home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild: No such file or directory make[3]: *** No rule to make target
`/home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild'. Stop.

Er, yes. I don't think it makes any sense to export headers specifically for UM. I wonder why my shadow git tree has them...

Signature · 1 line
dwmw2
#19 lore raw
Quoted 9 lines · David Woodhouse
Quoted 5 lines · Jeff Dike

Is it OK that this happens when I do that:

/home/jdike/linux/2.6/linux-2.6.17/scripts/Makefile.headersinst:42: /home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild: No such file or directory make[3]: *** No rule to make target
`/home/jdike/linux/2.6/linux-2.6.17/include/asm-um/Kbuild'. Stop.

Er, yes. I don't think it makes any sense to export headers specifically for UM. I wonder why my shadow git tree has them...

Well, my question was, is it OK for make to explode when headers_check is done for UML, or should it do nothing silently?

Jeff

#20 lore raw
Quoted 6 lines · Jeff Dike
Quoted 3 lines

Er, yes. I don't think it makes any sense to export headers specifically for UM. I wonder why my shadow git tree has them...

Well, my question was, is it OK for make to explode when headers_check is done for UML, or should it do nothing silently?

headers_check should check whatever files are installed by headers_install. I think the most sensible two choices there are:

1. install the headers for the actual underlying architecture (SUBARCH) instead of the um headers.

2. if ARCH=um, don't provide headers_install or headers_check targets.

	Arnd <><
#21 lore raw
Quoted 5 lines · Arnd Bergmann

headers_check should check whatever files are installed by headers_install. I think the most sensible two choices there are:

1. install the headers for the actual underlying architecture (SUBARCH) instead of the um headers.

I don't think UML should be installing i386 headers.

Quoted 1 line

2. if ARCH=um, don't provide headers_install or headers_check targets.

Those are provided by the toplevel Makefile, so this would involve wrapping an ifneq($ARCH, "um") around them, which doesn't seem too palatable.

Jeff

#22 lore raw
In reply to David Woodhouse
Quoted 7 lines · David Woodhouse

This is just a basic check that the headers which _are_ exported don't try to include other headers which aren't. This can happen either because the former should not, or the latter _should_ be exported. Mostly, however, the solution is just to make sure the latter is included only within #ifdef __KERNEL__, because it's only needed within that ifdef anyway.

Quoted 5 lines

Admittedly, much of the time this is only seen in files like asm/page.h or asm/elf.h which we really don't expect anyone in userspace to be using anyway -- but it would be good to fix them anyway.

asm-m68k/page.h requires asm-generic/page.h, which does not exist

Like this?

include/asm-m68k/page.h renamed from include/asm-m68k/page.h.orig +4 -4
@@ -2,6 +2,8 @@
 #define _M68K_PAGE_H
 
 
+#ifdef __KERNEL__
+
 /* PAGE_SHIFT determines the page size */
 #ifndef CONFIG_SUN3
 #define PAGE_SHIFT	(12)
@@ -15,8 +17,6 @@
 #endif
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 
-#ifdef __KERNEL__
-
 #include <asm/setup.h>
 
 #if PAGE_SHIFT < 13
@@ -175,8 +175,8 @@ static inline void *__va(unsigned long x
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
-#endif /* __KERNEL__ */
-
 #include <asm-generic/page.h>
 
+#endif /* __KERNEL__ */
+
 #endif /* _M68K_PAGE_H */

BTW, what about adding headers_check to `make help'?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#23 lore raw
Quoted 3 lines · Geert Uytterhoeven
Quoted 1 line

asm-m68k/page.h requires asm-generic/page.h, which does not exist

Like this?

Looks sane to me, yes. Thanks. Care to add a Signed-off-by and send it to Linus?

Quoted 1 line

BTW, what about adding headers_check to `make help'?

Yeah, good idea.

----
[PATCH] Add headers_check' target to output of 'make help'

Makefile +1 -0
index eab5a8c..7646fc9 100644
@@ -1082,6 +1082,7 @@ help:
 	@echo  'Static analysers'
 	@echo  '  checkstack      - Generate a list of stack hogs'
 	@echo  '  namespacecheck  - Name space analysis on compiled kernel'
+	@echo  '  headers_check   - Sanity check on exported headers'
 	@echo  ''
 	@echo  'Kernel packaging:'
 	@$(MAKE) $(build)=$(package-dir) help
Signature · 1 line
dwmw2
maintainer
#24 lore raw

PATCH 1/8 extend make headers_check to detect more problems

In reply to David Woodhouse

In addition to the problem of including non-existant header files, a number of other things can go wrong with header files exported to user space. This adds checks for some common problems:

- The header fails to include the files it needs, which results in build errors when a program tries to include it. Check this by doing a dummy compile.

- There is a declarations of a static variable or non-inline function in the header, which results in object code in every file including it. Check for symbols in the object with 'nm'.

- Part of the header is subject to conditional compilation based on CONFIG_*. Add a regex search for this.

I found many problems with this, which I then fixed for powerpc, s390 and i386, in subsequent patches.

scripts/hdrcheck.sh +20 -0
Index: linux-cg/scripts/hdrcheck.sh
===================================================================
@@ -1,8 +1,28 @@
 #!/bin/sh
 
+# check if all included files exist
 for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
     if [ ! -r $1/$FILE ]; then
 	echo $2 requires $FILE, which does not exist in exported headers
 	exit 1
     fi
 done
+
+# try to compile in order to see CC warnings, show only the first few
+CHECK_CFLAGS=`grep @headercheck: $2 | sed -e 's/^.*@headercheck:\([^@]*\)@.*$/\1/'`
+CFLAGS="-Wall -std=gnu99 -xc -O2 -I$1 ${CHECK_CFLAGS}"
+tmpfile=`mktemp`
+${CC:-gcc} ${CFLAGS} -c $2 -o $tmpfile 2>&1 | sed -e "s:$1:include:g" >&2
+
+# check if object file is empty
+if [ "`nm $tmpfile`" ] ; then
+    echo include${2#$1}: warning: non-empty output >&2
+fi
+rm $tmpfile
+
+# check if we use a CONFIG_ symbol, which is not allowed in installed headers
+grep '^[ \t]*#[ \t]*if.*\<CONFIG_[[:alnum:]_]*\>' -n $2 |
+while read i ; do
+    echo include${2#$1}:${i%%:*}: warning: invalid use of `echo $i |
+	sed -e 's/.*\(\<CONFIG_[[:alnum:]_]*\>\).*/\1/g'` >&2
+done

--

#25 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

Quoted 5 lines
scripts/hdrcheck.sh +0 -0
@@ -1,8 +1,28 @@
 #!/bin/sh
 

scripts/hdrcheck.sh line 12

Quoted 10 lines
scripts/hdrcheck.sh +4 -0
+# check if all included files exist
 for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
     if [ ! -r $1/$FILE ]; then
 	echo $2 requires $FILE, which does not exist in exported headers
 	exit 1
     fi
 done
+
+# try to compile in order to see CC warnings, show only the first few
+CHECK_CFLAGS=`grep @headercheck: $2 | sed -e 's/^.*@headercheck:\([^@]*\)@.*$/\1/'`

The purpose of @headercheck: should be documented sonewhere. A simple way to do so would be to paste the content of the changelog that describe it in the top of this file.

scripts/hdrcheck.sh line 14

Quoted 2 lines
scripts/hdrcheck.sh +2 -0
+CFLAGS="-Wall -std=gnu99 -xc -O2 -I$1 ${CHECK_CFLAGS}"
+tmpfile=`mktemp`

Can't we do this with a hdrchk$$$ filename to avoid using random entropy for each compile?

scripts/hdrcheck.sh line 18

Quoted 4 lines
scripts/hdrcheck.sh +4 -0
+${CC:-gcc} ${CFLAGS} -c $2 -o $tmpfile 2>&1 | sed -e "s:$1:include:g" >&2
+
+# check if object file is empty
+if [ "`nm $tmpfile`" ] ; then

Replace nm with {NM:-nm} to obtain correct NM when cross compiling.

scripts/hdrcheck.sh line 19

Quoted 1 line
scripts/hdrcheck.sh +1 -0
+    echo include${2#$1}: warning: non-empty output >&2

Paste output of nm so one can see what is defined?

Sam

#26 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

Quoted 2 lines · Sam Ravnborg

Can't we do this with a hdrchk$$$ filename to avoid using random entropy for each compile?

I'd like to move to a scheme where we do headers_install and headers_check _without_ starting with a rm -rf $(HDR_INSTALL_PATH)/include.

We could probably do it by adding a rule along the lines of $(filter-out $(unifdef-y) $(header-y),$(wildcard $(INSTALL_HDR_PATH)/$(dst)/*.h):

	rm $@

... i.e. remove every .h file from the destination directory except the ones we just created.

Then we can make $(INSTALL_HDR_PATH)/$(dst)/%.h depend on $(srctree)/$(src)/%.h so that it doesn't get re-exported unless it's changed. And we can keep a stamp file around (or the output of the test compilation after Arnd's patch) which shows that the _check_ step has been done too. Something like .checked.%.h

After we do that, a second invocation of 'make headers_check' should have nothing to do, which will encourage people to keep using it.

Signature · 1 line
dwmw2
#27 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

Quoted 19 lines · David Woodhouse

I'd like to move to a scheme where we do headers_install and headers_check _without_ starting with a rm -rf $(HDR_INSTALL_PATH)/include.

We could probably do it by adding a rule along the lines of $(filter-out $(unifdef-y) $(header-y),$(wildcard $(INSTALL_HDR_PATH)/$(dst)/*.h):

        rm $@

... i.e. remove every .h file from the destination directory except the
ones we just created.

Then we can make $(INSTALL_HDR_PATH)/$(dst)/%.h depend on $(srctree)/$(src)/%.h so that it doesn't get re-exported unless it's changed. And we can keep a stamp file around (or the output of the test
compilation after Arnd's patch) which shows that the _check_ step has been done too. Something like .checked.%.h

Quoted 2 lines

After we do that, a second invocation of 'make headers_check' should have nothing to do, which will encourage people to keep using it.

How does this look? Need to sort out dependencies for the .check.$FOO.h files, but it does 'headers_install' relatively sanely with dependencies, and also implements 'headers_install_all' with which we can make a release tarball of linux-kernel-headers.

Oh, and I buggered the autogenerated files for biarch, but I'll fix that later this evening.

Makefile +11 -3
index 33074e8..fa72626 100644
@@ -892,18 +892,26 @@ # Kernel headers
 INSTALL_HDR_PATH=$(objtree)/usr
 export INSTALL_HDR_PATH
 
+HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
+
+PHONY += headers_install_all
+headers_install_all: include/linux/version.h
+	$(Q)unifdef -Ux /dev/null
+	$(Q)for arch in $(HDRARCHES); do \
+	 $(MAKE) ARCH=$$arch -rR -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch __headersinst ;\
+	 done
+
 PHONY += headers_install
 headers_install: include/linux/version.h
 	@if [ ! -r include/asm-$(ARCH)/Kbuild ]; then \
 	  echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \
 	  exit 1 ; fi
 	$(Q)unifdef -Ux /dev/null
-	$(Q)rm -rf $(INSTALL_HDR_PATH)/include
-	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include
+	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include __headersinst
 
 PHONY += headers_check
 headers_check: headers_install
-	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1
+	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include __headerscheck
 
 # ---------------------------------------------------------------------------
 # Modules
arch/powerpc/kernel/ptrace.c +0 -0
include/Kbuild +0 -0
include/asm-i386/Kbuild +0 -0
include/asm-powerpc/auxvec.h +0 -0
include/asm-powerpc/signal.h +0 -0
scripts/Makefile.headersinst +68 -43

190 lines not on this page · raw message

Signature · 1 line
dwmw2
maintainer
#28 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg
Quoted 5 lines
scripts/hdrcheck.sh +0 -0
@@ -1,8 +1,28 @@
 #!/bin/sh
 
Quoted 14 lines

scripts/hdrcheck.sh line 12

Quoted 10 lines
scripts/hdrcheck.sh +4 -0
+# check if all included files exist
 for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
     if [ ! -r $1/$FILE ]; then
 	echo $2 requires $FILE, which does not exist in exported headers
 	exit 1
     fi
 done
+
+# try to compile in order to see CC warnings, show only the first few
+CHECK_CFLAGS=`grep @headercheck: $2 | sed -e 's/^.*@headercheck:\([^@]*\)@.*$/\1/'`

The purpose of @headercheck: should be documented sonewhere. A simple way to do so would be to paste the content of the changelog that describe it in the top of this file.

ok. I've ended up writing more than that now, since the headers_install target also wasn't documented well.

Quoted 4 lines

scripts/hdrcheck.sh line 14

Quoted 2 lines
scripts/hdrcheck.sh +2 -0
+CFLAGS="-Wall -std=gnu99 -xc -O2 -I$1 ${CHECK_CFLAGS}"
+tmpfile=`mktemp`

Can't we do this with a hdrchk$$$ filename to avoid using random entropy for each compile?

For now, I've hacked something up in the script below. I suppose that can be improved with Dave's proposal by doing it from the Makefile.

Quoted 9 lines

scripts/hdrcheck.sh line 18

Quoted 4 lines
scripts/hdrcheck.sh +4 -0
+${CC:-gcc} ${CFLAGS} -c $2 -o $tmpfile 2>&1 | sed -e "s:$1:include:g" >&2
+
+# check if object file is empty
+if [ "`nm $tmpfile`" ] ; then

Replace nm with {NM:-nm} to obtain correct NM when cross compiling.

scripts/hdrcheck.sh line 19

Quoted 1 line
scripts/hdrcheck.sh +1 -0
+    echo include${2#$1}: warning: non-empty output >&2

Paste output of nm so one can see what is defined?

ok

	Arnd <><

---
In addition to the problem of including non-existant header files, a number of other things can go wrong with header files exported to user space. This adds checks for some common problems:

- The header fails to include the files it needs, which results in build errors when a program tries to include it. Check this by doing a dummy compile.

- There is a declarations of a static variable or non-inline function in the header, which results in object code in every file including it. Check for symbols in the object with 'nm'.

- Part of the header is subject to conditional compilation based on CONFIG_*. Add a regex search for this.

I found many problems with this, which I then fixed for powerpc, s390 and i386, in subsequent patches.

---

scripts/hdrcheck.sh +20 -0
Index: linux-cg/scripts/hdrcheck.sh
===================================================================
@@ -1,8 +1,28 @@
 #!/bin/sh
 
+# check if all included files exist
 for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
     if [ ! -r $1/$FILE ]; then
 	echo $2 requires $FILE, which does not exist in exported headers
 	exit 1
     fi
 done
+
+# try to compile in order to see CC warnings, show only the first few
+CHECK_CFLAGS=`grep @headercheck: $2 | sed -e 's/^.*@headercheck:\([^@]*\)@.*$/\1/'`
+CFLAGS="-Wall -std=gnu99 -xc -O2 -I$1 ${CHECK_CFLAGS}"
+mkdir -p ${3%/*}
+${CC:-gcc} ${CFLAGS} -c $2 -o $3 2>&1 | sed -e "s:$1:include:g" >&2
+
+# check if object file is empty
+if [ "`${NM:-nm} $3`" ] ; then
+    echo include${2#$1}: warning: non-empty output >&2
+    ${NM:-nm} $3 >&2
+fi
+
+# check if we use a CONFIG_ symbol, which is not allowed in installed headers
+grep '^[ \t]*#[ \t]*if.*\<CONFIG_[[:alnum:]_]*\>' -n $2 |
+while read i ; do
+    echo include${2#$1}:${i%%:*}: warning: invalid use of `echo $i |
+	sed -e 's/.*\(\<CONFIG_[[:alnum:]_]*\>\).*/\1/g'` >&2
+done
Documentation/headers.txt new file +96 -0

96 lines not on this page · raw message

#29 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

Documentation/headers.txt line 37

Quoted 10 lines · Arnd Bergmann
Documentation/headers.txt new file +9 -0
+headers-y    Files that are installed verbatim from the source
+            directory, as well subdirectories that also contain
+            installable header files.
+objhdr-y     Files that are installed from the object directory,
+            having been generated during the kernel build.
+unifdef-y    Files that have both parts for installations and
+            parts that are private to the kernel. These files
+            are run through the 'unifdef'(1) program that will
+            strip all parts inside of '#ifdef __KERNEL__'.

objhdr-y Files that are generated automatically during the
build process (i.e. include/linux/version.h) and are installed verbatim from the build directory.

Looks good, thanks for doing the documentation.

Signature · 1 line
dwmw2
#30 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

plain text document attachment (headercheck-base.diff) In addition to the problem of including non-existant header files, a number of other things can go wrong with header files exported to user space. This adds checks for some common problems:

- The header fails to include the files it needs, which results in build errors when a program tries to include it. Check this by doing a dummy compile.

Quoted 7 lines

- There is a declarations of a static variable or non-inline function in the header, which results in object code in every file including it. Check for symbols in the object with 'nm'.

- Part of the header is subject to conditional compilation based on CONFIG_*. Add a regex search for this.

It would be good to fix these problems, it's true -- but bear in mind that none of these are actually fatal problems -- they're just caveats of (ab)using kernel-private headers in userspace.

On the other hand, it would be good to get people used to running 'make headers_check' whenever they make a change -- so introducing more breakage right now may be counterproductive from that point of view.

So I think I'd prefer to leave this for now, or at least limit it to 'make CHECKMEHARDER=1 headers_check' so that we can wean people onto using headers_check slowly and relatively painlessly.

Quoted 2 lines

I found many problems with this, which I then fixed for powerpc, s390 and i386, in subsequent patches.

Can you -include <linux/types.h> _every_ time, to reduce the number of places you have to add '/* @headercheck: -include linux/types.h @ */' ?

Signature · 1 line
dwmw2
maintainer
#31 lore raw

Re: [patch 1/8] extend make headers_check to detect more problems

Quoted 11 lines · David Woodhouse

It would be good to fix these problems, it's true -- but bear in mind that none of these are actually fatal problems -- they're just caveats of (ab)using kernel-private headers in userspace.

On the other hand, it would be good to get people used to running 'make headers_check' whenever they make a change -- so introducing more breakage right now may be counterproductive from that point of view.

So I think I'd prefer to leave this for now, or at least limit it to 'make CHECKMEHARDER=1 headers_check' so that we can wean people onto using headers_check slowly and relatively painlessly.

yes, that sounds fair.

Quoted 5 lines
Quoted 2 lines

I found many problems with this, which I then fixed for powerpc, s390 and i386, in subsequent patches.

Can you -include <linux/types.h> _every_ time, to reduce the number of places you have to add '/* @headercheck: -include linux/types.h @ */' ?

The problem with this are a few files which have code like

#ifndef __KERNEL__
#include <sys/types.h>
#include <stdint.h>
#endif

or similar. These break heavily if you include <linux/types.h> before the the glibc provided headers, because linux/types.h provides some of the types that are normally defined elsewhere and duplicate typedefs result in compile errors.

To solve this, we would need to make all headers build fine with gcc -D__STRICT_KERNEL_NAMES -include linux/types.h.
That is a valueable goal as well, since it avoids a number of problems, but it is actually a larger change than this.

Now one option we could take would be to always pass -include linux/types.h to gcc and put /* @headercheck: -D__STRICT_KERNEL_NAMES */ into the few places that break otherwise.

	Arnd <><
maintainer
#32 lore raw

PATCH 2/8 fix byteorder headers for make headers_check

In reply to David Woodhouse

This makes the header files for byteorder includeable on 32 bit systems with gcc -ansi, where no 64 bit integers are available.

include/linux/byteorder/big_endian.h +2 -0
Index: linux-cg/include/linux/byteorder/big_endian.h
===================================================================
@@ -40,6 +40,7 @@
 #define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
 #define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
 
+#ifdef __BYTEORDER_HAS_U64__
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
 	return (__force __le64)__swab64p(p);
@@ -48,6 +49,7 @@
 {
 	return __swab64p((__u64 *)p);
 }
+#endif
 static inline __le32 __cpu_to_le32p(const __u32 *p)
 {
 	return (__force __le32)__swab32p(p);
include/linux/byteorder/little_endian.h +4 -0
Index: linux-cg/include/linux/byteorder/little_endian.h
===================================================================
@@ -40,6 +40,7 @@
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
 #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
 
+#ifdef __BYTEORDER_HAS_U64__
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
 	return (__force __le64)*p;
@@ -48,6 +49,7 @@
 {
 	return (__force __u64)*p;
 }
+#endif
 static inline __le32 __cpu_to_le32p(const __u32 *p)
 {
 	return (__force __le32)*p;
@@ -64,6 +66,7 @@
 {
 	return (__force __u16)*p;
 }
+#ifdef __BYTEORDER_HAS_U64__
 static inline __be64 __cpu_to_be64p(const __u64 *p)
 {
 	return (__force __be64)__swab64p(p);
@@ -72,6 +75,7 @@
 {
 	return __swab64p((__u64 *)p);
 }
+#endif
 static inline __be32 __cpu_to_be32p(const __u32 *p)
 {
 	return (__force __be32)__swab32p(p);
include/linux/byteorder/pdp_endian.h +1 -0
Index: linux-cg/include/linux/byteorder/pdp_endian.h
===================================================================
@@ -27,6 +27,7 @@
 #define __PDP_ENDIAN_BITFIELD
 #endif
 
+#include <linux/types.h>
 #include <linux/byteorder/swab.h>
 #include <linux/byteorder/swabb.h>
 
include/linux/byteorder/swab.h +1 -0
Index: linux-cg/include/linux/byteorder/swab.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _LINUX_BYTEORDER_SWAB_H
 #define _LINUX_BYTEORDER_SWAB_H
 
+/* @headercheck:-include linux/types.h@ */
 /*
  * linux/byteorder/swab.h
  * Byte-swapping, independently from CPU endianness
include/linux/byteorder/swabb.h +1 -0
Index: linux-cg/include/linux/byteorder/swabb.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _LINUX_BYTEORDER_SWABB_H
 #define _LINUX_BYTEORDER_SWABB_H
 
+/* @headercheck:-include linux/types.h@ */
 /*
  * linux/byteorder/swabb.h
  * SWAp Bytes Bizarrely

--

maintainer
#33 lore raw

PATCH 3/8 hide kernel-only parts of some installed headers

In reply to David Woodhouse

These header files all need additional parts hidden inside if #ifdef __KERNEL__ so they become usable in user space.

The most common reason is that they refer to a CONFIG_* symbol. Since the contents of the header inside of that #ifdef were undefined to start with, these parts can usually be left out of the installed portion.

include/asm-i386/setup.h +2 -0
Index: linux-cg/include/asm-i386/setup.h
===================================================================
@@ -67,6 +67,7 @@
  */
 #define LOWMEMSIZE()	(0x9f000)
 
+#ifdef __KERNEL__
 struct e820entry;
 
 char * __init machine_specific_memory_setup(void);
@@ -75,6 +76,7 @@
 int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
 void __init add_memory_region(unsigned long long start,
 			      unsigned long long size, int type);
+#endif
 
 #endif /* __ASSEMBLY__ */
 
include/linux/coda_psdev.h +7 -7
Index: linux-cg/include/linux/coda_psdev.h
===================================================================
@@ -6,6 +6,7 @@
 
 #define CODA_SUPER_MAGIC	0x73757245
 
+#ifdef __KERNEL__
 struct kstatfs;
 
 struct coda_sb_info
@@ -72,7 +73,6 @@
 int venus_fsync(struct super_block *sb, struct CodaFid *fid);
 int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
 
-
 /* messages between coda filesystem in kernel and Venus */
 extern int coda_hard;
 extern unsigned long coda_timeout;
@@ -88,16 +88,16 @@
 	unsigned long       uc_posttime;
 };
 
-#define REQ_ASYNC  0x1
-#define REQ_READ   0x2
-#define REQ_WRITE  0x4
-#define REQ_ABORT  0x8
-
-
 /*
  * Statistics
  */
 
 extern struct venus_comm coda_comms[];
+#endif
+
+#define REQ_ASYNC  0x1
+#define REQ_READ   0x2
+#define REQ_WRITE  0x4
+#define REQ_ABORT  0x8
 
 #endif
include/linux/dm-ioctl.h +2 -0
Index: linux-cg/include/linux/dm-ioctl.h
===================================================================
@@ -231,6 +231,7 @@
 	DM_DEV_SET_GEOMETRY_CMD
 };
 
+#ifdef __KERNEL__
 /*
  * The dm_ioctl struct passed into the ioctl is just the header
  * on a larger chunk of memory.  On x86-64 and other
@@ -260,6 +261,7 @@
 #define DM_TARGET_MSG_32    _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct)
 #define DM_DEV_SET_GEOMETRY_32	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, ioctl_struct)
 #endif
+#endif
 
 #define DM_IOCTL 0xfd
 
include/linux/futex.h +2 -0
Index: linux-cg/include/linux/futex.h
===================================================================
@@ -93,6 +93,7 @@
  */
 #define ROBUST_LIST_LIMIT	2048
 
+#ifdef __KERNEL__
 long do_futex(u32 __user *uaddr, int op, u32 val, unsigned long timeout,
 	      u32 __user *uaddr2, u32 val2, u32 val3);
 
@@ -110,6 +111,7 @@
 {
 }
 #endif
+#endif
 
 #define FUTEX_OP_SET		0	/* *(int *)UADDR2 = OPARG; */
 #define FUTEX_OP_ADD		1	/* *(int *)UADDR2 += OPARG; */
include/linux/ipv6.h +4 -0
Index: linux-cg/include/linux/ipv6.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPV6_H
 #define _IPV6_H
 
+/* @headercheck: -include linux/types.h @ */
+
 #include <linux/in6.h>
 #include <asm/byteorder.h>
 
@@ -121,6 +123,7 @@
 	struct	in6_addr	daddr;
 };
 
+#ifdef __KERNEL__
 /*
  * This structure contains configuration options per IPv6 link.
  */
@@ -155,6 +158,7 @@
 #endif
 	void		*sysctl;
 };
+#endif
 
 /* index values for the variables in ipv6_devconf */
 enum {
include/linux/isdn_divertif.h +2 -0
Index: linux-cg/include/linux/isdn_divertif.h
===================================================================
@@ -24,6 +24,7 @@
 #define DIVERT_REL_ERR  0x04  /* module not registered */
 #define DIVERT_REG_NAME isdn_register_divert
 
+#ifdef __KERNEL__
 /***************************************************************/
 /* structure exchanging data between isdn hl and divert module */
 /***************************************************************/ 
@@ -40,3 +41,4 @@
 /* function register */
 /*********************/
 extern int DIVERT_REG_NAME(isdn_divert_if *);
+#endif
include/linux/ppp-comp.h +6 -5
Index: linux-cg/include/linux/ppp-comp.h
===================================================================
@@ -42,6 +42,7 @@
 #ifndef _NET_PPP_COMP_H
 #define _NET_PPP_COMP_H
 
+#ifdef __KERNEL__
 struct module;
 
 /*
@@ -115,6 +116,9 @@
 	unsigned int comp_extra;
 };
 
+extern int ppp_register_compressor(struct compressor *);
+extern void ppp_unregister_compressor(struct compressor *);
+
 /*
  * The return value from decompress routine is the length of the
  * decompressed packet if successful, otherwise DECOMP_ERROR
@@ -130,6 +134,8 @@
 #define DECOMP_ERROR		-1	/* error detected before decomp. */
 #define DECOMP_FATALERROR	-2	/* error detected after decomp. */
 
+#endif /* __KERNEL__ */
+
 /*
  * CCP codes.
  */
@@ -208,9 +214,4 @@
 #define CI_PREDICTOR_2		2	/* config option for Predictor-2 */
 #define CILEN_PREDICTOR_2	2	/* length of its config option */
 
-#ifdef __KERNEL__
-extern int ppp_register_compressor(struct compressor *);
-extern void ppp_unregister_compressor(struct compressor *);
-#endif /* __KERNEL__ */
-
 #endif /* _NET_PPP_COMP_H */
include/linux/sound.h +2 -0
Index: linux-cg/include/linux/sound.h
===================================================================
@@ -25,6 +25,7 @@
 #define SND_DEV_AMIDI		13	/* Like /dev/midi (obsolete) */
 #define SND_DEV_ADMMIDI		14	/* Like /dev/dmmidi (onsolete) */
 
+#ifdef __KERNEL__
 /*
  *	Sound core interface functions
  */
@@ -42,3 +43,4 @@
 extern void unregister_sound_midi(int unit);
 extern void unregister_sound_dsp(int unit);
 extern void unregister_sound_synth(int unit);
+#endif
include/linux/xattr.h +2 -1
Index: linux-cg/include/linux/xattr.h
===================================================================
@@ -29,7 +29,7 @@
 #define XATTR_USER_PREFIX "user."
 #define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
 
-
+#ifdef __KERNEL__
 struct xattr_handler {
 	char *prefix;
 	size_t (*list)(struct inode *inode, char *list, size_t list_size,
@@ -48,5 +48,6 @@
 ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
 int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
 int generic_removexattr(struct dentry *dentry, const char *name);
+#endif
 
 #endif	/* _LINUX_XATTR_H */
include/linux/netdevice.h +4 -4
Index: linux-cg/include/linux/netdevice.h
===================================================================
@@ -69,10 +69,6 @@
 
 #define net_xmit_errno(e)	((e) != NET_XMIT_CN ? -ENOBUFS : 0)
 
-#endif
-
-#define MAX_ADDR_LEN	32		/* Largest hardware address length */
-
 /* Driver transmit return codes */
 #define NETDEV_TX_OK 0		/* driver took care of packet */
 #define NETDEV_TX_BUSY 1	/* driver tx path was busy*/
@@ -100,6 +96,10 @@
 #define MAX_HEADER (LL_MAX_HEADER + 48)
 #endif
 
+#endif
+
+#define MAX_ADDR_LEN	32		/* Largest hardware address length */
+
 /*
  *	Network device statistics. Akin to the 2.0 ether stats but
  *	with byte counters.
include/linux/quota.h +5 -5
Index: linux-cg/include/linux/quota.h
===================================================================
@@ -41,11 +41,6 @@
 #define __DQUOT_VERSION__	"dquot_6.5.1"
 #define __DQUOT_NUM_VERSION__	6*10000+5*100+1
 
-typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef __u64 qsize_t;          /* Type in which we store sizes */
-
-extern spinlock_t dq_data_lock;
-
 /* Size of blocks in which are counted size limits */
 #define QUOTABLOCK_BITS 10
 #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
@@ -138,6 +133,11 @@
 #include <linux/dqblk_v1.h>
 #include <linux/dqblk_v2.h>
 
+typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
+typedef __u64 qsize_t;          /* Type in which we store sizes */
+
+extern spinlock_t dq_data_lock;
+
 /* Maximal numbers of writes for quota operation (insert/delete/update)
  * (over VFS all formats) */
 #define DQUOT_INIT_ALLOC max(V1_INIT_ALLOC, V2_INIT_ALLOC)
include/asm-generic/atomic.h +1 -1
Index: linux-cg/include/asm-generic/atomic.h
===================================================================
@@ -18,7 +18,7 @@
  * macros of a platform may have.
  */
 
-#if BITS_PER_LONG == 64
+#ifdef ATOMIC64_INIT /* assume this is only defined on 64 bit architectures */
 
 typedef atomic64_t atomic_long_t;
 
include/asm-i386/byteorder.h +5 -2
Index: linux-cg/include/asm-i386/byteorder.h
===================================================================
@@ -8,11 +8,14 @@
 
 /* For avoiding bswap on i386 */
 #ifdef __KERNEL__
+#ifdef CONFIG_X86_BSWAP
+#define __X86_BSWAP
+#endif
 #endif
 
 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
 {
-#ifdef CONFIG_X86_BSWAP
+#ifdef __X86_BSWAP
 	__asm__("bswap %0" : "=r" (x) : "0" (x));
 #else
 	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
@@ -31,7 +34,7 @@
 		__u64 u;
 	} v;
 	v.u = val;
-#ifdef CONFIG_X86_BSWAP
+#ifdef __X86_BSWAP
 	asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 
 	    : "=r" (v.s.a), "=r" (v.s.b) 
 	    : "0" (v.s.a), "1" (v.s.b)); 
include/asm-i386/vm86.h +5 -1
Index: linux-cg/include/asm-i386/vm86.h
===================================================================
@@ -16,11 +16,15 @@
 #define IF_MASK		0x00000200
 #define IOPL_MASK	0x00003000
 #define NT_MASK		0x00004000
+#ifdef __KERNEL__
 #ifdef CONFIG_VM86
 #define VM_MASK		0x00020000
 #else
 #define VM_MASK		0 /* ignored */
-#endif
+#endif /* CONFIG_VM86 */
+#else
+#define VM_MASK		0x00020000
+#endif /* __KERNEL__ */
 #define AC_MASK		0x00040000
 #define VIF_MASK	0x00080000	/* virtual interrupt flag */
 #define VIP_MASK	0x00100000	/* virtual interrupt pending */
include/linux/Kbuild +9 -9
Index: linux-cg/include/linux/Kbuild
===================================================================
@@ -8,10 +8,10 @@
 	atmppp.h atmsap.h atmsvc.h atm_zatm.h auto_fs4.h auxvec.h	\
 	awe_voice.h ax25.h b1lli.h baycom.h bfs_fs.h blkpg.h		\
 	bpqether.h cdk.h chio.h coda_psdev.h coff.h comstats.h		\
-	consolemap.h cycx_cfm.h dm-ioctl.h dn.h dqblk_v1.h		\
-	dqblk_v2.h dqblk_xfs.h efs_fs_sb.h elf-fdpic.h elf.h elf-em.h	\
+	consolemap.h cycx_cfm.h dn.h dqblk_v1.h				\
+	dqblk_v2.h dqblk_xfs.h efs_fs_sb.h elf.h elf-em.h		\
 	fadvise.h fd.h fdreg.h ftape-header-segment.h ftape-vendors.h	\
-	fuse.h futex.h genetlink.h gen_stats.h gigaset_dev.h hdsmart.h	\
+	fuse.h genetlink.h gen_stats.h gigaset_dev.h hdsmart.h		\
 	hpfs_fs.h hysdn_if.h i2c-dev.h i8k.h icmp.h			\
 	if_arcnet.h if_arp.h if_bonding.h if_cablemodem.h if_fc.h	\
 	if_fddi.h if.h if_hippi.h if_infiniband.h if_packet.h		\
@@ -34,15 +34,15 @@
 	atmarp.h atmdev.h atm.h atm_tcp.h audit.h auto_fs.h binfmts.h	\
 	capability.h capi.h cciss_ioctl.h cdrom.h cm4000_cs.h		\
 	cn_proc.h coda.h connector.h cramfs_fs.h cuda.h cyclades.h	\
-	dccp.h dirent.h divert.h elfcore.h errno.h errqueue.h		\
-	ethtool.h eventpoll.h ext2_fs.h ext3_fs.h fb.h fcntl.h		\
-	filter.h flat.h fs.h ftape.h gameport.h generic_serial.h	\
-	genhd.h hayesesp.h hdlcdrv.h hdlc.h hdreg.h hiddev.h hpet.h	\
-	i2c.h i2o-dev.h icmpv6.h if_bridge.h if_ec.h			\
+	dccp.h dirent.h divert.h dm-ioctl.h elf-fdpic.h elfcore.h	\
+	errno.h	errqueue.h ethtool.h eventpoll.h ext2_fs.h ext3_fs.h	\
+	fb.h fcntl.h filter.h flat.h fs.h ftape.h futex.h gameport.h	\
+	generic_serial.h genhd.h hayesesp.h hdlcdrv.h hdlc.h hdreg.h	\
+	hiddev.h hpet.h	i2c.h i2o-dev.h icmpv6.h if_bridge.h if_ec.h	\
 	if_eql.h if_ether.h if_frad.h if_ltalk.h if_pppox.h		\
 	if_shaper.h if_tr.h if_tun.h if_vlan.h if_wanpipe.h igmp.h	\
 	inet_diag.h in.h inotify.h input.h ipc.h ipmi.h ipv6.h		\
-	ipv6_route.h isdn.h isdnif.h isdn_ppp.h isicom.h jbd.h		\
+	ipv6_route.h isdn.h isdnif.h isdn_ppp.h isicom.h		\
 	joystick.h kdev_t.h kd.h kernelcapi.h kernel.h keyboard.h	\
 	llc.h loop.h lp.h mempolicy.h mii.h mman.h mroute.h msdos_fs.h	\
 	msg.h nbd.h ncp_fs.h ncp.h ncp_mount.h netdevice.h		\
include/linux/acct.h +1 -1
Index: linux-cg/include/linux/acct.h
===================================================================
@@ -59,7 +59,7 @@
 	comp_t		ac_majflt;		/* Major Pagefaults */
 	comp_t		ac_swaps;		/* Number of Swaps */
 /* m68k had no padding here. */
-#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
+#if !defined(__mc68000__) || !defined(__KERNEL__)
 	__u16		ac_ahz;			/* AHZ */
 #endif
 	__u32		ac_exitcode;		/* Exitcode */
include/linux/coda.h +18 -14
Index: linux-cg/include/linux/coda.h
===================================================================
@@ -59,6 +59,20 @@
 #ifndef _CODA_HEADER_
 #define _CODA_HEADER_
 
+#if 0
+#define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
+#define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
+#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
+#endif
+#ifdef __KERNEL__
+#ifdef CONFIG_CODA_FS_OLD_API
+#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
+#endif
+#endif
+
+#ifndef CODA_KERNEL_VERSION
+#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
+#endif
 
 /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
 #if defined(__NetBSD__) || \
@@ -199,7 +213,7 @@
 typedef u_int32_t vgid_t;
 #endif /*_VUID_T_ */
 
-#ifdef CONFIG_CODA_FS_OLD_API
+#if CODA_KERNEL_VERSION == 2
 struct CodaFid {
 	u_int32_t opaque[3];
 };
@@ -219,7 +233,7 @@
     vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
 };
 
-#else /* not defined(CONFIG_CODA_FS_OLD_API) */
+#else /* not CODA_KERNEL_VERSION == 2 */
 
 struct CodaFid {
 	u_int32_t opaque[4];
@@ -313,23 +327,13 @@
 
 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
 
-#if 0
-#define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
-#define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
-#endif
-#ifdef CONFIG_CODA_FS_OLD_API
-#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
-#else
-#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
-#endif
-
 /*
  *        Venus <-> Coda  RPC arguments
  */
 struct coda_in_hdr {
     u_int32_t opcode;
     u_int32_t unique;	    /* Keep multiple outstanding msgs distinct */
-#ifdef CONFIG_CODA_FS_OLD_API
+#if CODA_KERNEL_VERSION == 2
     u_int16_t pid;	    /* Common to all */
     u_int16_t pgid;	    /* Common to all */
     u_int16_t sid;          /* Common to all */
@@ -613,7 +617,7 @@
 /* CODA_PURGEUSER is a venus->kernel call */
 struct coda_purgeuser_out {
     struct coda_out_hdr oh;
-#ifdef CONFIG_CODA_FS_OLD_API
+#if CODA_KERNEL_VERSION == 2
     struct coda_cred cred;
 #else
     vuid_t uid;
include/linux/elf-fdpic.h +2 -0
Index: linux-cg/include/linux/elf-fdpic.h
===================================================================
@@ -58,11 +58,13 @@
 #define ELF_FDPIC_FLAG_PRESENT		0x80000000	/* T if this object is present */
 };
 
+#ifdef __KERNEL__
 #ifdef CONFIG_MMU
 extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
 				      struct elf_fdpic_params *interp_params,
 				      unsigned long *start_stack,
 				      unsigned long *start_brk);
 #endif
+#endif
 
 #endif /* _LINUX_ELF_FDPIC_H */
include/linux/elfcore.h +6 -0
Index: linux-cg/include/linux/elfcore.h
===================================================================
@@ -17,10 +17,14 @@
 #include <asm/elf.h>
 
 #ifndef __KERNEL__
+#if !defined(__s390__)
 typedef elf_greg_t greg_t;
+#endif
 typedef elf_gregset_t gregset_t;
 typedef elf_fpregset_t fpregset_t;
+#if defined(__i386__) || defined(__ia64__)
 typedef elf_fpxregset_t fpxregset_t;
+#endif
 #define NGREG ELF_NGREG
 #endif
 
@@ -60,6 +64,7 @@
 	long	pr_instr;		/* Current instruction */
 #endif
 	elf_gregset_t pr_reg;	/* GP registers */
+#ifdef __KERNEL__
 #ifdef CONFIG_BINFMT_ELF_FDPIC
 	/* When using FDPIC, the loadmap addresses need to be communicated
 	 * to GDB in order for GDB to do the necessary relocations.  The
@@ -70,6 +75,7 @@
 	unsigned long pr_exec_fdpic_loadmap;
 	unsigned long pr_interp_fdpic_loadmap;
 #endif
+#endif
 	int pr_fpvalid;		/* True if math co-processor being used.  */
 };
 
include/linux/ext3_fs.h +3 -4
Index: linux-cg/include/linux/ext3_fs.h
===================================================================
@@ -228,12 +228,11 @@
 #define EXT3_IOC_GROUP_ADD		_IOW('f', 8,struct ext3_new_group_input)
 #define	EXT3_IOC_GETVERSION_OLD		_IOR('v', 1, long)
 #define	EXT3_IOC_SETVERSION_OLD		_IOW('v', 2, long)
-#ifdef CONFIG_JBD_DEBUG
 #define EXT3_IOC_WAIT_FOR_READONLY	_IOR('f', 99, long)
-#endif
 #define EXT3_IOC_GETRSVSZ		_IOR('f', 5, long)
 #define EXT3_IOC_SETRSVSZ		_IOW('f', 6, long)
 
+#ifdef __KERNEL__
 /*
  *  Mount options
  */
@@ -247,6 +246,7 @@
 	char *s_qf_names[MAXQUOTAS];
 #endif
 };
+#endif
 
 /*
  * Structure of an inode on the disk
@@ -652,6 +652,7 @@
  * (c) Daniel Phillips, 2001
  */
 
+#ifdef __KERNEL__
 #ifdef CONFIG_EXT3_INDEX
   #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
 					      EXT3_FEATURE_COMPAT_DIR_INDEX) && \
@@ -670,8 +671,6 @@
 #define DX_HASH_HALF_MD4	1
 #define DX_HASH_TEA		2
 
-#ifdef __KERNEL__
-
 /* hash info structure used by the directory hash */
 struct dx_hash_info
 {
include/linux/fb.h +2 -2
Index: linux-cg/include/linux/fb.h
===================================================================
@@ -366,14 +366,14 @@
 	struct fb_image	image;	/* Cursor image */
 };
 
+#ifdef __KERNEL__
+
 #ifdef CONFIG_FB_BACKLIGHT
 /* Settings for the generic backlight code */
 #define FB_BACKLIGHT_LEVELS	128
 #define FB_BACKLIGHT_MAX	0xFF
 #endif
 
-#ifdef __KERNEL__
-
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/device.h>
include/linux/flat.h +4 -3
Index: linux-cg/include/linux/flat.h
===================================================================
@@ -12,9 +12,6 @@
 
 #ifdef __KERNEL__
 #include <asm/flat.h>
-#endif
-
-#define	FLAT_VERSION			0x00000004L
 
 #ifdef CONFIG_BINFMT_SHARED_FLAT
 #define	MAX_SHARED_LIBS			(4)
@@ -22,6 +19,10 @@
 #define	MAX_SHARED_LIBS			(1)
 #endif
 
+#endif /* __KERNEL__ */
+
+#define	FLAT_VERSION			0x00000004L
+
 /*
  * To make everything easier to port and manage cross platform
  * development,  all fields are in network byte order.
include/linux/fs.h +2 -0
Index: linux-cg/include/linux/fs.h
===================================================================
@@ -31,6 +31,7 @@
 #define SEEK_CUR	1	/* seek relative to current file position */
 #define SEEK_END	2	/* seek relative to end of file */
 
+#ifdef __KERNEL__
 /* And dynamically-tunable limits and defaults: */
 struct files_stat_struct {
 	int nr_files;		/* read only */
@@ -52,6 +53,7 @@
 #ifdef CONFIG_DNOTIFY
 extern int dir_notify_enable;
 #endif
+#endif
 
 #define NR_FILE  8192	/* this can well be larger on a larger system */
 
include/linux/genhd.h +2 -7
Index: linux-cg/include/linux/genhd.h
===================================================================
@@ -52,9 +52,8 @@
 	unsigned int nr_sects;		/* nr of sectors in partition */
 } __attribute__((packed));
 
-#endif
+#else /* __KERNEL__ */
 
-#ifdef __KERNEL__
 #include <linux/major.h>
 #include <linux/device.h>
 #include <linux/smp.h>
@@ -247,8 +246,6 @@
 	disk->capacity = size;
 }
 
-#endif  /*  __KERNEL__  */
-
 #ifdef CONFIG_SOLARIS_X86_PARTITION
 
 #define SOLARIS_X86_NUMSLICE	8
@@ -392,8 +389,6 @@
 #   define MINIX_NR_SUBPARTITIONS  4
 #endif /* CONFIG_MINIX_SUBPARTITION */
 
-#ifdef __KERNEL__
-
 char *disk_name (struct gendisk *hd, int part, char *buf);
 
 extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
@@ -417,6 +412,6 @@
 	return bdget(MKDEV(disk->major, disk->first_minor) + index);
 }
 
-#endif
+#endif /* __KERNEL__ */
 
 #endif
include/linux/if_frad.h +0 -7
Index: linux-cg/include/linux/if_frad.h
===================================================================
@@ -26,8 +26,6 @@
 
 #include <linux/if.h>
 
-#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
-
 /* Structures and constants associated with the DLCI device driver */
 
 struct dlci_add
@@ -190,11 +188,6 @@
    int               buffer;		/* current buffer for S508 firmware */
 };
 
-#endif /* __KERNEL__ */
-
-#endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
-
-#ifdef __KERNEL__
 extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
 #endif
 
include/linux/isdn.h +2 -0
Index: linux-cg/include/linux/isdn.h
===================================================================
@@ -16,6 +16,7 @@
 
 #include <linux/ioctl.h>
 
+#ifdef __KERNEL__
 #ifdef CONFIG_COBALT_MICRO_SERVER
 /* Save memory */
 #define ISDN_MAX_DRIVERS    2
@@ -24,6 +25,7 @@
 #define ISDN_MAX_DRIVERS    32
 #define ISDN_MAX_CHANNELS   64
 #endif
+#endif
 
 /* New ioctl-codes */
 #define IIOCNETAIF  _IO('I',1)
include/linux/nfsd/stats.h +2 -1
Index: linux-cg/include/linux/nfsd/stats.h
===================================================================
@@ -29,10 +29,11 @@
 	unsigned int	ra_size;	/* size of ra cache */
 	unsigned int	ra_depth[11];	/* number of times ra entry was found that deep
 					 * in the cache (10percentiles). [10] = not found */
+#ifdef __KERNEL__
 #ifdef CONFIG_NFSD_V4
 	unsigned int	nfs4_opcount[LAST_NFS4_OP + 1];	/* count of individual nfsv4 operations */
 #endif
-
+#endif
 };
 
 /* thread usage wraps very million seconds (approx one fortnight) */
include/linux/nfsd/syscall.h +2 -0
Index: linux-cg/include/linux/nfsd/syscall.h
===================================================================
@@ -45,6 +45,7 @@
 #define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
 #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
 
+#ifdef __KERNEL__
 #if defined(CONFIG_NFSD_V4)
 #define	NFSCTL_VERALL	(0x1c /* 0b011100 */)
 #elif defined(CONFIG_NFSD_V3)
@@ -52,6 +53,7 @@
 #else
 #define	NFSCTL_VERALL	(0x04 /* 0b000100 */)
 #endif
+#endif
 
 /* SVC */
 struct nfsctl_svc {
include/linux/pktcdvd.h +11 -11
Index: linux-cg/include/linux/pktcdvd.h
===================================================================
@@ -29,17 +29,6 @@
 #define PACKET_WAIT_TIME	(HZ * 5 / 1000)
 
 /*
- * use drive write caching -- we need deferred error handling to be
- * able to sucessfully recover with this option (drive will return good
- * status as soon as the cdb is validated).
- */
-#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
-#define USE_WCACHING		1
-#else
-#define USE_WCACHING		0
-#endif
-
-/*
  * No user-servicable parts beyond this point ->
  */
 
@@ -112,6 +101,17 @@
 #include <linux/completion.h>
 #include <linux/cdrom.h>
 
+/*
+ * use drive write caching -- we need deferred error handling to be
+ * able to sucessfully recover with this option (drive will return good
+ * status as soon as the cdb is validated).
+ */
+#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
+#define USE_WCACHING		1
+#else
+#define USE_WCACHING		0
+#endif
+
 struct packet_settings
 {
 	__u32			size;		/* packet size in (512 byte) sectors */
include/linux/reiserfs_fs.h +11 -12
Index: linux-cg/include/linux/reiserfs_fs.h
===================================================================
@@ -11,8 +11,8 @@
 #ifndef _LINUX_REISER_FS_H
 #define _LINUX_REISER_FS_H
 
-#include <linux/types.h>
 #ifdef __KERNEL__
+#include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
@@ -24,7 +24,6 @@
 #include <linux/buffer_head.h>
 #include <linux/reiserfs_fs_i.h>
 #include <linux/reiserfs_fs_sb.h>
-#endif
 
 /*
  *  include/linux/reiser_fs.h
@@ -1532,7 +1531,6 @@
 /*                    FUNCTION DECLARATIONS                                */
 /***************************************************************************/
 
-/*#ifdef __KERNEL__*/
 #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
 
 #define journal_trans_half(blocksize) \
@@ -2169,6 +2167,16 @@
 /* prototypes from ioctl.c */
 int reiserfs_ioctl(struct inode *inode, struct file *filp,
 		   unsigned int cmd, unsigned long arg);
+/* Locking primitives */
+/* Right now we are still falling back to (un)lock_kernel, but eventually that
+   would evolve into real per-fs locks */
+#define reiserfs_write_lock( sb ) lock_kernel()
+#define reiserfs_write_unlock( sb ) unlock_kernel()
+
+/* xattr stuff */
+#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
+
+#endif
 
 /* ioctl's command */
 #define REISERFS_IOC_UNPACK		_IOW(0xCD,1,long)
@@ -2179,13 +2187,4 @@
 #define REISERFS_IOC_GETVERSION		EXT2_IOC_GETVERSION
 #define REISERFS_IOC_SETVERSION		EXT2_IOC_SETVERSION
 
-/* Locking primitives */
-/* Right now we are still falling back to (un)lock_kernel, but eventually that
-   would evolve into real per-fs locks */
-#define reiserfs_write_lock( sb ) lock_kernel()
-#define reiserfs_write_unlock( sb ) unlock_kernel()
-
-/* xattr stuff */
-#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
-
 #endif				/* _LINUX_REISER_FS_H */
include/linux/socket.h +9 -7
Index: linux-cg/include/linux/socket.h
===================================================================
@@ -24,11 +24,13 @@
 #include <linux/types.h>		/* pid_t			*/
 #include <linux/compiler.h>		/* __user			*/
 
+#ifdef __KERNEL__
 extern int sysctl_somaxconn;
 #ifdef CONFIG_PROC_FS
 struct seq_file;
 extern void socket_seq_show(struct seq_file *seq);
 #endif
+#endif
 
 typedef unsigned short	sa_family_t;
 
@@ -249,13 +251,6 @@
 
 #define MSG_EOF         MSG_FIN
 
-#if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT	0x80000000	/* This message needs 32 bit fixups */
-#else
-#define MSG_CMSG_COMPAT	0		/* We never have 32 bit fixups */
-#endif
-
-
 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
 #define SOL_IP		0
 /* #define SOL_ICMP	1	No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */
@@ -286,6 +281,13 @@
 #define IPX_TYPE	1
 
 #ifdef __KERNEL__
+
+#if defined(CONFIG_COMPAT)
+#define MSG_CMSG_COMPAT	0x80000000	/* This message needs 32 bit fixups */
+#else
+#define MSG_CMSG_COMPAT	0		/* We never have 32 bit fixups */
+#endif
+
 extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
 extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, 
 				int offset, int len);
include/linux/videodev.h +14 -2
Index: linux-cg/include/linux/videodev.h
===================================================================
@@ -14,7 +14,19 @@
 
 #include <linux/videodev2.h>
 
-#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
+/*
+ * A little hack to shut up 'make headers_check',
+ * don't reference CONFIG_* outside of __KERNEL__.
+ */
+#ifdef __KERNEL__
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+#define __VIDEO_V4L1_COMPAT
+#endif
+#else
+#define __VIDEO_V4L1_COMPAT
+#endif
+
+#ifdef __VIDEO_V4L1_COMPAT
 
 struct video_capability
 {
@@ -336,7 +348,7 @@
 #define VID_HARDWARE_SN9C102	38
 #define VID_HARDWARE_ARV	39
 
-#endif /* CONFIG_VIDEO_V4L1_COMPAT */
+#endif /* __VIDEO_V4L1_COMPAT */
 
 #endif /* __LINUX_VIDEODEV_H */
 

--

maintainer
#34 lore raw

PATCH 4/8 fix exported flock64 constants

In reply to David Woodhouse

The asm-generic/fcntl.h header relied on CONFIG_64BIT to determine if it should define some of its contents.

This does not work in user space where no CONFIG_ symbols are available, so introduce a new __ARCH_FLOCK64 symbol that is set by asm/fcntl.h before including asm-generic/fcntl.h when an architecture wants these.

include/asm-arm/fcntl.h +2 -0
@@ -6,6 +6,8 @@
 #define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
 #define O_LARGEFILE	0400000
 
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
 
 #endif
include/asm-arm26/fcntl.h +2 -0
index d85995e..23c5875 100644
@@ -8,6 +8,8 @@
 #define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
 #define O_LARGEFILE	0400000
 
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
 
 #endif
include/asm-cris/fcntl.h +2 -0
index 46ab12d..a025b36 100644
@@ -1 +1,3 @@
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
include/asm-frv/fcntl.h +2 -0
index 46ab12d..a025b36 100644
@@ -1 +1,3 @@
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
include/asm-generic/fcntl.h +1 -1
index c154b9d..55e8eff 100644
@@ -121,7 +121,7 @@ struct flock {
 };
 #endif
 
-#ifndef CONFIG_64BIT
+#ifdef __ARCH_FLOCK64
 
 #ifndef F_GETLK64
 #define F_GETLK64	12	/*  using 'struct flock64' */
include/asm-h8300/fcntl.h +2 -0
index 1952cb2..e0001cd 100644
@@ -6,6 +6,8 @@
 #define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
 #define O_LARGEFILE	0400000
 
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
 
 #endif /* _H8300_FCNTL_H */
include/asm-i386/fcntl.h +2 -0
index 46ab12d..a025b36 100644
@@ -1 +1,3 @@
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
include/asm-ia64/fcntl.h +2 -0
index 1dd275d..622d230 100644
@@ -8,6 +8,8 @@
 #define force_o_largefile()	\
 		(personality(current->personality) != PER_LINUX32)
 
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
 
 #endif /* _ASM_IA64_FCNTL_H */
include/asm-m32r/fcntl.h +2 -0
index 46ab12d..a025b36 100644
@@ -1 +1,3 @@
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
include/asm-m68k/fcntl.h +2 -0
index 1c369b2..d9070e4 100644
@@ -6,6 +6,8 @@
 #define O_DIRECT	0200000	/* direct disk access hint - currently ignored */
 #define O_LARGEFILE	0400000
 
+#define __ARCH_FLOCK64
+
 #include <asm-generic/fcntl.h>
 
 #endif /* _M68K_FCNTL_H */
include/asm-m68knommu/fcntl.h +2 -0
index f6a552c..237f6b8 100644
@@ -1 +1,3 @@
+#define __ARCH_FLOCK64
+
 #include <asm-m68k/fcntl.h>
include/asm-mips/fcntl.h +2 -0
index 787220e..bab60a4 100644
@@ -55,6 +55,8 @@ struct flock {
 
 #define HAVE_ARCH_STRUCT_FLOCK
 
+#define __ARCH_FLOCK64
+
 #endif /* CONFIG_32BIT */
 
 #include <asm-generic/fcntl.h>
include/asm-parisc/fcntl.h +4 -0
index 317851f..df97fd4 100644
@@ -33,6 +33,10 @@
 #define F_WRLCK		02
 #define F_UNLCK		03
 
+#ifndef __LP64__
+#define __ARCH_FLOCK64
+#endif
+
 #include <asm-generic/fcntl.h>
 
 #endif
include/asm-powerpc/fcntl.h +4 -0
index ce5c451..a399283 100644
@@ -6,6 +6,10 @@
 #define O_LARGEFILE     0200000
 #define O_DIRECT	0400000	/* direct disk access hint */
 
+#ifndef __powerpc64__
+#define __ARCH_FLOCK64
+#endif
+
 #include <asm-generic/fcntl.h>
 
 #endif /* _ASM_FCNTL_H */
include/asm-s390/fcntl.h +3 -0
index 46ab12d..1495a78 100644
@@ -1 +1,4 @@
+#ifndef __s390x__
+#define __ARCH_FLOCK64
+#endif
 #include <asm-generic/fcntl.h>
include/asm-sh/fcntl.h +1 -0
index 46ab12d..0128121 100644
@@ -1 +1,2 @@
+#define __ARCH_FLOCK64
 #include <asm-generic/fcntl.h>
include/asm-sh64/fcntl.h +1 -0
index 744dd79..f887490 100644
@@ -1 +1,2 @@
+#define __ARCH_FLOCK64
 #include <asm-sh/fcntl.h>
include/asm-sparc/fcntl.h +1 -0
index 5db60b5..ce3e074 100644
@@ -30,6 +30,7 @@
 
 #define __ARCH_FLOCK_PAD	short __unused;
 #define __ARCH_FLOCK64_PAD	short __unused;
+#define __ARCH_FLOCK64
 
 #include <asm-generic/fcntl.h>
 
include/asm-v850/fcntl.h +1 -0
index 3af4d56..ef49898 100644
@@ -6,6 +6,7 @@
 #define O_DIRECT       0200000	/* direct disk access hint - currently ignored */
 #define O_LARGEFILE    0400000
 
+#define __ARCH_FLOCK64
 #include <asm-generic/fcntl.h>
 
 #endif /* __V850_FCNTL_H__ */
include/asm-xtensa/fcntl.h +1 -0
index ec066ae..b1f33a9 100644
@@ -55,6 +55,7 @@ struct flock64 {
 
 #define HAVE_ARCH_STRUCT_FLOCK
 #define HAVE_ARCH_STRUCT_FLOCK64
+#define __ARCH_FLOCK64
 
 #include <asm-generic/fcntl.h>
 

--

maintainer
#35 lore raw

PATCH 5/8 add missing #includes in user space parts of headers

In reply to David Woodhouse

These files should include some other headers in order to be included from user space.

include/asm-s390/cmb.h +4 -0
Index: linux-cg/include/asm-s390/cmb.h
===================================================================
@@ -1,5 +1,9 @@
 #ifndef S390_CMB_H
 #define S390_CMB_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
 /**
  * struct cmbdata -- channel measurement block data for user space
  *
include/asm-s390/dasd.h +1 -0
Index: linux-cg/include/asm-s390/dasd.h
===================================================================
@@ -13,6 +13,7 @@
 #ifndef DASD_H
 #define DASD_H
 #include <linux/ioctl.h>
+#include <linux/types.h>
 
 #define DASD_IOCTL_LETTER 'D'
 
include/asm-s390/qeth.h +1 -0
Index: linux-cg/include/asm-s390/qeth.h
===================================================================
@@ -11,6 +11,7 @@
 #ifndef __ASM_S390_QETH_IOCTL_H__
 #define __ASM_S390_QETH_IOCTL_H__
 #include <linux/ioctl.h>
+#include <linux/types.h>
 
 #define SIOC_QETH_ARP_SET_NO_ENTRIES    (SIOCDEVPRIVATE)
 #define SIOC_QETH_ARP_QUERY_INFO        (SIOCDEVPRIVATE + 1)
include/linux/atm.h +1 -0
Index: linux-cg/include/linux/atm.h
===================================================================
@@ -11,6 +11,7 @@
 #ifndef _LINUX_ATM_H
 #define _LINUX_ATM_H
 
+#include <linux/types.h>
 /*
  * BEGIN_xx and END_xx markers are used for automatic generation of
  * documentation. Do not change them.
include/linux/audit.h +1 -0
Index: linux-cg/include/linux/audit.h
===================================================================
@@ -25,6 +25,7 @@
 #define _LINUX_AUDIT_H_
 
 #include <linux/elf-em.h>
+#include <linux/types.h>
 
 /* The netlink messages for the audit system is divided into blocks:
  * 1000 - 1099 are for commanding the audit system
include/linux/cm4000_cs.h +2 -0
Index: linux-cg/include/linux/cm4000_cs.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef	_CM4000_H_
 #define	_CM4000_H_
 
+#include <linux/types.h>
+
 #define	MAX_ATR			33
 
 #define	CM4000_MAX_DEV		4
include/linux/cyclades.h +2 -0
Index: linux-cg/include/linux/cyclades.h
===================================================================
@@ -67,6 +67,8 @@
 #ifndef _LINUX_CYCLADES_H
 #define _LINUX_CYCLADES_H
 
+#include <linux/types.h>
+
 struct cyclades_monitor {
         unsigned long           int_count;
         unsigned long           char_count;
include/linux/ftape-header-segment.h +1 -0
Index: linux-cg/include/linux/ftape-header-segment.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _FTAPE_HEADER_SEGMENT_H
 #define _FTAPE_HEADER_SEGMENT_H
 
+#include <linux/types.h>
 /*
  * Copyright (C) 1996-1997 Claus-Justus Heine.
 
include/linux/hiddev.h +2 -0
Index: linux-cg/include/linux/hiddev.h
===================================================================
@@ -29,6 +29,8 @@
  * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
  */
 
+#include <linux/types.h>
+
 /*
  * The event structure itself
  */
include/linux/i2o-dev.h +1 -0
Index: linux-cg/include/linux/i2o-dev.h
===================================================================
@@ -24,6 +24,7 @@
 #define MAX_I2O_CONTROLLERS	32
 
 #include <linux/ioctl.h>
+#include <linux/types.h>
 
 /*
  * I2O Control IOCTLs and structures
include/linux/ite_gpio.h +1 -0
Index: linux-cg/include/linux/ite_gpio.h
===================================================================
@@ -33,6 +33,7 @@
 #ifndef __ITE_GPIO_H
 #define __ITE_GPIO_H
 
+#include <linux/types.h>
 #include <linux/ioctl.h>
 
 struct ite_gpio_ioctl_data {
include/linux/loop.h +2 -2
Index: linux-cg/include/linux/loop.h
===================================================================
@@ -77,8 +77,8 @@
 	LO_FLAGS_USE_AOPS	= 2,
 };
 
-#include <asm/posix_types.h>	/* for __kernel_old_dev_t */
-#include <asm/types.h>		/* for __u64 */
+#include <linux/posix_types.h>	/* for __kernel_old_dev_t */
+#include <linux/types.h>		/* for __u64 */
 
 /* Backwards compatibility version */
 struct loop_info {
include/linux/nbd.h +2 -0
Index: linux-cg/include/linux/nbd.h
===================================================================
@@ -15,6 +15,8 @@
 #ifndef LINUX_NBD_H
 #define LINUX_NBD_H
 
+#include <linux/types.h>
+
 #define NBD_SET_SOCK	_IO( 0xab, 0 )
 #define NBD_SET_BLKSIZE	_IO( 0xab, 1 )
 #define NBD_SET_SIZE	_IO( 0xab, 2 )
include/linux/pkt_sched.h +2 -0
Index: linux-cg/include/linux/pkt_sched.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_PKT_SCHED_H
 #define __LINUX_PKT_SCHED_H
 
+#include <linux/types.h>
+
 /* Logical priority bands not depending on specific packet scheduler.
    Every scheduler will map them to real traffic classes, if it has
    no more precise mechanism to classify packets.
include/linux/ppp_defs.h +2 -0
Index: linux-cg/include/linux/ppp_defs.h
===================================================================
@@ -42,6 +42,8 @@
 #ifndef _PPP_DEFS_H_
 #define _PPP_DEFS_H_
 
+#include <linux/types.h>
+
 /*
  * The basic PPP frame.
  */
include/linux/qic117.h +2 -0
Index: linux-cg/include/linux/qic117.h
===================================================================
@@ -53,6 +53,8 @@
  *       QIC-CRF3,    Rev. B, 15 Jun 95.
  * */
 
+#include <linux/types.h>
+
 /*
  *      QIC-117 common command set rev. J.
  *      These commands are sent to the tape unit
include/linux/qnxtypes.h +2 -0
Index: linux-cg/include/linux/qnxtypes.h
===================================================================
@@ -12,6 +12,8 @@
 #ifndef _QNX4TYPES_H
 #define _QNX4TYPES_H
 
+#include <linux/types.h>
+
 typedef __le16 qnx4_nxtnt_t;
 typedef __u8  qnx4_ftype_t;
 
include/linux/raid/md_p.h +1 -0
Index: linux-cg/include/linux/raid/md_p.h
===================================================================
@@ -15,6 +15,7 @@
 #ifndef _MD_P_H
 #define _MD_P_H
 
+#include <linux/types.h>
 /*
  * RAID superblock.
  *
include/linux/random.h +1 -0
Index: linux-cg/include/linux/random.h
===================================================================
@@ -8,6 +8,7 @@
 #define _LINUX_RANDOM_H
 
 #include <linux/ioctl.h>
+#include <linux/types.h>
 
 /* ioctl()'s for the random number generator */
 
include/linux/reiserfs_xattr.h +1 -0
Index: linux-cg/include/linux/reiserfs_xattr.h
===================================================================
@@ -3,6 +3,7 @@
 */
 
 #include <linux/xattr.h>
+#include <linux/types.h>
 
 /* Magic value in header */
 #define REISERFS_XATTR_MAGIC 0x52465841	/* "RFXA" */
include/linux/video_decoder.h +2 -0
Index: linux-cg/include/linux/video_decoder.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_VIDEO_DECODER_H
 #define _LINUX_VIDEO_DECODER_H
 
+#include <linux/types.h>
+
 #define HAVE_VIDEO_DECODER 1
 
 struct video_decoder_capability { /* this name is too long */
include/linux/video_encoder.h +2 -0
Index: linux-cg/include/linux/video_encoder.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_VIDEO_ENCODER_H
 #define _LINUX_VIDEO_ENCODER_H
 
+#include <linux/types.h>
+
 struct video_encoder_capability { /* this name is too long */
 	__u32	flags;
 #define	VIDEO_ENCODER_PAL	1	/* can encode PAL signal */
include/linux/videodev2.h +1 -0
Index: linux-cg/include/linux/videodev2.h
===================================================================
@@ -19,6 +19,7 @@
 #include <linux/compiler.h> /* need __user */
 #else
 #define __user
+#include <sys/time.h>
 #endif
 #include <linux/types.h>
 
include/sound/hdsp.h +2 -0
Index: linux-cg/include/sound/hdsp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __SOUND_HDSP_H
 #define __SOUND_HDSP_H
 
+#include <linux/types.h>
+
 /*
  *   Copyright (C) 2003 Thomas Charbonnel ([email protected])
  *    

--

maintainer
#36 lore raw

PATCH 6/8 annotate header files for make headers_check

In reply to David Woodhouse

These files can only be included from user space if some other header has been included first, and they don't look like they should include that header themselves.

This uses a special '@headercheck: ... @' tag in a comment, which is then turned into a gcc command line option that will include the dependencies first.

All netfilter headers need something like this as well, but I decided to make them a separate patch, because there are so many of them.

include/asm-generic/siginfo.h +2 -0
Index: linux-cg/include/asm-generic/siginfo.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _ASM_GENERIC_SIGINFO_H
 #define _ASM_GENERIC_SIGINFO_H
 
+/* @headercheck: -include linux/signal.h @ */
+
 #include <linux/compiler.h>
 #include <linux/types.h>
 
include/asm-i386/ipcbuf.h +1 -0
Index: linux-cg/include/asm-i386/ipcbuf.h
===================================================================
@@ -10,6 +10,7 @@
  * - 32-bit mode_t and seq
  * - 2 miscellaneous 32-bit values
  */
+/* @headercheck: -include linux/posix_types.h @ */
 
 struct ipc64_perm
 {
include/asm-i386/msgbuf.h +2 -0
Index: linux-cg/include/asm-i386/msgbuf.h
===================================================================
@@ -10,6 +10,8 @@
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  */
+/* @headercheck: -include linux/posix_types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
 
 struct msqid64_ds {
 	struct ipc64_perm msg_perm;
include/asm-i386/sembuf.h +2 -0
Index: linux-cg/include/asm-i386/sembuf.h
===================================================================
@@ -10,6 +10,8 @@
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  */
+/* @headercheck: -include linux/posix_types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
 
 struct semid64_ds {
 	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
include/asm-i386/shmbuf.h +3 -0
Index: linux-cg/include/asm-i386/shmbuf.h
===================================================================
@@ -10,6 +10,9 @@
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  */
+/* @headercheck: -include linux/posix_types.h @ */
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
 
 struct shmid64_ds {
 	struct ipc64_perm	shm_perm;	/* operation perms */
include/asm-i386/ucontext.h +3 -0
Index: linux-cg/include/asm-i386/ucontext.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _ASMi386_UCONTEXT_H
 #define _ASMi386_UCONTEXT_H
 
+/* @headercheck: -include asm/signal.h @ */
+/* @headercheck: -include asm/sigcontext.h @ */
+
 struct ucontext {
 	unsigned long	  uc_flags;
 	struct ucontext  *uc_link;
include/asm-powerpc/msgbuf.h +1 -0
Index: linux-cg/include/asm-powerpc/msgbuf.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _ASM_POWERPC_MSGBUF_H
 #define _ASM_POWERPC_MSGBUF_H
 
+/* @headercheck:-include asm/ipcbuf.h@ */
 /*
  * The msqid64_ds structure for the PowerPC architecture.
  * Note extra padding because this structure is passed back and forth
include/asm-powerpc/posix_types.h +1 -0
Index: linux-cg/include/asm-powerpc/posix_types.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _ASM_POWERPC_POSIX_TYPES_H
 #define _ASM_POWERPC_POSIX_TYPES_H
 
+/* @headercheck:-include linux/posix_types.h@ */
 /*
  * This file is generally used by user-level software, so you need to
  * be a little careful about namespace pollution etc.  Also, we cannot
include/asm-powerpc/sembuf.h +1 -0
Index: linux-cg/include/asm-powerpc/sembuf.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _ASM_POWERPC_SEMBUF_H
 #define _ASM_POWERPC_SEMBUF_H
 
+/* @headercheck:-include asm/ipcbuf.h@ */
 /*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
include/asm-powerpc/shmbuf.h +1 -0
Index: linux-cg/include/asm-powerpc/shmbuf.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _ASM_POWERPC_SHMBUF_H
 #define _ASM_POWERPC_SHMBUF_H
 
+/* @headercheck:-include asm/ipcbuf.h@ */
 /*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
include/asm-s390/ipcbuf.h +2 -0
Index: linux-cg/include/asm-s390/ipcbuf.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __S390_IPCBUF_H__
 #define __S390_IPCBUF_H__
 
+/* @headercheck: -include linux/types.h @ */
+
 /*
  * The user_ipc_perm structure for S/390 architecture.
  * Note extra padding because this structure is passed back and forth
include/asm-s390/msgbuf.h +3 -0
Index: linux-cg/include/asm-s390/msgbuf.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _S390_MSGBUF_H
 #define _S390_MSGBUF_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
+
 /* 
  * The msqid64_ds structure for S/390 architecture.
  * Note extra padding because this structure is passed back and forth
include/asm-s390/sembuf.h +3 -0
Index: linux-cg/include/asm-s390/sembuf.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _S390_SEMBUF_H
 #define _S390_SEMBUF_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
+
 /* 
  * The semid64_ds structure for S/390 architecture.
  * Note extra padding because this structure is passed back and forth
include/asm-s390/shmbuf.h +3 -0
Index: linux-cg/include/asm-s390/shmbuf.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _S390_SHMBUF_H
 #define _S390_SHMBUF_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include asm/ipcbuf.h @ */
+
 /* 
  * The shmid64_ds structure for S/390 architecture.
  * Note extra padding because this structure is passed back and forth
include/asm-s390/ucontext.h +3 -0
Index: linux-cg/include/asm-s390/ucontext.h
===================================================================
@@ -9,6 +9,9 @@
 #ifndef _ASM_S390_UCONTEXT_H
 #define _ASM_S390_UCONTEXT_H
 
+/* @headercheck: -include asm/signal.h @ */
+/* @headercheck: -include asm/sigcontext.h @ */
+
 struct ucontext {
 	unsigned long	  uc_flags;
 	struct ucontext  *uc_link;
include/linux/atalk.h +1 -0
Index: linux-cg/include/linux/atalk.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef __LINUX_ATALK_H__
 #define __LINUX_ATALK_H__
 
+/* @headercheck: -include linux/socket.h @ */
 #include <asm/byteorder.h>
 
 /*
include/linux/atm_tcp.h +2 -0
Index: linux-cg/include/linux/atm_tcp.h
===================================================================
@@ -12,6 +12,8 @@
 #ifdef __KERNEL__
 #include <linux/types.h>
 #endif
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/atm.h @ */
 #include <linux/atmioc.h>
 
 
include/linux/atm_zatm.h +1 -0
Index: linux-cg/include/linux/atm_zatm.h
===================================================================
@@ -11,6 +11,7 @@
  * Note: non-kernel programs including this file must also include
  * sys/types.h for struct timeval
  */
+/* @headercheck: -include sys/types.h@ */
 
 #include <linux/atmapi.h>
 #include <linux/atmioc.h>
include/linux/atmarp.h +2 -0
Index: linux-cg/include/linux/atmarp.h
===================================================================
@@ -9,6 +9,8 @@
 #ifdef __KERNEL__
 #include <linux/types.h>
 #endif
+/* @headercheck: -include linux/types.h @ */
+
 #include <linux/atmapi.h>
 #include <linux/atmioc.h>
 
include/linux/dirent.h +2 -0
Index: linux-cg/include/linux/dirent.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_DIRENT_H
 #define _LINUX_DIRENT_H
 
+/* @headercheck: -include linux/types.h @ */
+
 struct dirent {
 	long		d_ino;
 	__kernel_off_t	d_off;
include/linux/errqueue.h +2 -0
Index: linux-cg/include/linux/errqueue.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_ERRQUEUE_H
 #define _LINUX_ERRQUEUE_H 1
 
+/* @headercheck: -include linux/types.h @ */
+
 struct sock_extended_err
 {
 	__u32	ee_errno;	
include/linux/hdlc/ioctl.h +2 -0
Index: linux-cg/include/linux/hdlc/ioctl.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __HDLC_IOCTL_H__
 #define __HDLC_IOCTL_H__
 
+/* @headercheck:-include linux/if.h@ */
+
 typedef struct { 
 	unsigned int clock_rate; /* bits per second */
 	unsigned int clock_type; /* internal, external, TX-internal etc. */
include/linux/inet_diag.h +2 -0
Index: linux-cg/include/linux/inet_diag.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _INET_DIAG_H_
 #define _INET_DIAG_H_ 1
 
+/* @headercheck: -include linux/types.h @ */
+
 /* Just some random number */
 #define TCPDIAG_GETSOCK 18
 #define DCCPDIAG_GETSOCK 19
include/linux/ipv6_route.h +3 -0
Index: linux-cg/include/linux/ipv6_route.h
===================================================================
@@ -13,6 +13,9 @@
 #ifndef _LINUX_IPV6_ROUTE_H
 #define _LINUX_IPV6_ROUTE_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/in6.h @ */
+
 #define RTF_DEFAULT	0x00010000	/* default - learned via ND	*/
 #define RTF_ALLONLINK	0x00020000	/* (deprecated and will be removed)
 					   fallback, no routers on link */
include/linux/irda.h +1 -0
Index: linux-cg/include/linux/irda.h
===================================================================
@@ -30,6 +30,7 @@
  * Please fix the calling file to properly included needed files before
  * this one, or preferably to include <net/irda/irda.h> instead.
  * Jean II */
+/* @headercheck: -include linux/socket.h@ */
 
 /* Hint bit positions for first hint byte */
 #define HINT_PNP         0x01
include/linux/llc.h +4 -0
Index: linux-cg/include/linux/llc.h
===================================================================
@@ -1,5 +1,9 @@
 #ifndef __LINUX_LLC_H
 #define __LINUX_LLC_H
+
+/* @headercheck: -include linux/socket.h @ */
+/* @headercheck: -include linux/if.h @ */
+
 /*
  * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators.
  *
include/linux/netfilter_ipv4/ipt_physdev.h +1 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_physdev.h
===================================================================
@@ -2,6 +2,7 @@
 #define _IPT_PHYSDEV_H
 
 /* Backwards compatibility for old userspace */
+/* @headercheck:-include linux/if.h@ */
 
 #include <linux/netfilter/xt_physdev.h>
 
include/linux/netfilter_ipv6/ip6t_physdev.h +1 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_physdev.h
===================================================================
@@ -2,6 +2,7 @@
 #define _IP6T_PHYSDEV_H
 
 /* Backwards compatibility for old userspace */
+/* @headercheck:-include linux/if.h@ */
 
 #include <linux/netfilter/xt_physdev.h>
 
include/linux/netrom.h +1 -0
Index: linux-cg/include/linux/netrom.h
===================================================================
@@ -3,6 +3,7 @@
  * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the
  * definition of the ax25_address structure.
  */
+/* @headercheck: -include linux/ax25.h@ */
 
 #ifndef	NETROM_KERNEL_H
 #define	NETROM_KERNEL_H
include/linux/nfs_idmap.h +2 -0
Index: linux-cg/include/linux/nfs_idmap.h
===================================================================
@@ -37,6 +37,8 @@
 #ifndef NFS_IDMAP_H
 #define NFS_IDMAP_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /* XXX from bits/utmp.h  */
 #define IDMAP_NAMESZ  128
 
include/linux/nubus.h +2 -0
Index: linux-cg/include/linux/nubus.h
===================================================================
@@ -12,6 +12,8 @@
 #ifndef LINUX_NUBUS_H
 #define LINUX_NUBUS_H
 
+/* @headercheck: -include linux/types.h @ */
+
 #ifdef __KERNEL__
 #include <asm/nubus.h>
 #endif
include/linux/patchkey.h +4 -3
Index: linux-cg/include/linux/patchkey.h
===================================================================
@@ -9,14 +9,15 @@
  * Do not include this file directly.  Please use <sys/soundcard.h> instead.
  * For kernel code, use <linux/soundcard.h>
  */
+#ifndef _LINUX_PATCHKEY_H
+#define _LINUX_PATCHKEY_H
+
+/* @headercheck: -include linux/soundcard.h @ */
 
 #ifndef _LINUX_PATCHKEY_H_INDIRECT
 #error "patchkey.h included directly"
 #endif
 
-#ifndef _LINUX_PATCHKEY_H
-#define _LINUX_PATCHKEY_H
-
 /* Endian macros. */
 #ifdef __KERNEL__
 #  include <asm/byteorder.h>
include/linux/romfs_fs.h +2 -0
Index: linux-cg/include/linux/romfs_fs.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_ROMFS_FS_H
 #define __LINUX_ROMFS_FS_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /* The basic structures of the romfs filesystem */
 
 #define ROMBSIZE BLOCK_SIZE
include/linux/rose.h +3 -0
Index: linux-cg/include/linux/rose.h
===================================================================
@@ -7,6 +7,9 @@
 #ifndef	ROSE_KERNEL_H
 #define	ROSE_KERNEL_H
 
+/* @headercheck: -include linux/socket.h @ */
+/* @headercheck: -include linux/ax25.h @ */
+
 #define ROSE_MTU	251
 
 #define ROSE_MAX_DIGIS 6
include/linux/scc.h +1 -0
Index: linux-cg/include/linux/scc.h
===================================================================
@@ -3,6 +3,7 @@
 #ifndef	_SCC_H
 #define	_SCC_H
 
+/* @headercheck: -include linux/sockios.h @ */
 
 /* selection of hardware types */
 
include/linux/sdla.h +2 -0
Index: linux-cg/include/linux/sdla.h
===================================================================
@@ -23,6 +23,8 @@
 #ifndef SDLA_H
 #define SDLA_H
 
+/* @headercheck: -include linux/if_frad.h @ */
+
 /* adapter type */
 #define SDLA_TYPES
 #define SDLA_S502A			5020
include/linux/selinux_netlink.h +2 -0
Index: linux-cg/include/linux/selinux_netlink.h
===================================================================
@@ -12,6 +12,8 @@
 #ifndef _LINUX_SELINUX_NETLINK_H
 #define _LINUX_SELINUX_NETLINK_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /* Message types. */
 #define SELNL_MSG_BASE 0x10
 enum {
include/linux/uinput.h +2 -0
Index: linux-cg/include/linux/uinput.h
===================================================================
@@ -28,6 +28,8 @@
  *	0.1	20/06/2002
  *		- first public version
  */
+/* @headercheck: -include linux/input.h @ */
+
 #ifdef __KERNEL__
 #define UINPUT_MINOR		223
 #define UINPUT_NAME		"uinput"
include/linux/un.h +1 -0
Index: linux-cg/include/linux/un.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _LINUX_UN_H
 #define _LINUX_UN_H
 
+/* @headercheck: -include linux/socket.h @ */
 #define UNIX_PATH_MAX	108
 
 struct sockaddr_un {
include/linux/utime.h +1 -0
Index: linux-cg/include/linux/utime.h
===================================================================
@@ -1,6 +1,7 @@
 #ifndef _LINUX_UTIME_H
 #define _LINUX_UTIME_H
 
+/* @headercheck: -include linux/types.h @ */
 struct utimbuf {
 	time_t actime;
 	time_t modtime;
include/linux/x25.h +1 -0
Index: linux-cg/include/linux/x25.h
===================================================================
@@ -12,6 +12,7 @@
 #define	X25_KERNEL_H
 
 #include <linux/types.h>
+/* @headercheck: -include linux/socket.h @ */
 
 #define	SIOCX25GSUBSCRIP	(SIOCPROTOPRIVATE + 0)
 #define	SIOCX25SSUBSCRIP	(SIOCPROTOPRIVATE + 1)
include/mtd/inftl-user.h +2 -0
Index: linux-cg/include/mtd/inftl-user.h
===================================================================
@@ -8,6 +8,8 @@
 #ifndef __MTD_INFTL_USER_H__
 #define __MTD_INFTL_USER_H__
 
+/* @headercheck: -include linux/types.h @ */
+
 #define	OSAK_VERSION	0x5120
 #define	PERCENTUSED	98
 
include/mtd/mtd-abi.h +1 -5
Index: linux-cg/include/mtd/mtd-abi.h
===================================================================
@@ -7,11 +7,7 @@
 #ifndef __MTD_ABI_H__
 #define __MTD_ABI_H__
 
-#ifndef __KERNEL__ 
-/* Urgh. The whole point of splitting this out into
-   separate files was to avoid #ifdef __KERNEL__ */
-#define __user
-#endif
+/* @headercheck: -include linux/types.h @ */
 
 struct erase_info_user {
 	uint32_t start;
include/mtd/nftl-user.h +2 -0
Index: linux-cg/include/mtd/nftl-user.h
===================================================================
@@ -8,6 +8,8 @@
 #ifndef __MTD_NFTL_USER_H__
 #define __MTD_NFTL_USER_H__
 
+/* @headercheck: -include linux/types.h @ */
+
 /* Block Control Information */
 
 struct nftl_bci {
include/scsi/sg.h +1 -0
Index: linux-cg/include/scsi/sg.h
===================================================================
@@ -2,6 +2,7 @@
 #define _SCSI_GENERIC_H
 
 #include <linux/compiler.h>
+/* @headercheck: -include linux/types.h @ */
 
 /*
    History:
include/sound/asequencer.h +4 -2
Index: linux-cg/include/sound/asequencer.h
===================================================================
@@ -22,9 +22,11 @@
 #ifndef __SOUND_ASEQUENCER_H
 #define __SOUND_ASEQUENCER_H
 
-#ifdef __KERNEL__
-#include <linux/ioctl.h>
 #include <sound/asound.h>
+/* @headercheck: -include linux/time.h @ */
+
+#ifndef __KERNEL__
+#define __bitwise
 #endif
 
 /** version of the sequencer */
include/sound/asound.h +5 -2
Index: linux-cg/include/sound/asound.h
===================================================================
@@ -23,9 +23,12 @@
 #ifndef __SOUND_ASOUND_H
 #define __SOUND_ASOUND_H
 
-#ifdef __KERNEL__
-#include <linux/ioctl.h>
 #include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* @headercheck: -include linux/time.h @ */
+
+#ifdef __KERNEL__
 #include <linux/time.h>
 #include <asm/byteorder.h>
 
include/sound/emu10k1.h +9 -0
Index: linux-cg/include/sound/emu10k1.h
===================================================================
@@ -1,6 +1,10 @@
 #ifndef __SOUND_EMU10K1_H
 #define __SOUND_EMU10K1_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/time.h @ */
+/* @headercheck: -include sound/asound.h @ */
+
 /*
  *  Copyright (c) by Jaroslav Kysela <[email protected]>,
  *		     Creative Labs, Inc.
@@ -1527,6 +1531,11 @@
 	unsigned int translation;	/* translation type (EMU10K1_GPR_TRANSLATION*) */
 };
 
+#ifndef DECLARE_BITMAP
+#define DECLARE_BITMAP(name,bits) \
+	unsigned long name[(bits) / (8*sizeof(long))]
+#endif
+
 struct snd_emu10k1_fx8010_code {
 	char name[128];
 
include/sound/sfnt_info.h +2 -0
Index: linux-cg/include/sound/sfnt_info.h
===================================================================
@@ -22,6 +22,8 @@
  *
  */
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include time.h @ */
 #include <sound/asound.h>
 
 /*
include/asm-generic/atomic.h +2 -0
Index: linux-cg/include/asm-generic/atomic.h
===================================================================
@@ -8,6 +8,8 @@
  * edit all arch specific atomic.h files.
  */
 
+/* @headercheck:-include asm/atomic.h@ */
+
 #include <asm/types.h>
 
 /*
include/linux/nfsd/syscall.h +3 -0
Index: linux-cg/include/linux/nfsd/syscall.h
===================================================================
@@ -9,6 +9,9 @@
 #ifndef NFSD_SYSCALL_H
 #define NFSD_SYSCALL_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/in.h@ */
+
 #include <asm/types.h>
 #ifdef __KERNEL__
 # include <linux/types.h>
include/linux/auto_fs4.h +3 -0
Index: linux-cg/include/linux/auto_fs4.h
===================================================================
@@ -11,6 +11,9 @@
 #ifndef _LINUX_AUTO_FS4_H
 #define _LINUX_AUTO_FS4_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/limits.h @ */
+
 /* Include common v3 definitions */
 #include <linux/auto_fs.h>
 
include/linux/bfs_fs.h +2 -0
Index: linux-cg/include/linux/bfs_fs.h
===================================================================
@@ -6,6 +6,8 @@
 #ifndef _LINUX_BFS_FS_H
 #define _LINUX_BFS_FS_H
 
+/* @headercheck: -include linux/types.h @ */
+
 #define BFS_BSIZE_BITS		9
 #define BFS_BSIZE		(1<<BFS_BSIZE_BITS)
 
include/linux/efs_fs_sb.h +2 -0
Index: linux-cg/include/linux/efs_fs_sb.h
===================================================================
@@ -9,6 +9,8 @@
 #ifndef __EFS_FS_SB_H__
 #define __EFS_FS_SB_H__
 
+/* @headercheck: -include linux/types.h @ */
+
 /* statfs() magic number for EFS */
 #define EFS_SUPER_MAGIC	0x414A53
 
include/linux/jffs2.h +2 -0
Index: linux-cg/include/linux/jffs2.h
===================================================================
@@ -15,6 +15,8 @@
 #ifndef __LINUX_JFFS2_H__
 #define __LINUX_JFFS2_H__
 
+/* @headercheck: -include linux/types.h @ */
+
 /* You must include something which defines the C99 uintXX_t types. 
    We don't do it from here because this file is used in too many
    different environments. */
include/linux/minix_fs.h +2 -0
Index: linux-cg/include/linux/minix_fs.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_MINIX_FS_H
 #define _LINUX_MINIX_FS_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /*
  * The minix filesystem constants/structures
  */
include/linux/auto_fs.h +3 -0
Index: linux-cg/include/linux/auto_fs.h
===================================================================
@@ -14,6 +14,9 @@
 #ifndef _LINUX_AUTO_FS_H
 #define _LINUX_AUTO_FS_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/limits.h @ */
+
 #ifdef __KERNEL__
 #include <linux/fs.h>
 #include <linux/limits.h>
include/linux/dn.h +2 -0
Index: linux-cg/include/linux/dn.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _LINUX_DN_H
 #define _LINUX_DN_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /*
 
 	DECnet Data Structures and Constants
include/linux/ethtool.h +1 -0
Index: linux-cg/include/linux/ethtool.h
===================================================================
@@ -12,6 +12,7 @@
 #ifndef _LINUX_ETHTOOL_H
 #define _LINUX_ETHTOOL_H
 
+/* @headercheck: -include linux/types.h @ */
 
 /* This should work for both 32 and 64 bit userland. */
 struct ethtool_cmd {
include/linux/synclink.h +2 -0
Index: linux-cg/include/linux/synclink.h
===================================================================
@@ -13,6 +13,8 @@
 #define _SYNCLINK_H_
 #define SYNCLINK_H_VERSION 3.6
 
+/* @headercheck: -include linux/types.h @ */
+
 #define BOOLEAN int
 #define TRUE 1
 #define FALSE 0

--

maintainer
#37 lore raw

PATCH 7/8 annotate if_* header for make headers_check

In reply to David Woodhouse

stop headers_check from warning about include/linux/if_*.h

include/linux/if_fc.h +0 -0
index 376a34e..6ed7f1b 100644
include/linux/if_fc.h +1 -0
Index: linux-cg/include/linux/if_fc.h
===================================================================
@@ -20,6 +20,7 @@
 #ifndef _LINUX_IF_FC_H
 #define _LINUX_IF_FC_H
 
+/* @headercheck: -include linux/types.h @ */
 
 #define FC_ALEN	6		/* Octets in one ethernet addr	 */
 #define FC_HLEN   (sizeof(struct fch_hdr)+sizeof(struct fcllc))
include/linux/if_fddi.h +2 -0
Index: linux-cg/include/linux/if_fddi.h
===================================================================
@@ -24,6 +24,8 @@
 #ifndef _LINUX_IF_FDDI_H
 #define _LINUX_IF_FDDI_H
 
+/* @headercheck: -include linux/types.h @ */
+
 /*
  *  Define max and min legal sizes.  The frame sizes do not include
  *  4 byte FCS/CRC (frame check sequence).
include/linux/if_ppp.h +2 -0
Index: linux-cg/include/linux/if_ppp.h
===================================================================
@@ -35,6 +35,8 @@
 #ifndef _IF_PPP_H_
 #define _IF_PPP_H_
 
+/* @headercheck: -include linux/ppp_defs.h @ */
+/* @headercheck: -include linux/if.h @ */
 #include <linux/compiler.h>
 
 /*
include/linux/if_pppox.h +3 -0
Index: linux-cg/include/linux/if_pppox.h
===================================================================
@@ -20,6 +20,9 @@
 #include <asm/types.h>
 #include <asm/byteorder.h>
 
+/* @headercheck: -include linux/if_ether.h @ */
+/* @headercheck: -include linux/if.h @ */
+
 #ifdef  __KERNEL__
 #include <linux/if_ether.h>
 #include <linux/if.h>
include/linux/if_shaper.h +2 -0
Index: linux-cg/include/linux/if_shaper.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_SHAPER_H
 #define __LINUX_SHAPER_H
 
+/* @headercheck: -include linux/types.h @ */
+
 #ifdef __KERNEL__
 
 #define SHAPER_QLEN	10
include/linux/if_strip.h +2 -0
Index: linux-cg/include/linux/if_strip.h
===================================================================
@@ -18,6 +18,8 @@
 #ifndef __LINUX_STRIP_H
 #define __LINUX_STRIP_H
 
+/* @headercheck: -include linux/types.h @ */
+
 typedef struct {
     __u8 c[6];
 } MetricomAddress;
include/linux/if_tunnel.h +3 -0
Index: linux-cg/include/linux/if_tunnel.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _IF_TUNNEL_H_
 #define _IF_TUNNEL_H_
 
+/* @headercheck: -include linux/if.h @ */
+/* @headercheck: -include linux/ip.h @ */
+
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
 #define SIOCDELTUNNEL   (SIOCDEVPRIVATE + 2)

--

maintainer
#38 lore raw

PATCH 8/8 annotate netfilter header for make headers_check

In reply to David Woodhouse

more warning to avoid from checking the user space exported headers.

include/linux/netfilter/nf_conntrack_sctp.h +2 -0
Index: linux-cg/include/linux/netfilter/nf_conntrack_sctp.h
===================================================================
@@ -2,6 +2,8 @@
 #define _NF_CONNTRACK_SCTP_H
 /* SCTP tracking. */
 
+/* @headercheck: -include linux/types.h @ */
+
 #include <linux/netfilter/nf_conntrack_tuple_common.h>
 
 enum sctp_conntrack {
include/linux/netfilter/x_tables.h +2 -0
Index: linux-cg/include/linux/netfilter/x_tables.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _X_TABLES_H
 #define _X_TABLES_H
 
+/* @headercheck:-include linux/types.h @ */
+
 #define XT_FUNCTION_MAXNAMELEN 30
 #define XT_TABLE_MAXNAMELEN 32
 
include/linux/netfilter/xt_CLASSIFY.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_CLASSIFY.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_CLASSIFY_H
 #define _XT_CLASSIFY_H
 
+/* @headercheck:-include linux/types.h @ */
+
 struct xt_classify_target_info {
 	u_int32_t priority;
 };
include/linux/netfilter/xt_CONNMARK.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_CONNMARK.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_CONNMARK_H_target
 #define _XT_CONNMARK_H_target
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
  * by Henrik Nordstrom <[email protected]>
  *
include/linux/netfilter/xt_MARK.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_MARK.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_MARK_H_target
 #define _XT_MARK_H_target
 
+/* @headercheck:-include sys/types.h@ */
+
 /* Version 0 */
 struct xt_mark_target_info {
 	unsigned long mark;
include/linux/netfilter/xt_NFQUEUE.h +3 -2
Index: linux-cg/include/linux/netfilter/xt_NFQUEUE.h
===================================================================
@@ -3,8 +3,9 @@
  * (C) 2005 Harald Welte <[email protected]>
  *
  * This software is distributed under GNU GPL v2, 1991
- * 
-*/
+ *
+ */
+/* @headercheck:-include linux/types.h@ */
 #ifndef _XT_NFQ_TARGET_H
 #define _XT_NFQ_TARGET_H
 
include/linux/netfilter/xt_connbytes.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_connbytes.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_CONNBYTES_H
 #define _XT_CONNBYTES_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum xt_connbytes_what {
 	XT_CONNBYTES_PKTS,
 	XT_CONNBYTES_BYTES,
include/linux/netfilter/xt_connmark.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_connmark.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_CONNMARK_H
 #define _XT_CONNMARK_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
  * by Henrik Nordstrom <[email protected]>
  *
include/linux/netfilter/xt_dccp.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_dccp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_DCCP_H_
 #define _XT_DCCP_H_
 
+/* @headercheck:-include linux/types.h@ */
+
 #define XT_DCCP_SRC_PORTS	        0x01
 #define XT_DCCP_DEST_PORTS	        0x02
 #define XT_DCCP_TYPE			0x04
include/linux/netfilter/xt_esp.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_esp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_ESP_H
 #define _XT_ESP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct xt_esp
 {
 	u_int32_t spis[2];	/* Security Parameter Index */
include/linux/netfilter/xt_length.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_length.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_LENGTH_H
 #define _XT_LENGTH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct xt_length_info {
     u_int16_t	min, max;
     u_int8_t	invert;
include/linux/netfilter/xt_limit.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_limit.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_RATE_H
 #define _XT_RATE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* timings are in milliseconds. */
 #define XT_LIMIT_SCALE 10000
 
include/linux/netfilter/xt_mac.h +3 -0
Index: linux-cg/include/linux/netfilter/xt_mac.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _XT_MAC_H
 #define _XT_MAC_H
 
+/* @headercheck:-include linux/types.h @ */
+/* @headercheck:-include linux/if_ether.h @ */
+
 struct xt_mac_info {
     unsigned char srcaddr[ETH_ALEN];
     int invert;
include/linux/netfilter/xt_mark.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_mark.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_MARK_H
 #define _XT_MARK_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct xt_mark_info {
     unsigned long mark, mask;
     u_int8_t invert;
include/linux/netfilter/xt_multiport.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_multiport.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_MULTIPORT_H
 #define _XT_MULTIPORT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum xt_multiport_flags
 {
 	XT_MULTIPORT_SOURCE,
include/linux/netfilter/xt_physdev.h +4 -1
Index: linux-cg/include/linux/netfilter/xt_physdev.h
===================================================================
@@ -1,7 +1,10 @@
 #ifndef _XT_PHYSDEV_H
 #define _XT_PHYSDEV_H
 
-#ifdef __KERNEL__
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if.h@ */
+
+#ifdef __KERNEL
 #include <linux/if.h>
 #endif
 
include/linux/netfilter/xt_policy.h +4 -0
Index: linux-cg/include/linux/netfilter/xt_policy.h
===================================================================
@@ -1,6 +1,10 @@
 #ifndef _XT_POLICY_H
 #define _XT_POLICY_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/in.h@ */
+/* @headercheck:-include linux/in6.h@ */
+
 #define XT_POLICY_MAX_ELEM	4
 
 enum xt_policy_flags
include/linux/netfilter/xt_realm.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_realm.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_REALM_H
 #define _XT_REALM_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct xt_realm_info {
 	u_int32_t id;
 	u_int32_t mask;
include/linux/netfilter/xt_sctp.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_sctp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_SCTP_H_
 #define _XT_SCTP_H_
 
+/* @headercheck:-include linux/types.h@ */
+
 #define XT_SCTP_SRC_PORTS	        0x01
 #define XT_SCTP_DEST_PORTS	        0x02
 #define XT_SCTP_CHUNK_TYPES		0x04
include/linux/netfilter/xt_string.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_string.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_STRING_H
 #define _XT_STRING_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define XT_STRING_MAX_PATTERN_SIZE 128
 #define XT_STRING_MAX_ALGO_NAME_SIZE 16
 
include/linux/netfilter/xt_tcpmss.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_tcpmss.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_TCPMSS_MATCH_H
 #define _XT_TCPMSS_MATCH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct xt_tcpmss_match_info {
     u_int16_t mss_min, mss_max;
     u_int8_t invert;
include/linux/netfilter/xt_tcpudp.h +2 -0
Index: linux-cg/include/linux/netfilter/xt_tcpudp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _XT_TCPUDP_H
 #define _XT_TCPUDP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* TCP matching stuff */
 struct xt_tcp
 {
include/linux/netfilter_arp/arp_tables.h +5 -1
Index: linux-cg/include/linux/netfilter_arp/arp_tables.h
===================================================================
@@ -9,10 +9,14 @@
 #ifndef _ARPTABLES_H
 #define _ARPTABLES_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/if.h @ */
+/* @headercheck: -include linux/in.h @ */
+
 #ifdef __KERNEL__
 #include <linux/if.h>
-#include <linux/types.h>
 #include <linux/in.h>
+#include <linux/types.h>
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #endif
include/linux/netfilter_arp/arpt_mangle.h +5 -0
Index: linux-cg/include/linux/netfilter_arp/arpt_mangle.h
===================================================================
@@ -1,5 +1,10 @@
 #ifndef _ARPT_MANGLE_H
 #define _ARPT_MANGLE_H
+
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/in.h @ */
+/* @headercheck: -include linux/if.h @ */
+
 #include <linux/netfilter_arp/arp_tables.h>
 
 #define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr)
include/linux/netfilter_bridge.h +3 -1
Index: linux-cg/include/linux/netfilter_bridge.h
===================================================================
@@ -5,9 +5,11 @@
  */
 
 #include <linux/netfilter.h>
-#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER)
+#ifdef __KERNEL__
+#ifdef CONFIG_BRIDGE_NETFILTER
 #include <linux/if_ether.h>
 #endif
+#endif
 
 /* Bridge Hooks */
 /* After promisc drops, checksum checks. */
include/linux/netfilter_bridge/ebt_802_3.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_802_3.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_802_3_H
 #define __LINUX_BRIDGE_EBT_802_3_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_802_3_SAP 0x01
 #define EBT_802_3_TYPE 0x02
 
include/linux/netfilter_bridge/ebt_among.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_among.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_AMONG_H
 #define __LINUX_BRIDGE_EBT_AMONG_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_AMONG_DST 0x01
 #define EBT_AMONG_SRC 0x02
 
include/linux/netfilter_bridge/ebt_arp.h +3 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_arp.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef __LINUX_BRIDGE_EBT_ARP_H
 #define __LINUX_BRIDGE_EBT_ARP_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/if_ether.h @ */
+
 #define EBT_ARP_OPCODE 0x01
 #define EBT_ARP_HTYPE 0x02
 #define EBT_ARP_PTYPE 0x04
include/linux/netfilter_bridge/ebt_arpreply.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_arpreply.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H
 #define __LINUX_BRIDGE_EBT_ARPREPLY_H
 
+/* @headercheck:-include linux/if_ether.h@ */
+
 struct ebt_arpreply_info
 {
 	unsigned char mac[ETH_ALEN];
include/linux/netfilter_bridge/ebt_ip.h +1 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_ip.h
===================================================================
@@ -11,6 +11,7 @@
  *    Innominate Security Technologies AG <[email protected]>
  *    September, 2002
  */
+/* @headercheck:-include linux/if_ether.h@ */
 
 #ifndef __LINUX_BRIDGE_EBT_IP_H
 #define __LINUX_BRIDGE_EBT_IP_H
include/linux/netfilter_bridge/ebt_limit.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_limit.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_LIMIT_H
 #define __LINUX_BRIDGE_EBT_LIMIT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_LIMIT_MATCH "limit"
 
 /* timings are in milliseconds. */
include/linux/netfilter_bridge/ebt_log.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_log.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_LOG_H
 #define __LINUX_BRIDGE_EBT_LOG_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
 #define EBT_LOG_ARP 0x02
 #define EBT_LOG_NFLOG 0x04
include/linux/netfilter_bridge/ebt_mark_m.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_mark_m.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_MARK_M_H
 #define __LINUX_BRIDGE_EBT_MARK_M_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_MARK_AND 0x01
 #define EBT_MARK_OR 0x02
 #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
include/linux/netfilter_bridge/ebt_nat.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_nat.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_NAT_H
 #define __LINUX_BRIDGE_EBT_NAT_H
 
+/* @headercheck: -include linux/if_ether.h @ */
+
 struct ebt_nat_info
 {
 	unsigned char mac[ETH_ALEN];
include/linux/netfilter_bridge/ebt_pkttype.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_pkttype.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
 #define __LINUX_BRIDGE_EBT_PKTTYPE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ebt_pkttype_info
 {
 	uint8_t pkt_type;
include/linux/netfilter_bridge/ebt_stp.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_stp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_STP_H
 #define __LINUX_BRIDGE_EBT_STP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_STP_TYPE		0x0001
 
 #define EBT_STP_FLAGS		0x0002
include/linux/netfilter_bridge/ebt_ulog.h +4 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_ulog.h
===================================================================
@@ -1,6 +1,10 @@
 #ifndef _EBT_ULOG_H
 #define _EBT_ULOG_H
 
+/* @headercheck: -include linux/types.h @ */
+/* @headercheck: -include linux/if.h    @ */
+/* @headercheck: -include linux/time.h  @ */
+
 #define EBT_ULOG_DEFAULT_NLGROUP 0
 #define EBT_ULOG_DEFAULT_QTHRESHOLD 1
 #define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
include/linux/netfilter_bridge/ebt_vlan.h +2 -0
Index: linux-cg/include/linux/netfilter_bridge/ebt_vlan.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_VLAN_H
 #define __LINUX_BRIDGE_EBT_VLAN_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define EBT_VLAN_ID	0x01
 #define EBT_VLAN_PRIO	0x02
 #define EBT_VLAN_ENCAP	0x04
include/linux/netfilter_decnet.h +1 -0
Index: linux-cg/include/linux/netfilter_decnet.h
===================================================================
@@ -7,6 +7,7 @@
  * (C)1998 Rusty Russell -- This code is GPL.
  */
 
+/* @headercheck: -include limits.h @ */
 #include <linux/netfilter.h>
 
 /* only for userspace compatibility */
include/linux/netfilter_ipv4.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4.h
===================================================================
@@ -9,6 +9,8 @@
 
 /* only for userspace compatibility */
 #ifndef __KERNEL__
+#include <limits.h>
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_IP_SRC		0x0001
include/linux/netfilter_ipv4/Kbuild +4 -4
Index: linux-cg/include/linux/netfilter_ipv4/Kbuild
===================================================================
@@ -1,8 +1,7 @@
 
-header-y := ip_conntrack_helper.h ip_conntrack_helper_h323_asn1.h	\
-	    ip_conntrack_helper_h323_types.h ip_conntrack_protocol.h	\
+header-y := ip_conntrack_helper_h323_types.h				\
 	    ip_conntrack_sctp.h ip_conntrack_tcp.h ip_conntrack_tftp.h	\
-	    ip_nat_pptp.h ipt_addrtype.h ipt_ah.h	\
+	    ip_nat_pptp.h ipt_addrtype.h ipt_ah.h			\
 	    ipt_CLASSIFY.h ipt_CLUSTERIP.h ipt_comment.h		\
 	    ipt_connbytes.h ipt_connmark.h ipt_CONNMARK.h		\
 	    ipt_conntrack.h ipt_dccp.h ipt_dscp.h ipt_DSCP.h ipt_ecn.h	\
@@ -15,7 +14,8 @@
 	    ipt_TCPMSS.h ipt_tos.h ipt_TOS.h ipt_ttl.h ipt_TTL.h	\
 	    ipt_ULOG.h
 
-unifdef-y := ip_conntrack.h ip_conntrack_h323.h ip_conntrack_irc.h	\
+unifdef-y := ip_conntrack.h ip_conntrack_h323.h				\
+	ip_conntrack_helper_h323_asn1.h	ip_conntrack_irc.h		\
 	ip_conntrack_pptp.h ip_conntrack_proto_gre.h			\
 	ip_conntrack_tuple.h ip_nat.h ip_nat_rule.h ip_queue.h		\
 	ip_tables.h
include/linux/netfilter_ipv4/ip_conntrack_helper.h +1 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_conntrack_helper.h
===================================================================
@@ -1,4 +1,5 @@
 /* IP connection tracking helpers. */
+
 #ifndef _IP_CONNTRACK_HELPER_H
 #define _IP_CONNTRACK_HELPER_H
 #include <linux/netfilter_ipv4/ip_conntrack.h>
include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
===================================================================
@@ -85,6 +85,7 @@
 #define H323_ERROR_RANGE -2
 
 
+#ifdef __KERNEL__
 /*****************************************************************************
  * Decode Functions
  ****************************************************************************/
@@ -94,5 +95,6 @@
 int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
 					 MultimediaSystemControlMessage *
 					 mscm);
+#endif /* __KERNEL__ */
 
 #endif
include/linux/netfilter_ipv4/ip_conntrack_pptp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
===================================================================
@@ -2,6 +2,8 @@
 #ifndef _CONNTRACK_PPTP_H
 #define _CONNTRACK_PPTP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* state of the control session */
 enum pptp_ctrlsess_state {
 	PPTP_SESSION_NONE,			/* no session present */
include/linux/netfilter_ipv4/ip_conntrack_sctp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP_CONNTRACK_SCTP_H
 #define _IP_CONNTRACK_SCTP_H
 
+/* @headercheck:-include linux/types.h @ */
+
 #include <linux/netfilter/nf_conntrack_sctp.h>
 
 #endif /* _IP_CONNTRACK_SCTP_H */
include/linux/netfilter_ipv4/ip_conntrack_tftp.h +4 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP_CT_TFTP
 #define _IP_CT_TFTP
 
+/* @headercheck:-include linux/types.h @ */
+
 #define TFTP_PORT 69
 
 struct tftphdr {
@@ -13,8 +15,10 @@
 #define TFTP_OPCODE_ACK		4
 #define TFTP_OPCODE_ERROR	5
 
+#ifdef __KERNEL__
 extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb,
 				 enum ip_conntrack_info ctinfo,
 				 struct ip_conntrack_expect *exp);
+#endif
 
 #endif /* _IP_CT_TFTP */
include/linux/netfilter_ipv4/ip_nat.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_nat.h
===================================================================
@@ -1,5 +1,8 @@
 #ifndef _IP_NAT_H
 #define _IP_NAT_H
+
+/* @headercheck: -include linux/types.h @ */
+
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
 
include/linux/netfilter_ipv4/ip_nat_pptp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_nat_pptp.h
===================================================================
@@ -2,6 +2,8 @@
 #ifndef _NAT_PPTP_H
 #define _NAT_PPTP_H
 
+/* @headercheck:-include linux/types.h @ */
+
 /* conntrack private data */
 struct ip_nat_pptp {
 	u_int16_t pns_call_id;		/* NAT'ed PNS call id */
include/linux/netfilter_ipv4/ip_nat_rule.h +5 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_nat_rule.h
===================================================================
@@ -1,5 +1,10 @@
 #ifndef _IP_NAT_RULE_H
 #define _IP_NAT_RULE_H
+
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if.h@ */
+/* @headercheck:-include linux/in.h@ */
+
 #include <linux/netfilter_ipv4/ip_conntrack.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ip_nat.h>
include/linux/netfilter_ipv4/ip_tables.h +4 -0
Index: linux-cg/include/linux/netfilter_ipv4/ip_tables.h
===================================================================
@@ -15,6 +15,10 @@
 #ifndef _IPTABLES_H
 #define _IPTABLES_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if.h@ */
+/* @headercheck:-include linux/in.h@ */
+
 #ifdef __KERNEL__
 #include <linux/if.h>
 #include <linux/types.h>
include/linux/netfilter_ipv4/ipt_CLASSIFY.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_CLASSIFY_H
 #define _IPT_CLASSIFY_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_CLASSIFY.h>
 #define ipt_classify_target_info xt_classify_target_info
 
include/linux/netfilter_ipv4/ipt_CLUSTERIP.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_CLUSTERIP_H_target
 #define _IPT_CLUSTERIP_H_target
 
+/* @headercheck:-include linux/types.h @ */
+
 enum clusterip_hashmode {
     CLUSTERIP_HASHMODE_SIP = 0,
     CLUSTERIP_HASHMODE_SIP_SPT,
include/linux/netfilter_ipv4/ipt_CONNMARK.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_CONNMARK.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_CONNMARK_H_target
 #define _IPT_CONNMARK_H_target
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
  * by Henrik Nordstrom <[email protected]>
  *
include/linux/netfilter_ipv4/ipt_DSCP.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_DSCP.h
===================================================================
@@ -8,6 +8,9 @@
  *
  * ipt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
 */
+
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IPT_DSCP_TARGET_H
 #define _IPT_DSCP_TARGET_H
 #include <linux/netfilter_ipv4/ipt_dscp.h>
include/linux/netfilter_ipv4/ipt_ECN.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_ECN.h
===================================================================
@@ -6,6 +6,9 @@
  * 
  * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp
 */
+
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IPT_ECN_TARGET_H
 #define _IPT_ECN_TARGET_H
 #include <linux/netfilter_ipv4/ipt_DSCP.h>
include/linux/netfilter_ipv4/ipt_MARK.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_MARK.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_MARK_H_target
 #define _IPT_MARK_H_target
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Backwards compatibility for old userspace */
 
 #include <linux/netfilter/xt_MARK.h>
include/linux/netfilter_ipv4/ipt_NFQUEUE.h +5 -2
Index: linux-cg/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
===================================================================
@@ -3,8 +3,11 @@
  * (C) 2005 Harald Welte <[email protected]>
  *
  * This software is distributed under GNU GPL v2, 1991
- * 
-*/
+ *
+ */
+
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IPT_NFQ_TARGET_H
 #define _IPT_NFQ_TARGET_H
 
include/linux/netfilter_ipv4/ipt_SAME.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_SAME.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _IPT_SAME_H
 #define _IPT_SAME_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/netfilter_ipv4/ip_nat.h@ */
+
 #define IPT_SAME_MAX_RANGE	10
 
 #define IPT_SAME_NODST		0x01
include/linux/netfilter_ipv4/ipt_TCPMSS.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_TCPMSS.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_TCPMSS_H
 #define _IPT_TCPMSS_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ipt_tcpmss_info {
 	u_int16_t mss;
 };
include/linux/netfilter_ipv4/ipt_TOS.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_TOS.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_TOS_H_target
 #define _IPT_TOS_H_target
 
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef IPTOS_NORMALSVC
 #define IPTOS_NORMALSVC 0
 #endif
include/linux/netfilter_ipv4/ipt_TTL.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_TTL.h
===================================================================
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum {
 	IPT_TTL_SET = 0,
 	IPT_TTL_INC,
include/linux/netfilter_ipv4/ipt_ULOG.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_ULOG.h
===================================================================
@@ -4,6 +4,9 @@
  * 
  * Distributed under the terms of GNU GPL */
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if.h@ */
+
 #ifndef _IPT_ULOG_H
 #define _IPT_ULOG_H
 
include/linux/netfilter_ipv4/ipt_addrtype.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_addrtype.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_ADDRTYPE_H
 #define _IPT_ADDRTYPE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ipt_addrtype_info {
 	u_int16_t	source;		/* source-type mask */
 	u_int16_t	dest;		/* dest-type mask */
include/linux/netfilter_ipv4/ipt_ah.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_ah.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_AH_H
 #define _IPT_AH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ipt_ah
 {
 	u_int32_t spis[2];			/* Security Parameter Index */
include/linux/netfilter_ipv4/ipt_connbytes.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_connbytes.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_CONNBYTES_H
 #define _IPT_CONNBYTES_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_connbytes.h>
 #define ipt_connbytes_what xt_connbytes_what
 
include/linux/netfilter_ipv4/ipt_connmark.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_connmark.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_CONNMARK_H
 #define _IPT_CONNMARK_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_connmark.h>
 #define ipt_connmark_info xt_connmark_info
 
include/linux/netfilter_ipv4/ipt_dccp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_dccp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_DCCP_H_
 #define _IPT_DCCP_H_
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_dccp.h>
 #define IPT_DCCP_SRC_PORTS	XT_DCCP_SRC_PORTS
 #define IPT_DCCP_DEST_PORTS	XT_DCCP_DEST_PORTS
include/linux/netfilter_ipv4/ipt_dscp.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_dscp.h
===================================================================
@@ -7,6 +7,9 @@
  *
  * ipt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
 */
+
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IPT_DSCP_H
 #define _IPT_DSCP_H
 
include/linux/netfilter_ipv4/ipt_ecn.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_ecn.h
===================================================================
@@ -6,6 +6,8 @@
  * 
  * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
 */
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IPT_ECN_H
 #define _IPT_ECN_H
 #include <linux/netfilter_ipv4/ipt_dscp.h>
include/linux/netfilter_ipv4/ipt_esp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_esp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_ESP_H
 #define _IPT_ESP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_esp.h>
 
 #define ipt_esp xt_esp
include/linux/netfilter_ipv4/ipt_hashlimit.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_hashlimit.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _IPT_HASHLIMIT_H
 #define _IPT_HASHLIMIT_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if.h@ */
+
 /* timings are in milliseconds. */
 #define IPT_HASHLIMIT_SCALE 10000
 /* 1/10,000 sec period => max of 10,000/sec.  Min rate is then 429490
include/linux/netfilter_ipv4/ipt_iprange.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_iprange.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_IPRANGE_H
 #define _IPT_IPRANGE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define IPRANGE_SRC		0x01	/* Match source IP address */
 #define IPRANGE_DST		0x02	/* Match destination IP address */
 #define IPRANGE_SRC_INV		0x10	/* Negate the condition */
include/linux/netfilter_ipv4/ipt_length.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_length.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_LENGTH_H
 #define _IPT_LENGTH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_length.h>
 #define ipt_length_info xt_length_info
 
include/linux/netfilter_ipv4/ipt_limit.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_limit.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_RATE_H
 #define _IPT_RATE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_limit.h>
 #define IPT_LIMIT_SCALE XT_LIMIT_SCALE
 #define ipt_rateinfo xt_rateinfo
include/linux/netfilter_ipv4/ipt_mac.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_mac.h
===================================================================
@@ -1,6 +1,9 @@
 #ifndef _IPT_MAC_H
 #define _IPT_MAC_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/if_ether.h@ */
+
 #include <linux/netfilter/xt_mac.h>
 #define ipt_mac_info xt_mac_info
 
include/linux/netfilter_ipv4/ipt_mark.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_mark.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_MARK_H
 #define _IPT_MARK_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Backwards compatibility for old userspace */
 #include <linux/netfilter/xt_mark.h>
 
include/linux/netfilter_ipv4/ipt_multiport.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_multiport.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_MULTIPORT_H
 #define _IPT_MULTIPORT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_multiport.h>
 
 #define IPT_MULTIPORT_SOURCE		XT_MULTIPORT_SOURCE
include/linux/netfilter_ipv4/ipt_owner.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_owner.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_OWNER_H
 #define _IPT_OWNER_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* match and invert flags */
 #define IPT_OWNER_UID	0x01
 #define IPT_OWNER_GID	0x02
include/linux/netfilter_ipv4/ipt_realm.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_realm.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_REALM_H
 #define _IPT_REALM_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_realm.h>
 #define ipt_realm_info xt_realm_info
 
include/linux/netfilter_ipv4/ipt_recent.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_recent.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_RECENT_H
 #define _IPT_RECENT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define RECENT_NAME	"ipt_recent"
 #define RECENT_VER	"v0.3.1"
 
include/linux/netfilter_ipv4/ipt_sctp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_sctp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_SCTP_H_
 #define _IPT_SCTP_H_
 
+/* @headercheck:-include linux/types.h@ */
+
 #define IPT_SCTP_SRC_PORTS	        0x01
 #define IPT_SCTP_DEST_PORTS	        0x02
 #define IPT_SCTP_CHUNK_TYPES		0x04
include/linux/netfilter_ipv4/ipt_string.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_string.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_STRING_H
 #define _IPT_STRING_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_string.h>
 
 #define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
include/linux/netfilter_ipv4/ipt_tcpmss.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_tcpmss.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_TCPMSS_MATCH_H
 #define _IPT_TCPMSS_MATCH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_tcpmss.h>
 #define ipt_tcpmss_match_info xt_tcpmss_match_info
 
include/linux/netfilter_ipv4/ipt_tos.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_tos.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IPT_TOS_H
 #define _IPT_TOS_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ipt_tos_info {
     u_int8_t tos;
     u_int8_t invert;
include/linux/netfilter_ipv4/ipt_ttl.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv4/ipt_ttl.h
===================================================================
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum {
 	IPT_TTL_EQ = 0,		/* equals */
 	IPT_TTL_NE,		/* not equals */
include/linux/netfilter_ipv6.h +3 -0
Index: linux-cg/include/linux/netfilter_ipv6.h
===================================================================
@@ -8,6 +8,7 @@
  *   it's amazing what adding a bunch of 6s can do =8^)
  */
 
+/* @headercheck: -include limits.h @ */
 #include <linux/netfilter.h>
 
 /* only for userspace compatibility */
@@ -72,6 +73,7 @@
 	NF_IP6_PRI_LAST = INT_MAX,
 };
 
+#ifdef __KERNEL__
 #ifdef CONFIG_NETFILTER
 extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
 				    unsigned int dataoff, u_int8_t protocol);
@@ -82,5 +84,6 @@
 static inline int ipv6_netfilter_init(void) { return 0; }
 static inline void ipv6_netfilter_fini(void) { return; }
 #endif /* CONFIG_NETFILTER */
+#endif
 
 #endif /*__LINUX_IP6_NETFILTER_H*/
include/linux/netfilter_ipv6/ip6_tables.h +5 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6_tables.h
===================================================================
@@ -15,6 +15,11 @@
 #ifndef _IP6_TABLES_H
 #define _IP6_TABLES_H
 
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/in6.h@ */
+/* @headercheck:-include linux/if.h@ */
+/* @headercheck:-include limits.h@ */
+
 #ifdef __KERNEL__
 #include <linux/if.h>
 #include <linux/types.h>
include/linux/netfilter_ipv6/ip6t_HL.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_HL.h
===================================================================
@@ -2,6 +2,8 @@
  * Maciej Soltysiak <[email protected]>
  * Based on HW's TTL module */
 
+/* @headercheck:-include linux/types.h@ */
+
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
include/linux/netfilter_ipv6/ip6t_MARK.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_MARK.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_MARK_H_target
 #define _IP6T_MARK_H_target
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Backwards compatibility for old userspace */
 #include <linux/netfilter/xt_MARK.h>
 
include/linux/netfilter_ipv6/ip6t_REJECT.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_REJECT.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_REJECT_H
 #define _IP6T_REJECT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum ip6t_reject_with {
 	IP6T_ICMP6_NO_ROUTE,
 	IP6T_ICMP6_ADM_PROHIBITED,
include/linux/netfilter_ipv6/ip6t_ah.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_ah.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_AH_H
 #define _IP6T_AH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ip6t_ah
 {
 	u_int32_t spis[2];			/* Security Parameter Index */
include/linux/netfilter_ipv6/ip6t_esp.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_esp.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_ESP_H
 #define _IP6T_ESP_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_esp.h>
 
 #define ip6t_esp xt_esp
include/linux/netfilter_ipv6/ip6t_frag.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_frag.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_FRAG_H
 #define _IP6T_FRAG_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ip6t_frag
 {
 	u_int32_t ids[2];			/* Security Parameter Index */
include/linux/netfilter_ipv6/ip6t_hl.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_hl.h
===================================================================
@@ -5,6 +5,8 @@
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
+/* @headercheck:-include linux/types.h@ */
+
 enum {
 	IP6T_HL_EQ = 0,		/* equals */
 	IP6T_HL_NE,		/* not equals */
include/linux/netfilter_ipv6/ip6t_ipv6header.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_ipv6header.h
===================================================================
@@ -8,6 +8,8 @@
 #ifndef __IPV6HEADER_H
 #define __IPV6HEADER_H
 
+/* @headercheck:-include linux/types.h@ */
+
 struct ip6t_ipv6header_info
 {
 	u_int8_t matchflags;
include/linux/netfilter_ipv6/ip6t_length.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_length.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_LENGTH_H
 #define _IP6T_LENGTH_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_length.h>
 #define ip6t_length_info xt_length_info
 
include/linux/netfilter_ipv6/ip6t_limit.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_limit.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_RATE_H
 #define _IP6T_RATE_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_limit.h>
 #define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
 #define ip6t_rateinfo xt_rateinfo
include/linux/netfilter_ipv6/ip6t_mac.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_mac.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_MAC_H
 #define _IP6T_MAC_H
 
+/* @headercheck:-include linux/if_ether.h@ */
+
 #include <linux/netfilter/xt_mac.h>
 #define ip6t_mac_info xt_mac_info
 
include/linux/netfilter_ipv6/ip6t_mark.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_mark.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_MARK_H
 #define _IP6T_MARK_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* Backwards compatibility for old userspace */
 #include <linux/netfilter/xt_mark.h>
 
include/linux/netfilter_ipv6/ip6t_multiport.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_multiport.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_MULTIPORT_H
 #define _IP6T_MULTIPORT_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #include <linux/netfilter/xt_multiport.h>
 
 #define IP6T_MULTIPORT_SOURCE		XT_MULTIPORT_SOURCE
include/linux/netfilter_ipv6/ip6t_opts.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_opts.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_OPTS_H
 #define _IP6T_OPTS_H
 
+/* @headercheck:-include linux/types.h@ */
+
 #define IP6T_OPTS_OPTSNR 16
 
 struct ip6t_opts
include/linux/netfilter_ipv6/ip6t_owner.h +2 -0
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_owner.h
===================================================================
@@ -1,6 +1,8 @@
 #ifndef _IP6T_OWNER_H
 #define _IP6T_OWNER_H
 
+/* @headercheck:-include linux/types.h@ */
+
 /* match and invert flags */
 #define IP6T_OWNER_UID	0x01
 #define IP6T_OWNER_GID	0x02
include/linux/netfilter_ipv6/ip6t_rt.h +2 -1
Index: linux-cg/include/linux/netfilter_ipv6/ip6t_rt.h
===================================================================
@@ -1,7 +1,8 @@
 #ifndef _IP6T_RT_H
 #define _IP6T_RT_H
 
-/*#include <linux/in6.h>*/
+/* @headercheck:-include linux/types.h@ */
+/* @headercheck:-include linux/in6.h@ */
 
 #define IP6T_RT_HOPS 16
 

--

maintainer
#39 lore raw
Quoted 9 lines · David Woodhouse

Basically all but PowerPC and i386 have problems; and the latter works only if you apply the patches I sent to Linus a few days ago.

This is just a basic check that the headers which _are_ exported don't try to include other headers which aren't. This can happen either because the former should not, or the latter _should_ be exported. Mostly, however, the solution is just to make sure the latter is included only within #ifdef __KERNEL__, because it's only needed within that ifdef anyway.

I have extended that script somewhat to check for more problems, and fixed a number of problems in the process.

The bad news is that with this extended script, there will be even more work for each architecture maintainer to make it check without warnings.

	Arnd <><