tracing: Ftrace dynamic ftrace_event_call support
[pandora-kernel.git] / kernel / trace / trace_export.c
index d06cf89..9cbe7f1 100644 (file)
@@ -60,7 +60,8 @@ extern void __bad_type_size(void);
 #undef TRACE_EVENT_FORMAT
 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
 static int                                                             \
-ftrace_format_##call(struct trace_seq *s)                              \
+ftrace_format_##call(struct ftrace_event_call *unused,                 \
+                     struct trace_seq *s)                              \
 {                                                                      \
        struct args field;                                              \
        int ret;                                                        \
@@ -76,7 +77,8 @@ ftrace_format_##call(struct trace_seq *s)                             \
 #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct,   \
                                    tpfmt)                              \
 static int                                                             \
-ftrace_format_##call(struct trace_seq *s)                              \
+ftrace_format_##call(struct ftrace_event_call *unused,                 \
+                     struct trace_seq *s)                              \
 {                                                                      \
        struct args field;                                              \
        int ret;                                                        \
@@ -115,10 +117,16 @@ ftrace_format_##call(struct trace_seq *s)                         \
 #define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
        cmd;
 
+static int ftrace_raw_init_event(struct ftrace_event_call *event_call)
+{
+       INIT_LIST_HEAD(&event_call->fields);
+       init_preds(event_call);
+       return 0;
+}
+
 #undef TRACE_EVENT_FORMAT
 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
-int ftrace_define_fields_##call(void);                                 \
-static int ftrace_raw_init_event_##call(void);                         \
+int ftrace_define_fields_##call(struct ftrace_event_call *event_call); \
                                                                        \
 struct ftrace_event_call __used                                                \
 __attribute__((__aligned__(4)))                                                \
@@ -126,16 +134,10 @@ __attribute__((section("_ftrace_events"))) event_##call = {               \
        .name                   = #call,                                \
        .id                     = proto,                                \
        .system                 = __stringify(TRACE_SYSTEM),            \
-       .raw_init               = ftrace_raw_init_event_##call,         \
+       .raw_init               = ftrace_raw_init_event,                \
        .show_format            = ftrace_format_##call,                 \
        .define_fields          = ftrace_define_fields_##call,          \
-};                                                                     \
-static int ftrace_raw_init_event_##call(void)                          \
-{                                                                      \
-       INIT_LIST_HEAD(&event_##call.fields);                           \
-       init_preds(&event_##call);                                      \
-       return 0;                                                       \
-}                                                                      \
+};
 
 #undef TRACE_EVENT_FORMAT_NOFILTER
 #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct,   \
@@ -156,7 +158,8 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #define TRACE_FIELD(type, item, assign)                                        \
        ret = trace_define_field(event_call, #type, #item,              \
                                 offsetof(typeof(field), item),         \
-                                sizeof(field.item), is_signed_type(type));     \
+                                sizeof(field.item),                    \
+                                is_signed_type(type), FILTER_OTHER);   \
        if (ret)                                                        \
                return ret;
 
@@ -164,7 +167,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #define TRACE_FIELD_SPECIAL(type, item, len, cmd)                      \
        ret = trace_define_field(event_call, #type "[" #len "]", #item, \
                                 offsetof(typeof(field), item),         \
-                                sizeof(field.item), 0);                \
+                                sizeof(field.item), 0, FILTER_OTHER);  \
        if (ret)                                                        \
                return ret;
 
@@ -172,7 +175,8 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #define TRACE_FIELD_SIGN(type, item, assign, is_signed)                        \
        ret = trace_define_field(event_call, #type, #item,              \
                                 offsetof(typeof(field), item),         \
-                                sizeof(field.item), is_signed);        \
+                                sizeof(field.item), is_signed,         \
+                                FILTER_OTHER);                         \
        if (ret)                                                        \
                return ret;
 
@@ -182,17 +186,14 @@ __attribute__((section("_ftrace_events"))) event_##call = {               \
 #undef TRACE_EVENT_FORMAT
 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
 int                                                                    \
-ftrace_define_fields_##call(void)                                      \
+ftrace_define_fields_##call(struct ftrace_event_call *event_call)      \
 {                                                                      \
-       struct ftrace_event_call *event_call = &event_##call;           \
        struct args field;                                              \
        int ret;                                                        \
                                                                        \
-       __common_field(unsigned char, type, 0);                         \
-       __common_field(unsigned char, flags, 0);                        \
-       __common_field(unsigned char, preempt_count, 0);                \
-       __common_field(int, pid, 1);                                    \
-       __common_field(int, tgid, 1);                                   \
+       ret = trace_define_common_fields(event_call);                   \
+       if (ret)                                                        \
+               return ret;                                             \
                                                                        \
        tstruct;                                                        \
                                                                        \