diff options
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/ftrace.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index f64fbaae781a..25d3b02a06f8 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define __array(type, item, len) type item[len]; | 25 | #define __array(type, item, len) type item[len]; |
26 | 26 | ||
27 | #undef __dynamic_array | 27 | #undef __dynamic_array |
28 | #define __dynamic_array(type, item, len) unsigned short __data_loc_##item; | 28 | #define __dynamic_array(type, item, len) u32 __data_loc_##item; |
29 | 29 | ||
30 | #undef __string | 30 | #undef __string |
31 | #define __string(item, src) __dynamic_array(char, item, -1) | 31 | #define __string(item, src) __dynamic_array(char, item, -1) |
@@ -51,13 +51,14 @@ | |||
51 | * Include the following: | 51 | * Include the following: |
52 | * | 52 | * |
53 | * struct ftrace_data_offsets_<call> { | 53 | * struct ftrace_data_offsets_<call> { |
54 | * int <item1>; | 54 | * u32 <item1>; |
55 | * int <item2>; | 55 | * u32 <item2>; |
56 | * [...] | 56 | * [...] |
57 | * }; | 57 | * }; |
58 | * | 58 | * |
59 | * The __dynamic_array() macro will create each int <item>, this is | 59 | * The __dynamic_array() macro will create each u32 <item>, this is |
60 | * to keep the offset of each array from the beginning of the event. | 60 | * to keep the offset of each array from the beginning of the event. |
61 | * The size of an array is also encoded, in the higher 16 bits of <item>. | ||
61 | */ | 62 | */ |
62 | 63 | ||
63 | #undef __field | 64 | #undef __field |
@@ -67,7 +68,7 @@ | |||
67 | #define __array(type, item, len) | 68 | #define __array(type, item, len) |
68 | 69 | ||
69 | #undef __dynamic_array | 70 | #undef __dynamic_array |
70 | #define __dynamic_array(type, item, len) int item; | 71 | #define __dynamic_array(type, item, len) u32 item; |
71 | 72 | ||
72 | #undef __string | 73 | #undef __string |
73 | #define __string(item, src) __dynamic_array(char, item, -1) | 74 | #define __string(item, src) __dynamic_array(char, item, -1) |
@@ -120,7 +121,7 @@ | |||
120 | 121 | ||
121 | #undef __dynamic_array | 122 | #undef __dynamic_array |
122 | #define __dynamic_array(type, item, len) \ | 123 | #define __dynamic_array(type, item, len) \ |
123 | ret = trace_seq_printf(s, "\tfield:__data_loc " #item ";\t" \ | 124 | ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\ |
124 | "offset:%u;\tsize:%u;\n", \ | 125 | "offset:%u;\tsize:%u;\n", \ |
125 | (unsigned int)offsetof(typeof(field), \ | 126 | (unsigned int)offsetof(typeof(field), \ |
126 | __data_loc_##item), \ | 127 | __data_loc_##item), \ |
@@ -210,7 +211,7 @@ ftrace_format_##call(struct trace_seq *s) \ | |||
210 | 211 | ||
211 | #undef __get_dynamic_array | 212 | #undef __get_dynamic_array |
212 | #define __get_dynamic_array(field) \ | 213 | #define __get_dynamic_array(field) \ |
213 | ((void *)__entry + __entry->__data_loc_##field) | 214 | ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) |
214 | 215 | ||
215 | #undef __get_str | 216 | #undef __get_str |
216 | #define __get_str(field) (char *)__get_dynamic_array(field) | 217 | #define __get_str(field) (char *)__get_dynamic_array(field) |
@@ -282,7 +283,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
282 | 283 | ||
283 | #undef __dynamic_array | 284 | #undef __dynamic_array |
284 | #define __dynamic_array(type, item, len) \ | 285 | #define __dynamic_array(type, item, len) \ |
285 | ret = trace_define_field(event_call, "__data_loc" "[" #type "]", #item,\ | 286 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
286 | offsetof(typeof(field), __data_loc_##item), \ | 287 | offsetof(typeof(field), __data_loc_##item), \ |
287 | sizeof(field.__data_loc_##item), 0); | 288 | sizeof(field.__data_loc_##item), 0); |
288 | 289 | ||
@@ -328,6 +329,7 @@ ftrace_define_fields_##call(void) \ | |||
328 | #define __dynamic_array(type, item, len) \ | 329 | #define __dynamic_array(type, item, len) \ |
329 | __data_offsets->item = __data_size + \ | 330 | __data_offsets->item = __data_size + \ |
330 | offsetof(typeof(*entry), __data); \ | 331 | offsetof(typeof(*entry), __data); \ |
332 | __data_offsets->item |= (len * sizeof(type)) << 16; \ | ||
331 | __data_size += (len) * sizeof(type); | 333 | __data_size += (len) * sizeof(type); |
332 | 334 | ||
333 | #undef __string | 335 | #undef __string |