tracing: Move find_event_field() into trace_events.c
authorzhangwei(Jovi) <jovi.zhangwei@huawei.com>
Mon, 11 Mar 2013 07:13:42 +0000 (15:13 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 17:22:07 +0000 (13:22 -0400)
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>
kernel/trace/trace.h
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c

index 5cc52361bc9f934a319b081f71fd435de827103b..9e014582e7639c145b86728b6c3db95eac27500b 100644 (file)
@@ -995,8 +995,6 @@ struct filter_pred {
        unsigned short          right;
 };
 
-extern struct list_head ftrace_common_fields;
-
 extern enum regex_type
 filter_parse_regex(char *buff, int len, char **search, int *not);
 extern void print_event_filter(struct ftrace_event_call *call,
@@ -1009,8 +1007,8 @@ extern void print_subsystem_event_filter(struct event_subsystem *system,
                                         struct trace_seq *s);
 extern int filter_assign_type(const char *type);
 
-struct list_head *
-trace_get_fields(struct ftrace_event_call *event_call);
+struct ftrace_event_field *
+trace_find_event_field(struct ftrace_event_call *call, char *name);
 
 static inline int
 filter_check_discard(struct ftrace_event_call *call, void *rec,
index c636523b1a5910f7aa138cc5f500758134245fc8..ba523d7beea2e571f4d9eec437208b0702c62c7b 100644 (file)
@@ -34,7 +34,7 @@ char event_storage[EVENT_STORAGE_SIZE];
 EXPORT_SYMBOL_GPL(event_storage);
 
 LIST_HEAD(ftrace_events);
-LIST_HEAD(ftrace_common_fields);
+static LIST_HEAD(ftrace_common_fields);
 
 #define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)
 
@@ -54,7 +54,7 @@ static struct kmem_cache *file_cachep;
 #define while_for_each_event_file()            \
        }
 
-struct list_head *
+static struct list_head *
 trace_get_fields(struct ftrace_event_call *event_call)
 {
        if (!event_call->class->get_fields)
@@ -62,6 +62,33 @@ trace_get_fields(struct ftrace_event_call *event_call)
        return event_call->class->get_fields(event_call);
 }
 
+static struct ftrace_event_field *
+__find_event_field(struct list_head *head, char *name)
+{
+       struct ftrace_event_field *field;
+
+       list_for_each_entry(field, head, link) {
+               if (!strcmp(field->name, name))
+                       return field;
+       }
+
+       return NULL;
+}
+
+struct ftrace_event_field *
+trace_find_event_field(struct ftrace_event_call *call, char *name)
+{
+       struct ftrace_event_field *field;
+       struct list_head *head;
+
+       field = __find_event_field(&ftrace_common_fields, name);
+       if (field)
+               return field;
+
+       head = trace_get_fields(call);
+       return __find_event_field(head, name);
+}
+
 static int __trace_define_field(struct list_head *head, const char *type,
                                const char *name, int offset, int size,
                                int is_signed, int filter_type)
index 2a22a177ab44ec5c9be7a2bcdd2cf29554b6b969..a6361178de5ae4e17d0501db852a06ae80b06cf4 100644 (file)
@@ -658,33 +658,6 @@ void print_subsystem_event_filter(struct event_subsystem *system,
        mutex_unlock(&event_mutex);
 }
 
-static struct ftrace_event_field *
-__find_event_field(struct list_head *head, char *name)
-{
-       struct ftrace_event_field *field;
-
-       list_for_each_entry(field, head, link) {
-               if (!strcmp(field->name, name))
-                       return field;
-       }
-
-       return NULL;
-}
-
-static struct ftrace_event_field *
-find_event_field(struct ftrace_event_call *call, char *name)
-{
-       struct ftrace_event_field *field;
-       struct list_head *head;
-
-       field = __find_event_field(&ftrace_common_fields, name);
-       if (field)
-               return field;
-
-       head = trace_get_fields(call);
-       return __find_event_field(head, name);
-}
-
 static int __alloc_pred_stack(struct pred_stack *stack, int n_preds)
 {
        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,
                return NULL;
        }
 
-       field = find_event_field(call, operand1);
+       field = trace_find_event_field(call, operand1);
        if (!field) {
                parse_error(ps, FILT_ERR_FIELD_NOT_FOUND, 0);
                return NULL;