tracing/probe: Add trace_event_call accesses APIs
Add trace_event_call access APIs for trace_probe. Instead of accessing trace_probe.call directly, use those accesses by trace_probe_event_call() method. This hides the relationship of trace_event_call and trace_probe from trace_kprobe and trace_uprobe. Link: http://lkml.kernel.org/r/155931587711.28323.8335129014686133120.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:

committed by
Steven Rostedt (VMware)

parent
b55ce203a8
commit
e3dc9f898e
@@ -985,7 +985,7 @@ __kprobe_trace_func(struct trace_kprobe *tk, struct pt_regs *regs,
|
||||
struct ring_buffer *buffer;
|
||||
int size, dsize, pc;
|
||||
unsigned long irq_flags;
|
||||
struct trace_event_call *call = &tk->tp.call;
|
||||
struct trace_event_call *call = trace_probe_event_call(&tk->tp);
|
||||
|
||||
WARN_ON(call != trace_file->event_call);
|
||||
|
||||
@@ -1033,7 +1033,7 @@ __kretprobe_trace_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,
|
||||
struct ring_buffer *buffer;
|
||||
int size, pc, dsize;
|
||||
unsigned long irq_flags;
|
||||
struct trace_event_call *call = &tk->tp.call;
|
||||
struct trace_event_call *call = trace_probe_event_call(&tk->tp);
|
||||
|
||||
WARN_ON(call != trace_file->event_call);
|
||||
|
||||
@@ -1163,7 +1163,7 @@ static int kretprobe_event_define_fields(struct trace_event_call *event_call)
|
||||
static int
|
||||
kprobe_perf_func(struct trace_kprobe *tk, struct pt_regs *regs)
|
||||
{
|
||||
struct trace_event_call *call = &tk->tp.call;
|
||||
struct trace_event_call *call = trace_probe_event_call(&tk->tp);
|
||||
struct kprobe_trace_entry_head *entry;
|
||||
struct hlist_head *head;
|
||||
int size, __size, dsize;
|
||||
@@ -1213,7 +1213,7 @@ static void
|
||||
kretprobe_perf_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,
|
||||
struct pt_regs *regs)
|
||||
{
|
||||
struct trace_event_call *call = &tk->tp.call;
|
||||
struct trace_event_call *call = trace_probe_event_call(&tk->tp);
|
||||
struct kretprobe_trace_entry_head *entry;
|
||||
struct hlist_head *head;
|
||||
int size, __size, dsize;
|
||||
@@ -1348,9 +1348,10 @@ static struct trace_event_functions kprobe_funcs = {
|
||||
.trace = print_kprobe_event
|
||||
};
|
||||
|
||||
static inline void init_trace_event_call(struct trace_kprobe *tk,
|
||||
struct trace_event_call *call)
|
||||
static inline void init_trace_event_call(struct trace_kprobe *tk)
|
||||
{
|
||||
struct trace_event_call *call = trace_probe_event_call(&tk->tp);
|
||||
|
||||
if (trace_kprobe_is_return(tk)) {
|
||||
call->event.funcs = &kretprobe_funcs;
|
||||
call->class->define_fields = kretprobe_event_define_fields;
|
||||
@@ -1366,7 +1367,7 @@ static inline void init_trace_event_call(struct trace_kprobe *tk,
|
||||
|
||||
static int register_kprobe_event(struct trace_kprobe *tk)
|
||||
{
|
||||
init_trace_event_call(tk, &tk->tp.call);
|
||||
init_trace_event_call(tk);
|
||||
|
||||
return trace_probe_register_event_call(&tk->tp);
|
||||
}
|
||||
@@ -1403,7 +1404,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
|
||||
return ERR_CAST(tk);
|
||||
}
|
||||
|
||||
init_trace_event_call(tk, &tk->tp.call);
|
||||
init_trace_event_call(tk);
|
||||
|
||||
if (traceprobe_set_print_fmt(&tk->tp, trace_kprobe_is_return(tk)) < 0) {
|
||||
ret = -ENOMEM;
|
||||
@@ -1414,7 +1415,7 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
return &tk->tp.call;
|
||||
return trace_probe_event_call(&tk->tp);
|
||||
error:
|
||||
free_trace_kprobe(tk);
|
||||
return ERR_PTR(ret);
|
||||
@@ -1447,7 +1448,7 @@ static __init void enable_boot_kprobe_events(void)
|
||||
mutex_lock(&event_mutex);
|
||||
for_each_trace_kprobe(tk, pos) {
|
||||
list_for_each_entry(file, &tr->events, list)
|
||||
if (file->event_call == &tk->tp.call)
|
||||
if (file->event_call == trace_probe_event_call(&tk->tp))
|
||||
trace_event_enable_disable(file, 1, 0);
|
||||
}
|
||||
mutex_unlock(&event_mutex);
|
||||
@@ -1523,7 +1524,7 @@ find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr)
|
||||
struct trace_event_file *file;
|
||||
|
||||
list_for_each_entry(file, &tr->events, list)
|
||||
if (file->event_call == &tk->tp.call)
|
||||
if (file->event_call == trace_probe_event_call(&tk->tp))
|
||||
return file;
|
||||
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user