diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-08-19 03:54:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-19 09:02:24 -0400 |
commit | e647d6b314266adb904d4b84973eda0afa856946 (patch) | |
tree | e4f18b57d37a25910b3d19b6c2461f87db0084a3 /kernel/trace/trace_events.c | |
parent | 14be96c9716cb8c46dca94bd890defd7856e0734 (diff) |
tracing/events: Add trace_define_common_fields()
Extract duplicate code. Also prepare for the later patch.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A8BAFB8.1010304@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index af8fb8ebef0b..9c7ecfb3416f 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -62,6 +62,28 @@ err: | |||
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(trace_define_field); | 63 | EXPORT_SYMBOL_GPL(trace_define_field); |
64 | 64 | ||
65 | #define __common_field(type, item) \ | ||
66 | ret = trace_define_field(call, #type, "common_" #item, \ | ||
67 | offsetof(typeof(ent), item), \ | ||
68 | sizeof(ent.item), \ | ||
69 | is_signed_type(type)); \ | ||
70 | if (ret) \ | ||
71 | return ret; | ||
72 | |||
73 | int trace_define_common_fields(struct ftrace_event_call *call) | ||
74 | { | ||
75 | int ret; | ||
76 | struct trace_entry ent; | ||
77 | |||
78 | __common_field(unsigned short, type); | ||
79 | __common_field(unsigned char, flags); | ||
80 | __common_field(unsigned char, preempt_count); | ||
81 | __common_field(int, pid); | ||
82 | __common_field(int, tgid); | ||
83 | |||
84 | return ret; | ||
85 | } | ||
86 | |||
65 | #ifdef CONFIG_MODULES | 87 | #ifdef CONFIG_MODULES |
66 | 88 | ||
67 | static void trace_destroy_fields(struct ftrace_event_call *call) | 89 | static void trace_destroy_fields(struct ftrace_event_call *call) |