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>
This commit is contained in:
Tom Zanussi
2009-04-28 03:04:53 -05:00
committed by Ingo Molnar
parent 30e673b230
commit a118e4d140
6 changed files with 39 additions and 21 deletions

View File

@@ -122,8 +122,9 @@ extern int filter_current_check_discard(struct ftrace_event_call *call,
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 @@ do { \
__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;