Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace_events_stage_2.h
index b1cebba1d9b4466da1577f26622287df49b4e050..d363c6672c6c6aa85af3b40066af8e02d296c1b5 100644 (file)
@@ -20,7 +20,7 @@
  *
  *     field = (typeof(field))entry;
  *
- *     ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n");
+ *     ret = trace_seq_printf(s, <TP_printk> "\n");
  *     if (!ret)
  *             return TRACE_TYPE_PARTIAL_LINE;
  *
  * in binary.
  */
 
-#undef TRACE_STRUCT
-#define TRACE_STRUCT(args...) args
+#undef __entry
+#define __entry field
 
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign) \
-       field->item,
+#undef TP_printk
+#define TP_printk(fmt, args...) fmt "\n", args
 
-#undef TRACE_FIELD_SPECIAL
-#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
-       field->item,
-
-
-#undef TPRAWFMT
-#define TPRAWFMT(args...)      args
-
-#undef TRACE_EVENT_FORMAT
-#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
+#undef TRACE_EVENT
+#define TRACE_EVENT(call, proto, args, tstruct, assign, print)         \
 enum print_line_t                                                      \
 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)       \
 {                                                                      \
@@ -66,13 +57,13 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)    \
                                                                        \
        field = (typeof(field))entry;                                   \
                                                                        \
-       ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n");            \
+       ret = trace_seq_printf(s, #call ": " print);                    \
        if (!ret)                                                       \
                return TRACE_TYPE_PARTIAL_LINE;                         \
                                                                        \
        return TRACE_TYPE_HANDLED;                                      \
 }
-
+       
 #include <trace/trace_event_types.h>
 
 /*
@@ -81,40 +72,50 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)    \
  * int
  * ftrace_format_##call(struct trace_seq *s)
  * {
- *     struct ftrace_raw_##call field;
- *     int ret;
+ *     struct ftrace_raw_##call field;
+ *     int ret;
  *
- *     ret = trace_seq_printf(s, #type " " #item ";"
- *                            " size:%d; offset:%d;\n",
- *                            sizeof(field.type),
- *                            offsetof(struct ftrace_raw_##call,
- *                                     item));
+ *     ret = trace_seq_printf(s, #type " " #item ";"
+ *                            " offset:%u; size:%u;\n",
+ *                            offsetof(struct ftrace_raw_##call, item),
+ *                            sizeof(field.type));
  *
  * }
  */
 
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)                                        \
+#undef TP_STRUCT__entry
+#define TP_STRUCT__entry(args...) args
+
+#undef __field
+#define __field(type, item)                                    \
        ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
-                              "offset:%lu;\tsize:%lu;\n",              \
-                              offsetof(typeof(field), item),           \
-                              sizeof(field.item));                     \
+                              "offset:%u;\tsize:%u;\n",                \
+                              (unsigned int)offsetof(typeof(field), item), \
+                              (unsigned int)sizeof(field.item));       \
        if (!ret)                                                       \
                return 0;
 
-
-#undef TRACE_FIELD_SPECIAL
-#define TRACE_FIELD_SPECIAL(type_item, item, cmd)                      \
-       ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t"   \
-                              "offset:%lu;\tsize:%lu;\n",              \
-                              offsetof(typeof(field), item),           \
-                              sizeof(field.item));                     \
+#undef __array
+#define __array(type, item, len)                                               \
+       ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t"    \
+                              "offset:%u;\tsize:%u;\n",                \
+                              (unsigned int)offsetof(typeof(field), item), \
+                              (unsigned int)sizeof(field.item));       \
        if (!ret)                                                       \
                return 0;
 
-#undef TRACE_EVENT_FORMAT
-#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
-int                                                                    \
+#undef __entry
+#define __entry REC
+
+#undef TP_printk
+#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
+
+#undef TP_fast_assign
+#define TP_fast_assign(args...) args
+
+#undef TRACE_EVENT
+#define TRACE_EVENT(call, proto, args, tstruct, func, print)           \
+static int                                                             \
 ftrace_format_##call(struct trace_seq *s)                              \
 {                                                                      \
        struct ftrace_raw_##call field;                                 \
@@ -122,7 +123,52 @@ ftrace_format_##call(struct trace_seq *s)                          \
                                                                        \
        tstruct;                                                        \
                                                                        \
-       trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt);            \
+       trace_seq_printf(s, "\nprint fmt: " print);                     \
+                                                                       \
+       return ret;                                                     \
+}
+
+#include <trace/trace_event_types.h>
+
+#undef __field
+#define __field(type, item)                                            \
+       ret = trace_define_field(event_call, #type, #item,              \
+                                offsetof(typeof(field), item),         \
+                                sizeof(field.item));                   \
+       if (ret)                                                        \
+               return ret;
+
+#undef __array
+#define __array(type, item, len)                                       \
+       ret = trace_define_field(event_call, #type "[" #len "]", #item, \
+                                offsetof(typeof(field), item),         \
+                                sizeof(field.item));                   \
+       if (ret)                                                        \
+               return ret;
+
+#define __common_field(type, item)                                     \
+       ret = trace_define_field(event_call, #type, "common_" #item,    \
+                                offsetof(typeof(field.ent), item),     \
+                                sizeof(field.ent.item));               \
+       if (ret)                                                        \
+               return ret;
+
+#undef TRACE_EVENT
+#define TRACE_EVENT(call, proto, args, tstruct, func, print)           \
+int                                                                    \
+ftrace_define_fields_##call(void)                                      \
+{                                                                      \
+       struct ftrace_raw_##call field;                                 \
+       struct ftrace_event_call *event_call = &event_##call;           \
+       int ret;                                                        \
+                                                                       \
+       __common_field(unsigned char, type);                            \
+       __common_field(unsigned char, flags);                           \
+       __common_field(unsigned char, preempt_count);                   \
+       __common_field(int, pid);                                       \
+       __common_field(int, tgid);                                      \
+                                                                       \
+       tstruct;                                                        \
                                                                        \
        return ret;                                                     \
 }