aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_kprobe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2011-06-27 03:26:36 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-07-14 17:44:43 -0400
commit7143f168e2aa4bc7f8a8bcfe46d8dc52f7be869a (patch)
treecd13a0d2524b9ef4c6f807d01912147539c924b8 /kernel/trace/trace_kprobe.c
parentf91298709790b9a483752ca3c967845537df2af3 (diff)
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: Masami 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@fedora15 Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r--kernel/trace/trace_kprobe.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 7db7b68c6c37..14b88ed65bb7 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -555,12 +555,12 @@ struct trace_probe {
555 (sizeof(struct probe_arg) * (n))) 555 (sizeof(struct probe_arg) * (n)))
556 556
557 557
558static __kprobes int probe_is_return(struct trace_probe *tp) 558static __kprobes int trace_probe_is_return(struct trace_probe *tp)
559{ 559{
560 return tp->rp.handler != NULL; 560 return tp->rp.handler != NULL;
561} 561}
562 562
563static __kprobes const char *probe_symbol(struct trace_probe *tp) 563static __kprobes const char *trace_probe_symbol(struct trace_probe *tp)
564{ 564{
565 return tp->symbol ? tp->symbol : "unknown"; 565 return tp->symbol ? tp->symbol : "unknown";
566} 566}
@@ -671,7 +671,7 @@ static void free_trace_probe(struct trace_probe *tp)
671 kfree(tp); 671 kfree(tp);
672} 672}
673 673
674static struct trace_probe *find_probe_event(const char *event, 674static struct trace_probe *find_trace_probe(const char *event,
675 const char *group) 675 const char *group)
676{ 676{
677 struct trace_probe *tp; 677 struct trace_probe *tp;
@@ -686,7 +686,7 @@ static struct trace_probe *find_probe_event(const char *event,
686/* Unregister a trace_probe and probe_event: call with locking probe_lock */ 686/* Unregister a trace_probe and probe_event: call with locking probe_lock */
687static void unregister_trace_probe(struct trace_probe *tp) 687static void unregister_trace_probe(struct trace_probe *tp)
688{ 688{
689 if (probe_is_return(tp)) 689 if (trace_probe_is_return(tp))
690 unregister_kretprobe(&tp->rp); 690 unregister_kretprobe(&tp->rp);
691 else 691 else
692 unregister_kprobe(&tp->rp.kp); 692 unregister_kprobe(&tp->rp.kp);
@@ -703,7 +703,7 @@ static int register_trace_probe(struct trace_probe *tp)
703 mutex_lock(&probe_lock); 703 mutex_lock(&probe_lock);
704 704
705 /* register as an event */ 705 /* register as an event */
706 old_tp = find_probe_event(tp->call.name, tp->call.class->system); 706 old_tp = find_trace_probe(tp->call.name, tp->call.class->system);
707 if (old_tp) { 707 if (old_tp) {
708 /* delete old event */ 708 /* delete old event */
709 unregister_trace_probe(old_tp); 709 unregister_trace_probe(old_tp);
@@ -716,7 +716,7 @@ static int register_trace_probe(struct trace_probe *tp)
716 } 716 }
717 717
718 tp->rp.kp.flags |= KPROBE_FLAG_DISABLED; 718 tp->rp.kp.flags |= KPROBE_FLAG_DISABLED;
719 if (probe_is_return(tp)) 719 if (trace_probe_is_return(tp))
720 ret = register_kretprobe(&tp->rp); 720 ret = register_kretprobe(&tp->rp);
721 else 721 else
722 ret = register_kprobe(&tp->rp.kp); 722 ret = register_kprobe(&tp->rp.kp);
@@ -1025,7 +1025,7 @@ static int create_trace_probe(int argc, char **argv)
1025 return -EINVAL; 1025 return -EINVAL;
1026 } 1026 }
1027 mutex_lock(&probe_lock); 1027 mutex_lock(&probe_lock);
1028 tp = find_probe_event(event, group); 1028 tp = find_trace_probe(event, group);
1029 if (!tp) { 1029 if (!tp) {
1030 mutex_unlock(&probe_lock); 1030 mutex_unlock(&probe_lock);
1031 pr_info("Event %s/%s doesn't exist.\n", group, event); 1031 pr_info("Event %s/%s doesn't exist.\n", group, event);
@@ -1144,7 +1144,7 @@ error:
1144 return ret; 1144 return ret;
1145} 1145}
1146 1146
1147static void cleanup_all_probes(void) 1147static void release_all_trace_probes(void)
1148{ 1148{
1149 struct trace_probe *tp; 1149 struct trace_probe *tp;
1150 1150
@@ -1181,15 +1181,16 @@ static int probes_seq_show(struct seq_file *m, void *v)
1181 struct trace_probe *tp = v; 1181 struct trace_probe *tp = v;
1182 int i; 1182 int i;
1183 1183
1184 seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p'); 1184 seq_printf(m, "%c", trace_probe_is_return(tp) ? 'r' : 'p');
1185 seq_printf(m, ":%s/%s", tp->call.class->system, tp->call.name); 1185 seq_printf(m, ":%s/%s", tp->call.class->system, tp->call.name);
1186 1186
1187 if (!tp->symbol) 1187 if (!tp->symbol)
1188 seq_printf(m, " 0x%p", tp->rp.kp.addr); 1188 seq_printf(m, " 0x%p", tp->rp.kp.addr);
1189 else if (tp->rp.kp.offset) 1189 else if (tp->rp.kp.offset)
1190 seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset); 1190 seq_printf(m, " %s+%u", trace_probe_symbol(tp),
1191 tp->rp.kp.offset);
1191 else 1192 else
1192 seq_printf(m, " %s", probe_symbol(tp)); 1193 seq_printf(m, " %s", trace_probe_symbol(tp));
1193 1194
1194 for (i = 0; i < tp->nr_args; i++) 1195 for (i = 0; i < tp->nr_args; i++)
1195 seq_printf(m, " %s=%s", tp->args[i].name, tp->args[i].comm); 1196 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{ 1210{
1210 if ((file->f_mode & FMODE_WRITE) && 1211 if ((file->f_mode & FMODE_WRITE) &&
1211 (file->f_flags & O_TRUNC)) 1212 (file->f_flags & O_TRUNC))
1212 cleanup_all_probes(); 1213 release_all_trace_probes();
1213 1214
1214 return seq_open(file, &probes_seq_op); 1215 return seq_open(file, &probes_seq_op);
1215} 1216}
@@ -1518,7 +1519,7 @@ static int probe_event_enable(struct ftrace_event_call *call)
1518 struct trace_probe *tp = (struct trace_probe *)call->data; 1519 struct trace_probe *tp = (struct trace_probe *)call->data;
1519 1520
1520 tp->flags |= TP_FLAG_TRACE; 1521 tp->flags |= TP_FLAG_TRACE;
1521 if (probe_is_return(tp)) 1522 if (trace_probe_is_return(tp))
1522 return enable_kretprobe(&tp->rp); 1523 return enable_kretprobe(&tp->rp);
1523 else 1524 else
1524 return enable_kprobe(&tp->rp.kp); 1525 return enable_kprobe(&tp->rp.kp);
@@ -1530,7 +1531,7 @@ static void probe_event_disable(struct ftrace_event_call *call)
1530 1531
1531 tp->flags &= ~TP_FLAG_TRACE; 1532 tp->flags &= ~TP_FLAG_TRACE;
1532 if (!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE))) { 1533 if (!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE))) {
1533 if (probe_is_return(tp)) 1534 if (trace_probe_is_return(tp))
1534 disable_kretprobe(&tp->rp); 1535 disable_kretprobe(&tp->rp);
1535 else 1536 else
1536 disable_kprobe(&tp->rp.kp); 1537 disable_kprobe(&tp->rp.kp);
@@ -1598,7 +1599,7 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len)
1598 1599
1599 const char *fmt, *arg; 1600 const char *fmt, *arg;
1600 1601
1601 if (!probe_is_return(tp)) { 1602 if (!trace_probe_is_return(tp)) {
1602 fmt = "(%lx)"; 1603 fmt = "(%lx)";
1603 arg = "REC->" FIELD_STRING_IP; 1604 arg = "REC->" FIELD_STRING_IP;
1604 } else { 1605 } else {
@@ -1722,7 +1723,7 @@ static int probe_perf_enable(struct ftrace_event_call *call)
1722 1723
1723 tp->flags |= TP_FLAG_PROFILE; 1724 tp->flags |= TP_FLAG_PROFILE;
1724 1725
1725 if (probe_is_return(tp)) 1726 if (trace_probe_is_return(tp))
1726 return enable_kretprobe(&tp->rp); 1727 return enable_kretprobe(&tp->rp);
1727 else 1728 else
1728 return enable_kprobe(&tp->rp.kp); 1729 return enable_kprobe(&tp->rp.kp);
@@ -1735,7 +1736,7 @@ static void probe_perf_disable(struct ftrace_event_call *call)
1735 tp->flags &= ~TP_FLAG_PROFILE; 1736 tp->flags &= ~TP_FLAG_PROFILE;
1736 1737
1737 if (!(tp->flags & TP_FLAG_TRACE)) { 1738 if (!(tp->flags & TP_FLAG_TRACE)) {
1738 if (probe_is_return(tp)) 1739 if (trace_probe_is_return(tp))
1739 disable_kretprobe(&tp->rp); 1740 disable_kretprobe(&tp->rp);
1740 else 1741 else
1741 disable_kprobe(&tp->rp.kp); 1742 disable_kprobe(&tp->rp.kp);
@@ -1807,7 +1808,7 @@ static int register_probe_event(struct trace_probe *tp)
1807 1808
1808 /* Initialize ftrace_event_call */ 1809 /* Initialize ftrace_event_call */
1809 INIT_LIST_HEAD(&call->class->fields); 1810 INIT_LIST_HEAD(&call->class->fields);
1810 if (probe_is_return(tp)) { 1811 if (trace_probe_is_return(tp)) {
1811 call->event.funcs = &kretprobe_funcs; 1812 call->event.funcs = &kretprobe_funcs;
1812 call->class->define_fields = kretprobe_event_define_fields; 1813 call->class->define_fields = kretprobe_event_define_fields;
1813 } else { 1814 } else {
@@ -1899,7 +1900,7 @@ static __init int kprobe_trace_self_tests_init(void)
1899 warn++; 1900 warn++;
1900 } else { 1901 } else {
1901 /* Enable trace point */ 1902 /* Enable trace point */
1902 tp = find_probe_event("testprobe", KPROBE_EVENT_SYSTEM); 1903 tp = find_trace_probe("testprobe", KPROBE_EVENT_SYSTEM);
1903 if (WARN_ON_ONCE(tp == NULL)) { 1904 if (WARN_ON_ONCE(tp == NULL)) {
1904 pr_warning("error on getting new probe.\n"); 1905 pr_warning("error on getting new probe.\n");
1905 warn++; 1906 warn++;
@@ -1914,7 +1915,7 @@ static __init int kprobe_trace_self_tests_init(void)
1914 warn++; 1915 warn++;
1915 } else { 1916 } else {
1916 /* Enable trace point */ 1917 /* Enable trace point */
1917 tp = find_probe_event("testprobe2", KPROBE_EVENT_SYSTEM); 1918 tp = find_trace_probe("testprobe2", KPROBE_EVENT_SYSTEM);
1918 if (WARN_ON_ONCE(tp == NULL)) { 1919 if (WARN_ON_ONCE(tp == NULL)) {
1919 pr_warning("error on getting new probe.\n"); 1920 pr_warning("error on getting new probe.\n");
1920 warn++; 1921 warn++;
@@ -1940,7 +1941,7 @@ static __init int kprobe_trace_self_tests_init(void)
1940 } 1941 }
1941 1942
1942end: 1943end:
1943 cleanup_all_probes(); 1944 release_all_trace_probes();
1944 if (warn) 1945 if (warn)
1945 pr_cont("NG: Some tests are failed. Please check them.\n"); 1946 pr_cont("NG: Some tests are failed. Please check them.\n");
1946 else 1947 else