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>
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 46a27f2..e61a740 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -122,8 +122,9 @@
struct ring_buffer_event *event);
extern int trace_define_field(struct ftrace_event_call *call, char *type,
- char *name, int offset, int size);
+ char *name, int offset, int size, int is_signed);
+#define is_signed_type(type) (((type)(-1)) < 0)
/*
* The double __builtin_constant_p is because gcc will give us an error
@@ -144,10 +145,10 @@
__trace_printk(ip, fmt, ##args); \
} while (0)
-#define __common_field(type, item) \
+#define __common_field(type, item, is_signed) \
ret = trace_define_field(event_call, #type, "common_" #item, \
offsetof(typeof(field.ent), item), \
- sizeof(field.ent.item)); \
+ sizeof(field.ent.item), is_signed); \
if (ret) \
return ret;