aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_export.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-09-14 03:54:52 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-09-14 11:42:10 -0400
commit05ffa2d02066c2cb169c02d5417308ee8ecab638 (patch)
treebbb33cdcefe8cb3335d0fc42baddd1d723e879ea /kernel/trace/trace_export.c
parentc16de8fd7a608aba8708dd056cf6e4d9462e800a (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/trace_export.c')
-rw-r--r--kernel/trace/trace_export.c45
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 @@
23#define __field_struct(type, item) 23#define __field_struct(type, item)
24 24
25#undef __field 25#undef __field
26#define __field(type, item) type item;
27
28#undef __field_desc
29#define __field_desc(type, container, item) type item;
30
31#undef __array
32#define __array(type, item, size) type item[size];
33
34#undef __array_desc
35#define __array_desc(type, container, item, size) type item[size];
36
37#undef __dynamic_array
38#define __dynamic_array(type, item) type item[];
39
40#undef F_STRUCT
41#define F_STRUCT(args...) args
42
43#undef F_printk
44#define F_printk(fmt, args...) fmt, args
45
46#undef FTRACE_ENTRY
47#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
48struct ____ftrace_##name { \
49 tstruct \
50}; \
51static void __used ____ftrace_check_##name(void) \
52{ \
53 struct ____ftrace_##name *__entry = NULL; \
54 \
55 /* force cmpile-time check on F_printk() */ \
56 printk(print); \
57}
58
59#undef FTRACE_ENTRY_DUP
60#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
61 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
62
63#include "trace_entries.h"
64
65
66#undef __field
26#define __field(type, item) \ 67#define __field(type, item) \
27 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ 68 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
28 "offset:%zu;\tsize:%zu;\n", \ 69 "offset:%zu;\tsize:%zu;\n", \
@@ -88,10 +129,6 @@ ftrace_format_##name(struct ftrace_event_call *unused, \
88 return ret; \ 129 return ret; \
89} 130}
90 131
91#undef FTRACE_ENTRY_DUP
92#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
93 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
94
95#include "trace_entries.h" 132#include "trace_entries.h"
96 133
97 134