Skip to content

Commit e8f9f4d

Browse files
committed
tracing: Add ftrace event call parameter to its field descriptor handler
Add the struct ftrace_event_call as a parameter of its show_format() callback. This way we can use it from the syscall trace events to retrieve the syscall name from the ftrace event call parameter and describe its fields using the syscalls metadata. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Jiaying Zhang <jiayingz@google.com> Cc: Martin Bligh <mbligh@google.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Jason Baron <jbaron@redhat.com>
1 parent 0ac676f commit e8f9f4d

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎include/linux/ftrace_event.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ struct ftrace_event_call {
116116
void (*unregfunc)(void *);
117117
int id;
118118
int (*raw_init)(void);
119-
int (*show_format)(struct trace_seq *s);
119+
int (*show_format)(struct ftrace_event_call *call,
120+
struct trace_seq *s);
120121
int (*define_fields)(void);
121122
struct list_head fields;
122123
int filter_active;

‎include/trace/ftrace.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@
151151
#undef TRACE_EVENT
152152
#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
153153
static int \
154-
ftrace_format_##call(struct trace_seq *s) \
154+
ftrace_format_##call(struct ftrace_event_call *unused, \
155+
struct trace_seq *s) \
155156
{ \
156157
struct ftrace_raw_##call field __attribute__((unused)); \
157158
int ret = 0; \

‎kernel/trace/trace_events.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
576576
trace_seq_printf(s, "format:\n");
577577
trace_write_header(s);
578578

579-
r = call->show_format(s);
579+
r = call->show_format(call, s);
580580
if (!r) {
581581
/*
582582
* ug! The format output is bigger than a PAGE!!

‎kernel/trace/trace_export.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ extern void __bad_type_size(void);
6060
#undef TRACE_EVENT_FORMAT
6161
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
6262
static int \
63-
ftrace_format_##call(struct trace_seq *s) \
63+
ftrace_format_##call(struct ftrace_event_call *unused, \
64+
struct trace_seq *s) \
6465
{ \
6566
struct args field; \
6667
int ret; \
@@ -76,7 +77,8 @@ ftrace_format_##call(struct trace_seq *s) \
7677
#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \
7778
tpfmt) \
7879
static int \
79-
ftrace_format_##call(struct trace_seq *s) \
80+
ftrace_format_##call(struct ftrace_event_call *unused, \
81+
struct trace_seq *s) \
8082
{ \
8183
struct args field; \
8284
int ret; \

0 commit comments

Comments
 (0)