OSDN Git Service

tracing: Make trace_get_fields() global
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 25 May 2019 16:58:01 +0000 (09:58 -0700)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 16 Jul 2019 19:14:48 +0000 (15:14 -0400)
trace_get_fields() is the only way to read tracepoint fields at
run time, as their fields are defined at compile-time with macros.
Make this function visible to all users and it will be used by
trace event injection code to calculate the size of a tracepoint
entry.
Link: http://lkml.kernel.org/r/20190525165802.25944-4-xiyou.wangcong@gmail.com
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/trace_events.h
kernel/trace/trace_events.c

index 5c6f2a6..5150436 100644 (file)
@@ -318,6 +318,14 @@ trace_event_name(struct trace_event_call *call)
                return call->name;
 }
 
+static inline struct list_head *
+trace_get_fields(struct trace_event_call *event_call)
+{
+       if (!event_call->class->get_fields)
+               return &event_call->class->fields;
+       return event_call->class->get_fields(event_call);
+}
+
 struct trace_array;
 struct trace_subsystem_dir;
 
index edc72f3..c7506bc 100644 (file)
@@ -70,14 +70,6 @@ static int system_refcount_dec(struct event_subsystem *system)
 #define while_for_each_event_file()            \
        }
 
-static struct list_head *
-trace_get_fields(struct trace_event_call *event_call)
-{
-       if (!event_call->class->get_fields)
-               return &event_call->class->fields;
-       return event_call->class->get_fields(event_call);
-}
-
 static struct ftrace_event_field *
 __find_event_field(struct list_head *head, char *name)
 {