diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-09-14 15:54:52 +0800 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-14 11:42:10 -0400 |
commit | 05ffa2d02066c2cb169c02d5417308ee8ecab638 (patch) | |
tree | bbb33cdcefe8cb3335d0fc42baddd1d723e879ea /kernel/trace | |
parent | c16de8fd7a608aba8708dd056cf6e4d9462e800a (diff) |
ftrace: add compile-time check on F_printk()
Make sure F_printk() has corrent format and args, and make sure
changes in F_STRUCT() won't break F_printk().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AADF6CC.1060809@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_export.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 4cb29d84d73a..2435d55947e6 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c @@ -23,6 +23,47 @@ #define __field_struct(type, item) #undef __field +#define __field(type, item) type item; + +#undef __field_desc +#define __field_desc(type, container, item) type item; + +#undef __array +#define __array(type, item, size) type item[size]; + +#undef __array_desc +#define __array_desc(type, container, item, size) type item[size]; + +#undef __dynamic_array +#define __dynamic_array(type, item) type item[]; + +#undef F_STRUCT +#define F_STRUCT(args...) args + +#undef F_printk +#define F_printk(fmt, args...) fmt, args + +#undef FTRACE_ENTRY +#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ +struct ____ftrace_##name { \ + tstruct \ +}; \ +static void __used ____ftrace_check_##name(void) \ +{ \ + struct ____ftrace_##name *__entry = NULL; \ + \ + /* force cmpile-time check on F_printk() */ \ + printk(print); \ +} + +#undef FTRACE_ENTRY_DUP +#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \ + FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print)) + +#include "trace_entries.h" + + +#undef __field #define __field(type, item) \ ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ "offset:%zu;\tsize:%zu;\n", \ @@ -88,10 +129,6 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ return ret; \ } -#undef FTRACE_ENTRY_DUP -#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \ - FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print)) - #include "trace_entries.h" |