Commit 7143f168 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt

tracing/kprobes: Rename probe_* to trace_probe_*

Rename probe_* to trace_probe_* for avoiding namespace
confliction. This also fixes improper names of find_probe_event()
and cleanup_all_probes() to find_trace_probe() and
release_all_trace_probes() respectively.
Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20110627072636.6528.60374.stgit@fedora15Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent f9129870
...@@ -555,12 +555,12 @@ struct trace_probe { ...@@ -555,12 +555,12 @@ struct trace_probe {
(sizeof(struct probe_arg) * (n))) (sizeof(struct probe_arg) * (n)))
static __kprobes int probe_is_return(struct trace_probe *tp) static __kprobes int trace_probe_is_return(struct trace_probe *tp)
{ {
return tp->rp.handler != NULL; return tp->rp.handler != NULL;
} }
static __kprobes const char *probe_symbol(struct trace_probe *tp) static __kprobes const char *trace_probe_symbol(struct trace_probe *tp)
{ {
return tp->symbol ? tp->symbol : "unknown"; return tp->symbol ? tp->symbol : "unknown";
} }
...@@ -671,7 +671,7 @@ static void free_trace_probe(struct trace_probe *tp) ...@@ -671,7 +671,7 @@ static void free_trace_probe(struct trace_probe *tp)
kfree(tp); kfree(tp);
} }
static struct trace_probe *find_probe_event(const char *event, static struct trace_probe *find_trace_probe(const char *event,
const char *group) const char *group)
{ {
struct trace_probe *tp; struct trace_probe *tp;
...@@ -686,7 +686,7 @@ static struct trace_probe *find_probe_event(const char *event, ...@@ -686,7 +686,7 @@ static struct trace_probe *find_probe_event(const char *event,
/* Unregister a trace_probe and probe_event: call with locking probe_lock */ /* Unregister a trace_probe and probe_event: call with locking probe_lock */
static void unregister_trace_probe(struct trace_probe *tp) static void unregister_trace_probe(struct trace_probe *tp)
{ {
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
unregister_kretprobe(&tp->rp); unregister_kretprobe(&tp->rp);
else else
unregister_kprobe(&tp->rp.kp); unregister_kprobe(&tp->rp.kp);
...@@ -703,7 +703,7 @@ static int register_trace_probe(struct trace_probe *tp) ...@@ -703,7 +703,7 @@ static int register_trace_probe(struct trace_probe *tp)
mutex_lock(&probe_lock); mutex_lock(&probe_lock);
/* register as an event */ /* register as an event */
old_tp = find_probe_event(tp->call.name, tp->call.class->system); old_tp = find_trace_probe(tp->call.name, tp->call.class->system);
if (old_tp) { if (old_tp) {
/* delete old event */ /* delete old event */
unregister_trace_probe(old_tp); unregister_trace_probe(old_tp);
...@@ -716,7 +716,7 @@ static int register_trace_probe(struct trace_probe *tp) ...@@ -716,7 +716,7 @@ static int register_trace_probe(struct trace_probe *tp)
} }
tp->rp.kp.flags |= KPROBE_FLAG_DISABLED; tp->rp.kp.flags |= KPROBE_FLAG_DISABLED;
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
ret = register_kretprobe(&tp->rp); ret = register_kretprobe(&tp->rp);
else else
ret = register_kprobe(&tp->rp.kp); ret = register_kprobe(&tp->rp.kp);
...@@ -1025,7 +1025,7 @@ static int create_trace_probe(int argc, char **argv) ...@@ -1025,7 +1025,7 @@ static int create_trace_probe(int argc, char **argv)
return -EINVAL; return -EINVAL;
} }
mutex_lock(&probe_lock); mutex_lock(&probe_lock);
tp = find_probe_event(event, group); tp = find_trace_probe(event, group);
if (!tp) { if (!tp) {
mutex_unlock(&probe_lock); mutex_unlock(&probe_lock);
pr_info("Event %s/%s doesn't exist.\n", group, event); pr_info("Event %s/%s doesn't exist.\n", group, event);
...@@ -1144,7 +1144,7 @@ static int create_trace_probe(int argc, char **argv) ...@@ -1144,7 +1144,7 @@ static int create_trace_probe(int argc, char **argv)
return ret; return ret;
} }
static void cleanup_all_probes(void) static void release_all_trace_probes(void)
{ {
struct trace_probe *tp; struct trace_probe *tp;
...@@ -1181,15 +1181,16 @@ static int probes_seq_show(struct seq_file *m, void *v) ...@@ -1181,15 +1181,16 @@ static int probes_seq_show(struct seq_file *m, void *v)
struct trace_probe *tp = v; struct trace_probe *tp = v;
int i; int i;
seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p'); seq_printf(m, "%c", trace_probe_is_return(tp) ? 'r' : 'p');
seq_printf(m, ":%s/%s", tp->call.class->system, tp->call.name); seq_printf(m, ":%s/%s", tp->call.class->system, tp->call.name);
if (!tp->symbol) if (!tp->symbol)
seq_printf(m, " 0x%p", tp->rp.kp.addr); seq_printf(m, " 0x%p", tp->rp.kp.addr);
else if (tp->rp.kp.offset) else if (tp->rp.kp.offset)
seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset); seq_printf(m, " %s+%u", trace_probe_symbol(tp),
tp->rp.kp.offset);
else else
seq_printf(m, " %s", probe_symbol(tp)); seq_printf(m, " %s", trace_probe_symbol(tp));
for (i = 0; i < tp->nr_args; i++) for (i = 0; i < tp->nr_args; i++)
seq_printf(m, " %s=%s", tp->args[i].name, tp->args[i].comm); seq_printf(m, " %s=%s", tp->args[i].name, tp->args[i].comm);
...@@ -1209,7 +1210,7 @@ static int probes_open(struct inode *inode, struct file *file) ...@@ -1209,7 +1210,7 @@ static int probes_open(struct inode *inode, struct file *file)
{ {
if ((file->f_mode & FMODE_WRITE) && if ((file->f_mode & FMODE_WRITE) &&
(file->f_flags & O_TRUNC)) (file->f_flags & O_TRUNC))
cleanup_all_probes(); release_all_trace_probes();
return seq_open(file, &probes_seq_op); return seq_open(file, &probes_seq_op);
} }
...@@ -1518,7 +1519,7 @@ static int probe_event_enable(struct ftrace_event_call *call) ...@@ -1518,7 +1519,7 @@ static int probe_event_enable(struct ftrace_event_call *call)
struct trace_probe *tp = (struct trace_probe *)call->data; struct trace_probe *tp = (struct trace_probe *)call->data;
tp->flags |= TP_FLAG_TRACE; tp->flags |= TP_FLAG_TRACE;
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
return enable_kretprobe(&tp->rp); return enable_kretprobe(&tp->rp);
else else
return enable_kprobe(&tp->rp.kp); return enable_kprobe(&tp->rp.kp);
...@@ -1530,7 +1531,7 @@ static void probe_event_disable(struct ftrace_event_call *call) ...@@ -1530,7 +1531,7 @@ static void probe_event_disable(struct ftrace_event_call *call)
tp->flags &= ~TP_FLAG_TRACE; tp->flags &= ~TP_FLAG_TRACE;
if (!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE))) { if (!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE))) {
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
disable_kretprobe(&tp->rp); disable_kretprobe(&tp->rp);
else else
disable_kprobe(&tp->rp.kp); disable_kprobe(&tp->rp.kp);
...@@ -1598,7 +1599,7 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len) ...@@ -1598,7 +1599,7 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len)
const char *fmt, *arg; const char *fmt, *arg;
if (!probe_is_return(tp)) { if (!trace_probe_is_return(tp)) {
fmt = "(%lx)"; fmt = "(%lx)";
arg = "REC->" FIELD_STRING_IP; arg = "REC->" FIELD_STRING_IP;
} else { } else {
...@@ -1722,7 +1723,7 @@ static int probe_perf_enable(struct ftrace_event_call *call) ...@@ -1722,7 +1723,7 @@ static int probe_perf_enable(struct ftrace_event_call *call)
tp->flags |= TP_FLAG_PROFILE; tp->flags |= TP_FLAG_PROFILE;
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
return enable_kretprobe(&tp->rp); return enable_kretprobe(&tp->rp);
else else
return enable_kprobe(&tp->rp.kp); return enable_kprobe(&tp->rp.kp);
...@@ -1735,7 +1736,7 @@ static void probe_perf_disable(struct ftrace_event_call *call) ...@@ -1735,7 +1736,7 @@ static void probe_perf_disable(struct ftrace_event_call *call)
tp->flags &= ~TP_FLAG_PROFILE; tp->flags &= ~TP_FLAG_PROFILE;
if (!(tp->flags & TP_FLAG_TRACE)) { if (!(tp->flags & TP_FLAG_TRACE)) {
if (probe_is_return(tp)) if (trace_probe_is_return(tp))
disable_kretprobe(&tp->rp); disable_kretprobe(&tp->rp);
else else
disable_kprobe(&tp->rp.kp); disable_kprobe(&tp->rp.kp);
...@@ -1807,7 +1808,7 @@ static int register_probe_event(struct trace_probe *tp) ...@@ -1807,7 +1808,7 @@ static int register_probe_event(struct trace_probe *tp)
/* Initialize ftrace_event_call */ /* Initialize ftrace_event_call */
INIT_LIST_HEAD(&call->class->fields); INIT_LIST_HEAD(&call->class->fields);
if (probe_is_return(tp)) { if (trace_probe_is_return(tp)) {
call->event.funcs = &kretprobe_funcs; call->event.funcs = &kretprobe_funcs;
call->class->define_fields = kretprobe_event_define_fields; call->class->define_fields = kretprobe_event_define_fields;
} else { } else {
...@@ -1899,7 +1900,7 @@ static __init int kprobe_trace_self_tests_init(void) ...@@ -1899,7 +1900,7 @@ static __init int kprobe_trace_self_tests_init(void)
warn++; warn++;
} else { } else {
/* Enable trace point */ /* Enable trace point */
tp = find_probe_event("testprobe", KPROBE_EVENT_SYSTEM); tp = find_trace_probe("testprobe", KPROBE_EVENT_SYSTEM);
if (WARN_ON_ONCE(tp == NULL)) { if (WARN_ON_ONCE(tp == NULL)) {
pr_warning("error on getting new probe.\n"); pr_warning("error on getting new probe.\n");
warn++; warn++;
...@@ -1914,7 +1915,7 @@ static __init int kprobe_trace_self_tests_init(void) ...@@ -1914,7 +1915,7 @@ static __init int kprobe_trace_self_tests_init(void)
warn++; warn++;
} else { } else {
/* Enable trace point */ /* Enable trace point */
tp = find_probe_event("testprobe2", KPROBE_EVENT_SYSTEM); tp = find_trace_probe("testprobe2", KPROBE_EVENT_SYSTEM);
if (WARN_ON_ONCE(tp == NULL)) { if (WARN_ON_ONCE(tp == NULL)) {
pr_warning("error on getting new probe.\n"); pr_warning("error on getting new probe.\n");
warn++; warn++;
...@@ -1940,7 +1941,7 @@ static __init int kprobe_trace_self_tests_init(void) ...@@ -1940,7 +1941,7 @@ static __init int kprobe_trace_self_tests_init(void)
} }
end: end:
cleanup_all_probes(); release_all_trace_probes();
if (warn) if (warn)
pr_cont("NG: Some tests are failed. Please check them.\n"); pr_cont("NG: Some tests are failed. Please check them.\n");
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment