Re: [2.6 patch] linux/kernel.h userspace header cleanup

From: Andrew Morton
Date: Mon Jun 23 2008 - 19:51:48 EST


On Mon, 23 Jun 2008 20:49:40 +0300
Adrian Bunk <bunk@xxxxxxxxxx> wrote:

> Nothing from the bottom of this header is part of the
> kernel<->userspace ABI.
>
> Signed-off-by: Adrian Bunk <bunk@xxxxxxxxxx>
>
> ---
>
> 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
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -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

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(-)

diff -puN include/linux/kernel.h~linux-kernelh-userspace-header-cleanup include/linux/kernel.h
--- a/include/linux/kernel.h~linux-kernelh-userspace-header-cleanup
+++ a/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
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/