aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTom Zanussi <tzanussi@gmail.com>2009-04-28 04:04:53 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-29 08:06:03 -0400
commita118e4d1402f1349fe3d953493e4168a300a752d (patch)
treebd4c2fccee4528bf7d1536e33218516953904740 /include
parent30e673b230f9d556eb81ef68a7b1a08c8b3b142c (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 'include')
-rw-r--r--include/linux/ftrace_event.h7
-rw-r--r--include/trace/ftrace.h16
2 files changed, 12 insertions, 11 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 46a27f2695a6..e61a7403f3d0 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -122,8 +122,9 @@ extern int filter_current_check_discard(struct ftrace_event_call *call,
122 struct ring_buffer_event *event); 122 struct ring_buffer_event *event);
123 123
124extern int trace_define_field(struct ftrace_event_call *call, char *type, 124extern int trace_define_field(struct ftrace_event_call *call, char *type,
125 char *name, int offset, int size); 125 char *name, int offset, int size, int is_signed);
126 126
127#define is_signed_type(type) (((type)(-1)) < 0)
127 128
128/* 129/*
129 * The double __builtin_constant_p is because gcc will give us an error 130 * The double __builtin_constant_p is because gcc will give us an error
@@ -144,10 +145,10 @@ do { \
144 __trace_printk(ip, fmt, ##args); \ 145 __trace_printk(ip, fmt, ##args); \
145} while (0) 146} while (0)
146 147
147#define __common_field(type, item) \ 148#define __common_field(type, item, is_signed) \
148 ret = trace_define_field(event_call, #type, "common_" #item, \ 149 ret = trace_define_field(event_call, #type, "common_" #item, \
149 offsetof(typeof(field.ent), item), \ 150 offsetof(typeof(field.ent), item), \
150 sizeof(field.ent.item)); \ 151 sizeof(field.ent.item), is_signed); \
151 if (ret) \ 152 if (ret) \
152 return ret; 153 return ret;
153 154
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1e681142f1da..edb02bc9f8ff 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -225,7 +225,7 @@ ftrace_format_##call(struct trace_seq *s) \
225#define __field(type, item) \ 225#define __field(type, item) \
226 ret = trace_define_field(event_call, #type, #item, \ 226 ret = trace_define_field(event_call, #type, #item, \
227 offsetof(typeof(field), item), \ 227 offsetof(typeof(field), item), \
228 sizeof(field.item)); \ 228 sizeof(field.item), is_signed_type(type)); \
229 if (ret) \ 229 if (ret) \
230 return ret; 230 return ret;
231 231
@@ -234,7 +234,7 @@ ftrace_format_##call(struct trace_seq *s) \
234 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 234 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
235 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 235 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
236 offsetof(typeof(field), item), \ 236 offsetof(typeof(field), item), \
237 sizeof(field.item)); \ 237 sizeof(field.item), 0); \
238 if (ret) \ 238 if (ret) \
239 return ret; 239 return ret;
240 240
@@ -242,7 +242,7 @@ ftrace_format_##call(struct trace_seq *s) \
242#define __string(item, src) \ 242#define __string(item, src) \
243 ret = trace_define_field(event_call, "__str_loc", #item, \ 243 ret = trace_define_field(event_call, "__str_loc", #item, \
244 offsetof(typeof(field), __str_loc_##item), \ 244 offsetof(typeof(field), __str_loc_##item), \
245 sizeof(field.__str_loc_##item)); 245 sizeof(field.__str_loc_##item), 0);
246 246
247#undef TRACE_EVENT 247#undef TRACE_EVENT
248#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 248#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
@@ -253,11 +253,11 @@ ftrace_define_fields_##call(void) \
253 struct ftrace_event_call *event_call = &event_##call; \ 253 struct ftrace_event_call *event_call = &event_##call; \
254 int ret; \ 254 int ret; \
255 \ 255 \
256 __common_field(int, type); \ 256 __common_field(int, type, 1); \
257 __common_field(unsigned char, flags); \ 257 __common_field(unsigned char, flags, 0); \
258 __common_field(unsigned char, preempt_count); \ 258 __common_field(unsigned char, preempt_count, 0); \
259 __common_field(int, pid); \ 259 __common_field(int, pid, 1); \
260 __common_field(int, tgid); \ 260 __common_field(int, tgid, 1); \
261 \ 261 \
262 tstruct; \ 262 tstruct; \
263 \ 263 \