diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2009-04-28 04:04:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-29 08:06:03 -0400 |
commit | a118e4d1402f1349fe3d953493e4168a300a752d (patch) | |
tree | bd4c2fccee4528bf7d1536e33218516953904740 /kernel/trace/trace_export.c | |
parent | 30e673b230f9d556eb81ef68a7b1a08c8b3b142c (diff) |
tracing/filters: distinguish between signed and unsigned fields
The new filter comparison ops need to be able to distinguish between
signed and unsigned field types, so add an is_signed flag/param to the
event field struct/trace_define_fields(). Also define a simple macro,
is_signed_type() to determine the signedness at compile time, used in the
trace macros. If the is_signed_type() macro won't work with a specific
type, a new slightly modified version of TRACE_FIELD() called
TRACE_FIELD_SIGN(), allows the signedness to be set explicitly.
[ Impact: extend trace-filter code for new feature ]
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: fweisbec@gmail.com
Cc: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <1240905893.6416.120.camel@tropicana>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_export.c')
-rw-r--r-- | kernel/trace/trace_export.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 0cb1a142c74f..d06cf898dc86 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -50,6 +50,9 @@ extern void __bad_type_size(void); | |||
50 | if (!ret) \ | 50 | if (!ret) \ |
51 | return 0; | 51 | return 0; |
52 | 52 | ||
53 | #undef TRACE_FIELD_SIGN | ||
54 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
55 | TRACE_FIELD(type, item, assign) | ||
53 | 56 | ||
54 | #undef TP_RAW_FMT | 57 | #undef TP_RAW_FMT |
55 | #define TP_RAW_FMT(args...) args | 58 | #define TP_RAW_FMT(args...) args |
@@ -98,6 +101,10 @@ ftrace_format_##call(struct trace_seq *s) \ | |||
98 | #define TRACE_FIELD(type, item, assign)\ | 101 | #define TRACE_FIELD(type, item, assign)\ |
99 | entry->item = assign; | 102 | entry->item = assign; |
100 | 103 | ||
104 | #undef TRACE_FIELD_SIGN | ||
105 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
106 | TRACE_FIELD(type, item, assign) | ||
107 | |||
101 | #undef TP_CMD | 108 | #undef TP_CMD |
102 | #define TP_CMD(cmd...) cmd | 109 | #define TP_CMD(cmd...) cmd |
103 | 110 | ||
@@ -149,7 +156,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
149 | #define TRACE_FIELD(type, item, assign) \ | 156 | #define TRACE_FIELD(type, item, assign) \ |
150 | ret = trace_define_field(event_call, #type, #item, \ | 157 | ret = trace_define_field(event_call, #type, #item, \ |
151 | offsetof(typeof(field), item), \ | 158 | offsetof(typeof(field), item), \ |
152 | sizeof(field.item)); \ | 159 | sizeof(field.item), is_signed_type(type)); \ |
153 | if (ret) \ | 160 | if (ret) \ |
154 | return ret; | 161 | return ret; |
155 | 162 | ||
@@ -157,7 +164,15 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
157 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ | 164 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ |
158 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 165 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
159 | offsetof(typeof(field), item), \ | 166 | offsetof(typeof(field), item), \ |
160 | sizeof(field.item)); \ | 167 | sizeof(field.item), 0); \ |
168 | if (ret) \ | ||
169 | return ret; | ||
170 | |||
171 | #undef TRACE_FIELD_SIGN | ||
172 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
173 | ret = trace_define_field(event_call, #type, #item, \ | ||
174 | offsetof(typeof(field), item), \ | ||
175 | sizeof(field.item), is_signed); \ | ||
161 | if (ret) \ | 176 | if (ret) \ |
162 | return ret; | 177 | return ret; |
163 | 178 | ||
@@ -173,11 +188,11 @@ ftrace_define_fields_##call(void) \ | |||
173 | struct args field; \ | 188 | struct args field; \ |
174 | int ret; \ | 189 | int ret; \ |
175 | \ | 190 | \ |
176 | __common_field(unsigned char, type); \ | 191 | __common_field(unsigned char, type, 0); \ |
177 | __common_field(unsigned char, flags); \ | 192 | __common_field(unsigned char, flags, 0); \ |
178 | __common_field(unsigned char, preempt_count); \ | 193 | __common_field(unsigned char, preempt_count, 0); \ |
179 | __common_field(int, pid); \ | 194 | __common_field(int, pid, 1); \ |
180 | __common_field(int, tgid); \ | 195 | __common_field(int, tgid, 1); \ |
181 | \ | 196 | \ |
182 | tstruct; \ | 197 | tstruct; \ |
183 | \ | 198 | \ |