History

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.

Masami Hiramatsu committed 15 years ago

Commit 7143f161 parent f9129871 file · +22 −21Browse files

Showing the changes to kernel/trace (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_kprobe.c+22−21
@@ -555,12 +555,12 @@ struct trace_probe { · 554 unmodified lines
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) · 104 unmodified lines
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, · 8 unmodified lines
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 else691 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) · 10 unmodified lines
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) · 6 unmodified lines
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 else721 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) · 302 unmodified lines
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: · 112 unmodified lines
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) · 30 unmodified lines
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 else1192 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) · 13 unmodified lines
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) · 302 unmodified lines
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 else1524 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) · 5 unmodified lines
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 else1536 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) · 61 unmodified lines
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) · 117 unmodified lines
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 else1728 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) · 6 unmodified lines
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 else1741 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) · 65 unmodified lines
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) · 85 unmodified lines
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) · 8 unmodified lines
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) · 19 unmodified lines
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 else1947 else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t