]> Pileus Git - ~andy/linux/blobdiff - kernel/trace/trace_output.c
tracing: Add a helper function for event print functions
[~andy/linux] / kernel / trace / trace_output.c
index 194d79602dc73f1881969a9d27e7e141fb545117..aa92ac322ba2af80f9242ef52af7c1c78c4279a8 100644 (file)
@@ -397,6 +397,32 @@ ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len)
 }
 EXPORT_SYMBOL(ftrace_print_hex_seq);
 
+int ftrace_raw_output_prep(struct trace_iterator *iter,
+                          struct trace_event *trace_event)
+{
+       struct ftrace_event_call *event;
+       struct trace_seq *s = &iter->seq;
+       struct trace_seq *p = &iter->tmp_seq;
+       struct trace_entry *entry;
+       int ret;
+
+       event = container_of(trace_event, struct ftrace_event_call, event);
+       entry = iter->ent;
+
+       if (entry->type != event->event.type) {
+               WARN_ON_ONCE(1);
+               return TRACE_TYPE_UNHANDLED;
+       }
+
+       trace_seq_init(p);
+       ret = trace_seq_printf(s, "%s: ", event->name);
+       if (!ret)
+               return TRACE_TYPE_PARTIAL_LINE;
+
+       return 0;
+}
+EXPORT_SYMBOL(ftrace_raw_output_prep);
+
 #ifdef CONFIG_KRETPROBES
 static inline const char *kretprobed(const char *name)
 {