Skip to contentSkip to conversation

linux/kernel.h userspace header cleanup

PATCH In review Adrian Bunk 2 participants 2 messages Jun 23, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/kernel.h userspace header cleanup

Nothing from the bottom of this header is part of the kernel<->userspace ABI.

---

 include/linux/kernel.h |    4 ++++
 1 file changed, 4 insertions(+)

c023fd63795380bceef9abc92c1d6fca91791de7 diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 792bf0a..2993b80 100644

include/linux/kernel.h +4 -0
@@ -487,6 +487,8 @@ struct sysinfo {
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
+#ifdef __KERNEL__
+
 /* Force a compilation error if condition is true */
 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
 
@@ -506,4 +508,6 @@ struct sysinfo {
 #define NUMA_BUILD 0
 #endif
 
+#endif  /*  __KERNEL__  */
+
 #endif
#1 lore raw
Quoted 24 lines · On Mon, 23 Jun 2008 20:49:40 +0300 Adrian Bunk <[email protected]> wrote:

Nothing from the bottom of this header is part of the kernel<->userspace ABI.

---

 include/linux/kernel.h |    4 ++++
 1 file changed, 4 insertions(+)

c023fd63795380bceef9abc92c1d6fca91791de7 diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 792bf0a..2993b80 100644

include/linux/kernel.h +2 -0
@@ -487,6 +487,8 @@ struct sysinfo {
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
+#ifdef __KERNEL__
+
 /* Force a compilation error if condition is true */
 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
 

include/linux/kernel.h struct sysinfo { · line 513

Quoted 6 lines
include/linux/kernel.h +2 -0
@@ -506,4 +508,6 @@ struct sysinfo {
 #define NUMA_BUILD 0
 #endif
 
+#endif  /*  __KERNEL__  */
+
 #endif

Patches against linux-next would be better, especially during late -rc. There's a 25MB diff between that and mainline.

I see no need to add an additional ifdef block here - better to move the new kernel-only code to be inside the existing guards?

 include/linux/kernel.h |   42 ++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 20 deletions(-)
include/linux/kernel.h renamed from include/linux/kernel.h~linux-kernelh-userspace-header-cleanup +22 -20
diff -puN include/linux/kernel.h~linux-kernelh-userspace-header-cleanup include/linux/kernel.h
@@ -442,26 +442,6 @@ static inline char *pack_hex_byte(char *
 struct sysinfo;
 extern int do_sysinfo(struct sysinfo *info);
 
-#endif /* __KERNEL__ */
-
-#define SI_LOAD_SHIFT	16
-struct sysinfo {
-	long uptime;			/* Seconds since boot */
-	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
-	unsigned long totalram;		/* Total usable main memory size */
-	unsigned long freeram;		/* Available memory size */
-	unsigned long sharedram;	/* Amount of shared memory */
-	unsigned long bufferram;	/* Memory used by buffers */
-	unsigned long totalswap;	/* Total swap space size */
-	unsigned long freeswap;		/* swap space still available */
-	unsigned short procs;		/* Number of current processes */
-	unsigned short pad;		/* explicit padding for m68k */
-	unsigned long totalhigh;	/* Total high memory size */
-	unsigned long freehigh;		/* Available high memory size */
-	unsigned int mem_unit;		/* Memory unit size in bytes */
-	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
-};
-
 /* Force a compilation error if condition is true */
 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
 
@@ -516,4 +496,26 @@ struct sysinfo {
 	__typesafe_cb(rettype (*)(__VA_ARGS__, void *), (fn),		\
 		      rettype (*)(__VA_ARGS__, const typeof(arg)),	\
 		      rettype (*)(__VA_ARGS__, typeof(arg)))
+
+
+#endif /* __KERNEL__ */
+
+#define SI_LOAD_SHIFT	16
+struct sysinfo {
+	long uptime;			/* Seconds since boot */
+	unsigned long loads[3];		/* 1, 5, and 15 minute load averages */
+	unsigned long totalram;		/* Total usable main memory size */
+	unsigned long freeram;		/* Available memory size */
+	unsigned long sharedram;	/* Amount of shared memory */
+	unsigned long bufferram;	/* Memory used by buffers */
+	unsigned long totalswap;	/* Total swap space size */
+	unsigned long freeswap;		/* swap space still available */
+	unsigned short procs;		/* Number of current processes */
+	unsigned short pad;		/* explicit padding for m68k */
+	unsigned long totalhigh;	/* Total high memory size */
+	unsigned long freehigh;		/* Available high memory size */
+	unsigned int mem_unit;		/* Memory unit size in bytes */
+	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
+};
+
 #endif

_