diff options
author | zhangwei(Jovi) <jovi.zhangwei@huawei.com> | 2013-03-11 03:13:42 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-03-15 13:22:07 -0400 |
commit | b3a8c6fd7bb61c910bd4f80ae1d75056e8f98c19 (patch) | |
tree | 6f99dd222887d6ec1b5ba785863d3ad1cd0156ff /kernel/trace | |
parent | bd6df18716fa45bc4aa9587aca033de909e5382b (diff) |
tracing: Move find_event_field() into trace_events.c
By moving find_event_field() and trace_find_field() into trace_events.c,
the ftrace_common_fields list and trace_get_fields() can become local to
the trace_events.c file.
find_event_field() is renamed to trace_find_event_field() to conform to
the tracing global function names.
Link: http://lkml.kernel.org/r/513D8426.9070109@huawei.com
Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
[ rostedt: Modified trace_find_field() to trace_find_event_field() ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.h | 6 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 31 | ||||
-rw-r--r-- | kernel/trace/trace_events_filter.c | 29 |
3 files changed, 32 insertions, 34 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 5cc52361bc9f..9e014582e763 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -995,8 +995,6 @@ struct filter_pred { | |||
995 | unsigned short right; | 995 | unsigned short right; |
996 | }; | 996 | }; |
997 | 997 | ||
998 | extern struct list_head ftrace_common_fields; | ||
999 | |||
1000 | extern enum regex_type | 998 | extern enum regex_type |
1001 | filter_parse_regex(char *buff, int len, char **search, int *not); | 999 | filter_parse_regex(char *buff, int len, char **search, int *not); |
1002 | extern void print_event_filter(struct ftrace_event_call *call, | 1000 | extern void print_event_filter(struct ftrace_event_call *call, |
@@ -1009,8 +1007,8 @@ extern void print_subsystem_event_filter(struct event_subsystem *system, | |||
1009 | struct trace_seq *s); | 1007 | struct trace_seq *s); |
1010 | extern int filter_assign_type(const char *type); | 1008 | extern int filter_assign_type(const char *type); |
1011 | 1009 | ||
1012 | struct list_head * | 1010 | struct ftrace_event_field * |
1013 | trace_get_fields(struct ftrace_event_call *event_call); | 1011 | trace_find_event_field(struct ftrace_event_call *call, char *name); |
1014 | 1012 | ||
1015 | static inline int | 1013 | static inline int |
1016 | filter_check_discard(struct ftrace_event_call *call, void *rec, | 1014 | filter_check_discard(struct ftrace_event_call *call, void *rec, |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index c636523b1a59..ba523d7beea2 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -34,7 +34,7 @@ char event_storage[EVENT_STORAGE_SIZE]; | |||
34 | EXPORT_SYMBOL_GPL(event_storage); | 34 | EXPORT_SYMBOL_GPL(event_storage); |
35 | 35 | ||
36 | LIST_HEAD(ftrace_events); | 36 | LIST_HEAD(ftrace_events); |
37 | LIST_HEAD(ftrace_common_fields); | 37 | static LIST_HEAD(ftrace_common_fields); |
38 | 38 | ||
39 | #define GFP_TRACE (GFP_KERNEL | __GFP_ZERO) | 39 | #define GFP_TRACE (GFP_KERNEL | __GFP_ZERO) |
40 | 40 | ||
@@ -54,7 +54,7 @@ static struct kmem_cache *file_cachep; | |||
54 | #define while_for_each_event_file() \ | 54 | #define while_for_each_event_file() \ |
55 | } | 55 | } |
56 | 56 | ||
57 | struct list_head * | 57 | static struct list_head * |
58 | trace_get_fields(struct ftrace_event_call *event_call) | 58 | trace_get_fields(struct ftrace_event_call *event_call) |
59 | { | 59 | { |
60 | if (!event_call->class->get_fields) | 60 | if (!event_call->class->get_fields) |
@@ -62,6 +62,33 @@ trace_get_fields(struct ftrace_event_call *event_call) | |||
62 | return event_call->class->get_fields(event_call); | 62 | return event_call->class->get_fields(event_call); |
63 | } | 63 | } |
64 | 64 | ||
65 | static struct ftrace_event_field * | ||
66 | __find_event_field(struct list_head *head, char *name) | ||
67 | { | ||
68 | struct ftrace_event_field *field; | ||
69 | |||
70 | list_for_each_entry(field, head, link) { | ||
71 | if (!strcmp(field->name, name)) | ||
72 | return field; | ||
73 | } | ||
74 | |||
75 | return NULL; | ||
76 | } | ||
77 | |||
78 | struct ftrace_event_field * | ||
79 | trace_find_event_field(struct ftrace_event_call *call, char *name) | ||
80 | { | ||
81 | struct ftrace_event_field *field; | ||
82 | struct list_head *head; | ||
83 | |||
84 | field = __find_event_field(&ftrace_common_fields, name); | ||
85 | if (field) | ||
86 | return field; | ||
87 | |||
88 | head = trace_get_fields(call); | ||
89 | return __find_event_field(head, name); | ||
90 | } | ||
91 | |||
65 | static int __trace_define_field(struct list_head *head, const char *type, | 92 | static int __trace_define_field(struct list_head *head, const char *type, |
66 | const char *name, int offset, int size, | 93 | const char *name, int offset, int size, |
67 | int is_signed, int filter_type) | 94 | int is_signed, int filter_type) |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 2a22a177ab44..a6361178de5a 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -658,33 +658,6 @@ void print_subsystem_event_filter(struct event_subsystem *system, | |||
658 | mutex_unlock(&event_mutex); | 658 | mutex_unlock(&event_mutex); |
659 | } | 659 | } |
660 | 660 | ||
661 | static struct ftrace_event_field * | ||
662 | __find_event_field(struct list_head *head, char *name) | ||
663 | { | ||
664 | struct ftrace_event_field *field; | ||
665 | |||
666 | list_for_each_entry(field, head, link) { | ||
667 | if (!strcmp(field->name, name)) | ||
668 | return field; | ||
669 | } | ||
670 | |||
671 | return NULL; | ||
672 | } | ||
673 | |||
674 | static struct ftrace_event_field * | ||
675 | find_event_field(struct ftrace_event_call *call, char *name) | ||
676 | { | ||
677 | struct ftrace_event_field *field; | ||
678 | struct list_head *head; | ||
679 | |||
680 | field = __find_event_field(&ftrace_common_fields, name); | ||
681 | if (field) | ||
682 | return field; | ||
683 | |||
684 | head = trace_get_fields(call); | ||
685 | return __find_event_field(head, name); | ||
686 | } | ||
687 | |||
688 | static int __alloc_pred_stack(struct pred_stack *stack, int n_preds) | 661 | static int __alloc_pred_stack(struct pred_stack *stack, int n_preds) |
689 | { | 662 | { |
690 | stack->preds = kcalloc(n_preds + 1, sizeof(*stack->preds), GFP_KERNEL); | 663 | stack->preds = kcalloc(n_preds + 1, sizeof(*stack->preds), GFP_KERNEL); |
@@ -1337,7 +1310,7 @@ static struct filter_pred *create_pred(struct filter_parse_state *ps, | |||
1337 | return NULL; | 1310 | return NULL; |
1338 | } | 1311 | } |
1339 | 1312 | ||
1340 | field = find_event_field(call, operand1); | 1313 | field = trace_find_event_field(call, operand1); |
1341 | if (!field) { | 1314 | if (!field) { |
1342 | parse_error(ps, FILT_ERR_FIELD_NOT_FOUND, 0); | 1315 | parse_error(ps, FILT_ERR_FIELD_NOT_FOUND, 0); |
1343 | return NULL; | 1316 | return NULL; |