Merge branch 'topic/misc' into for-linus
[safe/jmp/linux-2.6] / kernel / trace / trace_export.c
index 2435d55..e091f64 100644 (file)
 struct ____ftrace_##name {                                     \
        tstruct                                                 \
 };                                                             \
-static void __used ____ftrace_check_##name(void)               \
+static void __always_unused ____ftrace_check_##name(void)      \
 {                                                              \
        struct ____ftrace_##name *__entry = NULL;               \
                                                                \
-       /* force cmpile-time check on F_printk() */             \
+       /* force compile-time check on F_printk() */            \
        printk(print);                                          \
 }
 
@@ -62,76 +62,6 @@ static void __used ____ftrace_check_##name(void)             \
 
 #include "trace_entries.h"
 
-
-#undef __field
-#define __field(type, item)                                            \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:%zu;\n",              \
-                              offsetof(typeof(field), item),           \
-                              sizeof(field.item));                     \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __field_desc
-#define __field_desc(type, container, item)                            \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:%zu;\n",              \
-                              offsetof(typeof(field), container.item), \
-                              sizeof(field.container.item));           \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __array
-#define __array(type, item, len)                                       \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
-                              "offset:%zu;\tsize:%zu;\n",              \
-                              offsetof(typeof(field), item),   \
-                              sizeof(field.item));             \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __array_desc
-#define __array_desc(type, container, item, len)                       \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
-                              "offset:%zu;\tsize:%zu;\n",              \
-                              offsetof(typeof(field), container.item), \
-                              sizeof(field.container.item));           \
-       if (!ret)                                                       \
-               return 0;
-
-#undef __dynamic_array
-#define __dynamic_array(type, item)                                    \
-       ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%zu;\tsize:0;\n",                \
-                              offsetof(typeof(field), item));          \
-       if (!ret)                                                       \
-               return 0;
-
-#undef F_printk
-#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
-
-#undef __entry
-#define __entry REC
-
-#undef FTRACE_ENTRY
-#define FTRACE_ENTRY(name, struct_name, id, tstruct, print)            \
-static int                                                             \
-ftrace_format_##name(struct ftrace_event_call *unused,                 \
-                    struct trace_seq *s)                               \
-{                                                                      \
-       struct struct_name field __attribute__((unused));               \
-       int ret = 0;                                                    \
-                                                                       \
-       tstruct;                                                        \
-                                                                       \
-       trace_seq_printf(s, "\nprint fmt: " print);                     \
-                                                                       \
-       return ret;                                                     \
-}
-
-#include "trace_entries.h"
-
-
 #undef __field
 #define __field(type, item)                                            \
        ret = trace_define_field(event_call, #type, #item,              \
@@ -156,7 +86,8 @@ ftrace_format_##name(struct ftrace_event_call *unused,                       \
        BUILD_BUG_ON(len > MAX_FILTER_STR_VAL);                         \
        ret = trace_define_field(event_call, #type "[" #len "]", #item, \
                                 offsetof(typeof(field), item),         \
-                                sizeof(field.item), 0, FILTER_OTHER);  \
+                                sizeof(field.item),                    \
+                                is_signed_type(type), FILTER_OTHER);   \
        if (ret)                                                        \
                return ret;
 
@@ -166,13 +97,18 @@ ftrace_format_##name(struct ftrace_event_call *unused,                     \
        ret = trace_define_field(event_call, #type "[" #len "]", #item, \
                                 offsetof(typeof(field),                \
                                          container.item),              \
-                                sizeof(field.container.item), 0,       \
-                                FILTER_OTHER);                         \
+                                sizeof(field.container.item),          \
+                                is_signed_type(type), FILTER_OTHER);   \
        if (ret)                                                        \
                return ret;
 
 #undef __dynamic_array
-#define __dynamic_array(type, item)
+#define __dynamic_array(type, item)                                    \
+       ret = trace_define_field(event_call, #type, #item,              \
+                                offsetof(typeof(field), item),         \
+                                0, is_signed_type(type), FILTER_OTHER);\
+       if (ret)                                                        \
+               return ret;
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(name, struct_name, id, tstruct, print)            \
@@ -182,10 +118,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call)  \
        struct struct_name field;                                       \
        int ret;                                                        \
                                                                        \
-       ret = trace_define_common_fields(event_call);                   \
-       if (ret)                                                        \
-               return ret;                                             \
-                                                                       \
        tstruct;                                                        \
                                                                        \
        return ret;                                                     \
@@ -193,6 +125,14 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call)  \
 
 #include "trace_entries.h"
 
+static int ftrace_raw_init_event(struct ftrace_event_call *call)
+{
+       INIT_LIST_HEAD(&call->fields);
+       return 0;
+}
+
+#undef __entry
+#define __entry REC
 
 #undef __field
 #define __field(type, item)
@@ -209,35 +149,11 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
 #undef __dynamic_array
 #define __dynamic_array(type, item)
 
-
-#undef TRACE_ZERO_CHAR
-#define TRACE_ZERO_CHAR(arg)
-
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-       entry->item = assign;
-
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-       entry->item = assign;
-
-#undef TRACE_FIELD_SIGN
-#define TRACE_FIELD_SIGN(type, item, assign, is_signed)        \
-       TRACE_FIELD(type, item, assign)
-
-#undef TP_CMD
-#define TP_CMD(cmd...) cmd
-
-#undef TRACE_ENTRY
-#define TRACE_ENTRY    entry
-
-#undef TRACE_FIELD_SPECIAL
-#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
-       cmd;
+#undef F_printk
+#define F_printk(fmt, args...) #fmt ", "  __stringify(args)
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, type, tstruct, print)          \
-static int ftrace_raw_init_event_##call(void);                         \
                                                                        \
 struct ftrace_event_call __used                                                \
 __attribute__((__aligned__(4)))                                                \
@@ -245,14 +161,9 @@ __attribute__((section("_ftrace_events"))) event_##call = {                \
        .name                   = #call,                                \
        .id                     = type,                                 \
        .system                 = __stringify(TRACE_SYSTEM),            \
-       .raw_init               = ftrace_raw_init_event_##call,         \
-       .show_format            = ftrace_format_##call,                 \
+       .raw_init               = ftrace_raw_init_event,                \
+       .print_fmt              = print,                                \
        .define_fields          = ftrace_define_fields_##call,          \
 };                                                                     \
-static int ftrace_raw_init_event_##call(void)                          \
-{                                                                      \
-       INIT_LIST_HEAD(&event_##call.fields);                           \
-       return 0;                                                       \
-}                                                                      \
 
 #include "trace_entries.h"