* [Patch] fix a headers_check warning in include/linux/kernel.h
@ 2011-07-17 7:46 Américo Wang
2011-07-18 16:51 ` Arnaud Lacombe
2011-07-18 22:00 ` Arnaud Lacombe
0 siblings, 2 replies; 5+ messages in thread
From: Américo Wang @ 2011-07-17 7:46 UTC (permalink / raw)
To: Michal Marek; +Cc: Andrew Morton, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
This fixes the warning:
linux-2.6/usr/include/linux/kernel.h:65: userspace cannot reference
function or variable defined in the kernel
As Michal noted, BUILD_BUG_ON stuffs should be moved
under #ifdef __KERNEL__.
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
[-- Attachment #2: include-linux-kernel_h-fix-headers-check-warning.diff --]
[-- Type: text/x-patch, Size: 2550 bytes --]
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 953352a..748d004 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -646,29 +646,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
-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.. */
-};
-
#ifdef __CHECKER__
#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
#define BUILD_BUG_ON_ZERO(e) (0)
@@ -714,6 +691,30 @@ extern int __build_bug_on_failed;
#endif
#endif /* __CHECKER__ */
+
+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.. */
+};
+
/* Trap pasters of __FUNCTION__ at compile-time */
#define __FUNCTION__ (__func__)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch] fix a headers_check warning in include/linux/kernel.h
2011-07-17 7:46 [Patch] fix a headers_check warning in include/linux/kernel.h Américo Wang
@ 2011-07-18 16:51 ` Arnaud Lacombe
2011-07-19 6:45 ` Américo Wang
2011-07-18 22:00 ` Arnaud Lacombe
1 sibling, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-07-18 16:51 UTC (permalink / raw)
To: Américo Wang; +Cc: Michal Marek, Andrew Morton, linux-kernel
Hi,
On Sun, Jul 17, 2011 at 3:46 AM, Américo Wang <xiyou.wangcong@gmail.com> wrote:
> This fixes the warning:
>
> linux-2.6/usr/include/linux/kernel.h:65: userspace cannot reference
> function or variable defined in the kernel
>
> As Michal noted, BUILD_BUG_ON stuffs should be moved
> under #ifdef __KERNEL__.
>
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
>
Why not all the other macros below the BUILD_BUG_ON stuff ? E.g. do we
want to export __FUNCTION__ ? NUMA_BUILD ? COMPACTION_BUILD ?
REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD ?
- Arnaud
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch] fix a headers_check warning in include/linux/kernel.h
2011-07-17 7:46 [Patch] fix a headers_check warning in include/linux/kernel.h Américo Wang
2011-07-18 16:51 ` Arnaud Lacombe
@ 2011-07-18 22:00 ` Arnaud Lacombe
2011-07-25 18:25 ` Steven Rostedt
1 sibling, 1 reply; 5+ messages in thread
From: Arnaud Lacombe @ 2011-07-18 22:00 UTC (permalink / raw)
To: Americo Wang, Michal Marek
Cc: linux-kernel, Arnaud Lacombe, Andrew Morton, Rusty Russell,
KOSAKI Motohiro, Christoph Lameter, Mel Gorman, Steven Rostedt
Hi,
For the sake of having a patch ready. I actually did it yesterday but did not
send it then. Cc'ed to the authors of the relevant macros; __FUNCTION__ was
actually exported since ages, but I really do not see why the kernel exports
this macros...
- Arnaud
--
From: Arnaud Lacombe <lacombar@gmail.com>
Subject: linux/kernel.h: hide internal macros
Unexpose to userland the following macros
- BUILD_BUG_ON.*
- __FUNCTION__
- NUMA_BUILD
- COMPACTION_BUILD
- REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
include/linux/kernel.h | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 567a6f7..9a43ad7 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -646,29 +646,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
-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.. */
-};
-
#ifdef __CHECKER__
#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
#define BUILD_BUG_ON_ZERO(e) (0)
@@ -736,4 +713,27 @@ extern int __build_bug_on_failed;
# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
#endif
+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.. */
+};
+
#endif
--
1.7.6.153.g78432
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch] fix a headers_check warning in include/linux/kernel.h
2011-07-18 16:51 ` Arnaud Lacombe
@ 2011-07-19 6:45 ` Américo Wang
0 siblings, 0 replies; 5+ messages in thread
From: Américo Wang @ 2011-07-19 6:45 UTC (permalink / raw)
To: Arnaud Lacombe; +Cc: Michal Marek, Andrew Morton, linux-kernel
On Tue, Jul 19, 2011 at 12:51 AM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Sun, Jul 17, 2011 at 3:46 AM, Américo Wang <xiyou.wangcong@gmail.com> wrote:
>> This fixes the warning:
>>
>> linux-2.6/usr/include/linux/kernel.h:65: userspace cannot reference
>> function or variable defined in the kernel
>>
>> As Michal noted, BUILD_BUG_ON stuffs should be moved
>> under #ifdef __KERNEL__.
>>
>> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
>>
> Why not all the other macros below the BUILD_BUG_ON stuff ? E.g. do we
> want to export __FUNCTION__ ? NUMA_BUILD ? COMPACTION_BUILD ?
> REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD ?
>
Right, certainly we should move them too.
I saw Andrew already merged a delta patch. Thanks to both of you!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch] fix a headers_check warning in include/linux/kernel.h
2011-07-18 22:00 ` Arnaud Lacombe
@ 2011-07-25 18:25 ` Steven Rostedt
0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2011-07-25 18:25 UTC (permalink / raw)
To: Arnaud Lacombe
Cc: Americo Wang, Michal Marek, linux-kernel, Andrew Morton,
Rusty Russell, KOSAKI Motohiro, Christoph Lameter, Mel Gorman
On Mon, 2011-07-18 at 18:00 -0400, Arnaud Lacombe wrote:
> Hi,
>
> For the sake of having a patch ready. I actually did it yesterday but did not
> send it then. Cc'ed to the authors of the relevant macros; __FUNCTION__ was
> actually exported since ages, but I really do not see why the kernel exports
> this macros...
>
> - Arnaud
>
> --
> From: Arnaud Lacombe <lacombar@gmail.com>
> Subject: linux/kernel.h: hide internal macros
>
> Unexpose to userland the following macros
> - BUILD_BUG_ON.*
> - __FUNCTION__
> - NUMA_BUILD
> - COMPACTION_BUILD
> - REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
Acked-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-25 18:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-17 7:46 [Patch] fix a headers_check warning in include/linux/kernel.h Américo Wang
2011-07-18 16:51 ` Arnaud Lacombe
2011-07-19 6:45 ` Américo Wang
2011-07-18 22:00 ` Arnaud Lacombe
2011-07-25 18:25 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).