diff options
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/ftrace.h | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 51ed7f3568a5..824141d5cf04 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -206,18 +206,22 @@ | |||
206 | #undef DECLARE_EVENT_CLASS | 206 | #undef DECLARE_EVENT_CLASS |
207 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | 207 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
208 | static notrace enum print_line_t \ | 208 | static notrace enum print_line_t \ |
209 | ftrace_raw_output_id_##call(int event_id, const char *name, \ | 209 | ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \ |
210 | struct trace_iterator *iter, int flags) \ | 210 | struct trace_event *trace_event) \ |
211 | { \ | 211 | { \ |
212 | struct ftrace_event_call *event; \ | ||
212 | struct trace_seq *s = &iter->seq; \ | 213 | struct trace_seq *s = &iter->seq; \ |
213 | struct ftrace_raw_##call *field; \ | 214 | struct ftrace_raw_##call *field; \ |
214 | struct trace_entry *entry; \ | 215 | struct trace_entry *entry; \ |
215 | struct trace_seq *p; \ | 216 | struct trace_seq *p; \ |
216 | int ret; \ | 217 | int ret; \ |
217 | \ | 218 | \ |
219 | event = container_of(trace_event, struct ftrace_event_call, \ | ||
220 | event); \ | ||
221 | \ | ||
218 | entry = iter->ent; \ | 222 | entry = iter->ent; \ |
219 | \ | 223 | \ |
220 | if (entry->type != event_id) { \ | 224 | if (entry->type != event->id) { \ |
221 | WARN_ON_ONCE(1); \ | 225 | WARN_ON_ONCE(1); \ |
222 | return TRACE_TYPE_UNHANDLED; \ | 226 | return TRACE_TYPE_UNHANDLED; \ |
223 | } \ | 227 | } \ |
@@ -226,7 +230,7 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \ | |||
226 | \ | 230 | \ |
227 | p = &get_cpu_var(ftrace_event_seq); \ | 231 | p = &get_cpu_var(ftrace_event_seq); \ |
228 | trace_seq_init(p); \ | 232 | trace_seq_init(p); \ |
229 | ret = trace_seq_printf(s, "%s: ", name); \ | 233 | ret = trace_seq_printf(s, "%s: ", event->name); \ |
230 | if (ret) \ | 234 | if (ret) \ |
231 | ret = trace_seq_printf(s, print); \ | 235 | ret = trace_seq_printf(s, print); \ |
232 | put_cpu(); \ | 236 | put_cpu(); \ |
@@ -234,17 +238,10 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \ | |||
234 | return TRACE_TYPE_PARTIAL_LINE; \ | 238 | return TRACE_TYPE_PARTIAL_LINE; \ |
235 | \ | 239 | \ |
236 | return TRACE_TYPE_HANDLED; \ | 240 | return TRACE_TYPE_HANDLED; \ |
237 | } | 241 | } \ |
238 | 242 | static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |
239 | #undef DEFINE_EVENT | 243 | .trace = ftrace_raw_output_##call, \ |
240 | #define DEFINE_EVENT(template, name, proto, args) \ | 244 | }; |
241 | static notrace enum print_line_t \ | ||
242 | ftrace_raw_output_##name(struct trace_iterator *iter, int flags, \ | ||
243 | struct trace_event *event) \ | ||
244 | { \ | ||
245 | return ftrace_raw_output_id_##template(event_##name.id, \ | ||
246 | #name, iter, flags); \ | ||
247 | } | ||
248 | 245 | ||
249 | #undef DEFINE_EVENT_PRINT | 246 | #undef DEFINE_EVENT_PRINT |
250 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ | 247 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ |
@@ -277,7 +274,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \ | |||
277 | return TRACE_TYPE_PARTIAL_LINE; \ | 274 | return TRACE_TYPE_PARTIAL_LINE; \ |
278 | \ | 275 | \ |
279 | return TRACE_TYPE_HANDLED; \ | 276 | return TRACE_TYPE_HANDLED; \ |
280 | } | 277 | } \ |
278 | static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | ||
279 | .trace = ftrace_raw_output_##call, \ | ||
280 | }; | ||
281 | 281 | ||
282 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 282 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
283 | 283 | ||
@@ -533,20 +533,13 @@ ftrace_raw_event_##call(void *__data, proto) \ | |||
533 | 533 | ||
534 | #undef DEFINE_EVENT | 534 | #undef DEFINE_EVENT |
535 | #define DEFINE_EVENT(template, call, proto, args) \ | 535 | #define DEFINE_EVENT(template, call, proto, args) \ |
536 | static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | ||
537 | .trace = ftrace_raw_output_##call, \ | ||
538 | }; \ | ||
539 | static struct trace_event ftrace_event_type_##call = { \ | ||
540 | .funcs = &ftrace_event_type_funcs_##call, \ | ||
541 | }; \ | ||
542 | static inline void ftrace_test_probe_##call(void) \ | 536 | static inline void ftrace_test_probe_##call(void) \ |
543 | { \ | 537 | { \ |
544 | check_trace_callback_type_##call(ftrace_raw_event_##template); \ | 538 | check_trace_callback_type_##call(ftrace_raw_event_##template); \ |
545 | } | 539 | } |
546 | 540 | ||
547 | #undef DEFINE_EVENT_PRINT | 541 | #undef DEFINE_EVENT_PRINT |
548 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 542 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) |
549 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
550 | 543 | ||
551 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 544 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
552 | 545 | ||
@@ -582,7 +575,7 @@ __attribute__((__aligned__(4))) \ | |||
582 | __attribute__((section("_ftrace_events"))) event_##call = { \ | 575 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
583 | .name = #call, \ | 576 | .name = #call, \ |
584 | .class = &event_class_##template, \ | 577 | .class = &event_class_##template, \ |
585 | .event = &ftrace_event_type_##call, \ | 578 | .event.funcs = &ftrace_event_type_funcs_##template, \ |
586 | .print_fmt = print_fmt_##template, \ | 579 | .print_fmt = print_fmt_##template, \ |
587 | }; | 580 | }; |
588 | 581 | ||
@@ -596,7 +589,7 @@ __attribute__((__aligned__(4))) \ | |||
596 | __attribute__((section("_ftrace_events"))) event_##call = { \ | 589 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
597 | .name = #call, \ | 590 | .name = #call, \ |
598 | .class = &event_class_##template, \ | 591 | .class = &event_class_##template, \ |
599 | .event = &ftrace_event_type_##call, \ | 592 | .event.funcs = &ftrace_event_type_funcs_##call, \ |
600 | .print_fmt = print_fmt_##call, \ | 593 | .print_fmt = print_fmt_##call, \ |
601 | } | 594 | } |
602 | 595 | ||