8e2e0f56c2a8dbacef365fba0d77203fd78ae004
[linux-2.6.git] / kernel / trace / trace_events_stage_2.h
1 /*
2  * Stage 2 of the trace events.
3  *
4  * Override the macros in <trace/trace_event_types.h> to include the following:
5  *
6  * enum print_line_t
7  * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
8  * {
9  *      struct trace_seq *s = &iter->seq;
10  *      struct ftrace_raw_<call> *field; <-- defined in stage 1
11  *      struct trace_entry *entry;
12  *      int ret;
13  *
14  *      entry = iter->ent;
15  *
16  *      if (entry->type != event_<call>.id) {
17  *              WARN_ON_ONCE(1);
18  *              return TRACE_TYPE_UNHANDLED;
19  *      }
20  *
21  *      field = (typeof(field))entry;
22  *
23  *      ret = trace_seq_printf(s, <TP_RAW_FMT> "%s", <ARGS> "\n");
24  *      if (!ret)
25  *              return TRACE_TYPE_PARTIAL_LINE;
26  *
27  *      return TRACE_TYPE_HANDLED;
28  * }
29  *
30  * This is the method used to print the raw event to the trace
31  * output format. Note, this is not needed if the data is read
32  * in binary.
33  */
34
35 #undef TRACE_STRUCT
36 #define TRACE_STRUCT(args...) args
37
38 #undef TRACE_FIELD
39 #define TRACE_FIELD(type, item, assign) \
40         field->item,
41
42 #undef TRACE_FIELD_SPECIAL
43 #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
44         field->item,
45
46
47 #undef TP_RAW_FMT
48 #define TP_RAW_FMT(args...)     args
49
50 #undef TRACE_EVENT_FORMAT
51 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)      \
52 enum print_line_t                                                       \
53 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)        \
54 {                                                                       \
55         struct trace_seq *s = &iter->seq;                               \
56         struct ftrace_raw_##call *field;                                \
57         struct trace_entry *entry;                                      \
58         int ret;                                                        \
59                                                                         \
60         entry = iter->ent;                                              \
61                                                                         \
62         if (entry->type != event_##call.id) {                           \
63                 WARN_ON_ONCE(1);                                        \
64                 return TRACE_TYPE_UNHANDLED;                            \
65         }                                                               \
66                                                                         \
67         field = (typeof(field))entry;                                   \
68                                                                         \
69         ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n");            \
70         if (!ret)                                                       \
71                 return TRACE_TYPE_PARTIAL_LINE;                         \
72                                                                         \
73         return TRACE_TYPE_HANDLED;                                      \
74 }
75
76 #include <trace/trace_event_types.h>
77
78 #include "trace_format.h"
79 #include <trace/trace_event_types.h>