]> git.baikalelectronics.ru Git - kernel.git/commitdiff
trace_syscalls: Remove duplicate init_enter_##sname()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 1 Dec 2009 08:23:55 +0000 (16:23 +0800)
committerIngo Molnar <mingo@elte.hu>
Tue, 1 Dec 2009 16:33:30 +0000 (17:33 +0100)
use only one init_syscall_trace instead of
many init_enter_##sname()/init_exit_##sname()

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B14D29B.6090708@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/syscalls.h
include/trace/syscall.h
kernel/trace/trace_syscalls.c

index 3c280d7ecb7656d50aff9a2f7ca1391ddac6b294..cf0d923ea40e17fff5e5c883433d86a16ced2e53 100644 (file)
@@ -158,19 +158,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
        struct trace_event enter_syscall_print_##sname = {              \
                .trace                  = print_syscall_enter,          \
        };                                                              \
-       static int init_enter_##sname(struct ftrace_event_call *call)   \
-       {                                                               \
-               int num, id;                                            \
-               num = __syscall_meta_##sname.syscall_nr;                \
-               if (num < 0)                                            \
-                       return -ENOSYS;                                 \
-               id = register_ftrace_event(&enter_syscall_print_##sname);\
-               if (!id)                                                \
-                       return -ENODEV;                                 \
-               event_enter_##sname.id = id;                            \
-               INIT_LIST_HEAD(&event_enter_##sname.fields);            \
-               return 0;                                               \
-       }                                                               \
        TRACE_SYS_ENTER_PROFILE(sname);                                 \
        static struct ftrace_event_call __used                          \
          __attribute__((__aligned__(4)))                               \
@@ -179,7 +166,7 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
                .name                   = "sys_enter"#sname,            \
                .system                 = "syscalls",                   \
                .event                  = &enter_syscall_print_##sname, \
-               .raw_init               = init_enter_##sname,           \
+               .raw_init               = init_syscall_trace,           \
                .show_format            = syscall_enter_format,         \
                .define_fields          = syscall_enter_define_fields,  \
                .regfunc                = reg_event_syscall_enter,      \
@@ -194,19 +181,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
        struct trace_event exit_syscall_print_##sname = {               \
                .trace                  = print_syscall_exit,           \
        };                                                              \
-       static int init_exit_##sname(struct ftrace_event_call *call)    \
-       {                                                               \
-               int num, id;                                            \
-               num = __syscall_meta_##sname.syscall_nr;                \
-               if (num < 0)                                            \
-                       return -ENOSYS;                                 \
-               id = register_ftrace_event(&exit_syscall_print_##sname);\
-               if (!id)                                                \
-                       return -ENODEV;                                 \
-               event_exit_##sname.id = id;                             \
-               INIT_LIST_HEAD(&event_exit_##sname.fields);             \
-               return 0;                                               \
-       }                                                               \
        TRACE_SYS_EXIT_PROFILE(sname);                                  \
        static struct ftrace_event_call __used                          \
          __attribute__((__aligned__(4)))                               \
@@ -215,7 +189,7 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
                .name                   = "sys_exit"#sname,             \
                .system                 = "syscalls",                   \
                .event                  = &exit_syscall_print_##sname,  \
-               .raw_init               = init_exit_##sname,            \
+               .raw_init               = init_syscall_trace,           \
                .show_format            = syscall_exit_format,          \
                .define_fields          = syscall_exit_define_fields,   \
                .regfunc                = reg_event_syscall_exit,       \
index 1531eef3071f8ddd10654fd32ce0a6abab83314b..dff9371e5274036124757d98ea8b62bad8283929 100644 (file)
@@ -32,6 +32,7 @@ struct syscall_metadata {
 
 #ifdef CONFIG_FTRACE_SYSCALLS
 extern unsigned long arch_syscall_addr(int nr);
+extern int init_syscall_trace(struct ftrace_event_call *call);
 
 extern int syscall_enter_format(struct ftrace_event_call *call,
                                struct trace_seq *s);
index 144cc14d85519ed8de66d1968f3ee97ebbdbf893..c6514093c95a15f6a5f84e4617775c3f47b16c03 100644 (file)
@@ -412,6 +412,18 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call)
        mutex_unlock(&syscall_trace_lock);
 }
 
+int init_syscall_trace(struct ftrace_event_call *call)
+{
+       int id;
+
+       id = register_ftrace_event(call->event);
+       if (!id)
+               return -ENODEV;
+       call->id = id;
+       INIT_LIST_HEAD(&call->fields);
+       return 0;
+}
+
 int __init init_ftrace_syscalls(void)
 {
        struct syscall_metadata *meta;