tracing: typecast sizeof and offsetof to unsigned int
[safe/jmp/linux-2.6] / kernel / trace / trace_format.h
1 /*
2  * Setup the showing format of trace point.
3  *
4  * int
5  * ftrace_format_##call(struct trace_seq *s)
6  * {
7  *      struct ftrace_raw_##call field;
8  *      int ret;
9  *
10  *      ret = trace_seq_printf(s, #type " " #item ";"
11  *                             " size:%d; offset:%d;\n",
12  *                             sizeof(field.type),
13  *                             offsetof(struct ftrace_raw_##call,
14  *                                      item));
15  *
16  * }
17  */
18
19 #undef TRACE_STRUCT
20 #define TRACE_STRUCT(args...) args
21
22 #undef TRACE_FIELD
23 #define TRACE_FIELD(type, item, assign)                                 \
24         ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"      \
25                                "offset:%u;\tsize:%u;\n",                \
26                                (unsigned int)offsetof(typeof(field), item), \
27                                (unsigned int)sizeof(field.item));       \
28         if (!ret)                                                       \
29                 return 0;
30
31
32 #undef TRACE_FIELD_SPECIAL
33 #define TRACE_FIELD_SPECIAL(type_item, item, cmd)                       \
34         ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t"   \
35                                "offset:%u;\tsize:%u;\n",                \
36                                (unsigned int)offsetof(typeof(field), item), \
37                                (unsigned int)sizeof(field.item));       \
38         if (!ret)                                                       \
39                 return 0;
40
41 #undef TRACE_EVENT_FORMAT
42 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)      \
43 static int                                                              \
44 ftrace_format_##call(struct trace_seq *s)                               \
45 {                                                                       \
46         struct ftrace_raw_##call field;                                 \
47         int ret;                                                        \
48                                                                         \
49         tstruct;                                                        \
50                                                                         \
51         trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt);            \
52                                                                         \
53         return ret;                                                     \
54 }
55