aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_uprobe.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-01-31 13:47:23 -0500
committerOleg Nesterov <oleg@redhat.com>2013-02-08 12:24:33 -0500
commita932b7381f81235530c3d0acbd3ba2c7537d78e5 (patch)
tree01fb4bbdd21cb67c63b6302ffbbbda22fdcbebcd /kernel/trace/trace_uprobe.c
parentb64b007797c1e6d6b745c93c296ba1d5f4d72d86 (diff)
uprobes/tracing: Kill uprobe_trace_consumer, embed uprobe_consumer into trace_uprobe
trace_uprobe->consumer and "struct uprobe_trace_consumer" add the unnecessary indirection and complicate the code for no reason. This patch simply embeds uprobe_consumer into "struct trace_uprobe", all other changes only fix the compilation errors. Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel/trace/trace_uprobe.c')
-rw-r--r--kernel/trace/trace_uprobe.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index d6c6e2a345a7..9c8babbfd11b 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -31,17 +31,11 @@
31/* 31/*
32 * uprobe event core functions 32 * uprobe event core functions
33 */ 33 */
34struct trace_uprobe;
35struct uprobe_trace_consumer {
36 struct uprobe_consumer cons;
37 struct trace_uprobe *tu;
38};
39
40struct trace_uprobe { 34struct trace_uprobe {
41 struct list_head list; 35 struct list_head list;
42 struct ftrace_event_class class; 36 struct ftrace_event_class class;
43 struct ftrace_event_call call; 37 struct ftrace_event_call call;
44 struct uprobe_trace_consumer *consumer; 38 struct uprobe_consumer consumer;
45 struct inode *inode; 39 struct inode *inode;
46 char *filename; 40 char *filename;
47 unsigned long offset; 41 unsigned long offset;
@@ -92,6 +86,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs)
92 goto error; 86 goto error;
93 87
94 INIT_LIST_HEAD(&tu->list); 88 INIT_LIST_HEAD(&tu->list);
89 tu->consumer.handler = uprobe_dispatcher;
95 return tu; 90 return tu;
96 91
97error: 92error:
@@ -546,27 +541,15 @@ static inline bool is_trace_uprobe_enabled(struct trace_uprobe *tu)
546 541
547static int probe_event_enable(struct trace_uprobe *tu, int flag) 542static int probe_event_enable(struct trace_uprobe *tu, int flag)
548{ 543{
549 struct uprobe_trace_consumer *utc;
550 int ret = 0; 544 int ret = 0;
551 545
552 if (is_trace_uprobe_enabled(tu)) 546 if (is_trace_uprobe_enabled(tu))
553 return -EINTR; 547 return -EINTR;
554 548
555 utc = kzalloc(sizeof(struct uprobe_trace_consumer), GFP_KERNEL);
556 if (!utc)
557 return -EINTR;
558
559 utc->cons.handler = uprobe_dispatcher;
560 utc->tu = tu;
561 tu->consumer = utc;
562 tu->flags |= flag; 549 tu->flags |= flag;
563 550 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
564 ret = uprobe_register(tu->inode, tu->offset, &utc->cons); 551 if (ret)
565 if (ret) {
566 tu->consumer = NULL;
567 tu->flags &= ~flag; 552 tu->flags &= ~flag;
568 kfree(utc);
569 }
570 553
571 return ret; 554 return ret;
572} 555}
@@ -576,10 +559,8 @@ static void probe_event_disable(struct trace_uprobe *tu, int flag)
576 if (!is_trace_uprobe_enabled(tu)) 559 if (!is_trace_uprobe_enabled(tu))
577 return; 560 return;
578 561
579 uprobe_unregister(tu->inode, tu->offset, &tu->consumer->cons); 562 uprobe_unregister(tu->inode, tu->offset, &tu->consumer);
580 tu->flags &= ~flag; 563 tu->flags &= ~flag;
581 kfree(tu->consumer);
582 tu->consumer = NULL;
583} 564}
584 565
585static int uprobe_event_define_fields(struct ftrace_event_call *event_call) 566static int uprobe_event_define_fields(struct ftrace_event_call *event_call)
@@ -717,13 +698,9 @@ int trace_uprobe_register(struct ftrace_event_call *event, enum trace_reg type,
717 698
718static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) 699static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs)
719{ 700{
720 struct uprobe_trace_consumer *utc;
721 struct trace_uprobe *tu; 701 struct trace_uprobe *tu;
722 702
723 utc = container_of(con, struct uprobe_trace_consumer, cons); 703 tu = container_of(con, struct trace_uprobe, consumer);
724 tu = utc->tu;
725 if (!tu || tu->consumer != utc)
726 return 0;
727 704
728 if (tu->flags & TP_FLAG_TRACE) 705 if (tu->flags & TP_FLAG_TRACE)
729 uprobe_trace_func(tu, regs); 706 uprobe_trace_func(tu, regs);