Commit | Line | Data |
---|---|---|
5a9479dc MD |
1 | #ifndef _LTT_WRAPPER_FTRACE_H |
2 | #define _LTT_WRAPPER_FTRACE_H | |
3 | ||
4 | /* | |
5 | * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) | |
6 | * | |
7 | * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when | |
8 | * available, else we need to have a kernel that exports this function to GPL | |
9 | * modules. | |
10 | * | |
11 | * Dual LGPL v2.1/GPL v2 license. | |
12 | */ | |
13 | ||
14 | #include <linux/ftrace.h> | |
15 | ||
16 | #ifdef CONFIG_KALLSYMS | |
17 | ||
18 | #include <linux/kallsyms.h> | |
19 | ||
20 | static inline | |
21 | int wrapper_register_ftrace_function_probe(char *glob, | |
22 | struct ftrace_probe_ops *ops, void *data) | |
23 | { | |
24 | int (*register_ftrace_function_probe_sym)(char *glob, | |
25 | struct ftrace_probe_ops *ops, void *data); | |
26 | ||
27 | register_ftrace_function_probe_sym = (void *) kallsyms_lookup_name("register_ftrace_function_probe_sym"); | |
28 | if (register_ftrace_function_probe_sym) { | |
29 | return register_ftrace_function_probe_sym(glob, ops, data); | |
30 | } else { | |
31 | printk(KERN_WARNING "LTTng: register_ftrace_function_probe symbol lookup failed.\n"); | |
32 | return -EINVAL; | |
33 | } | |
34 | } | |
35 | ||
36 | static inline | |
37 | void wrapper_unregister_ftrace_function_probe(char *glob, | |
38 | struct ftrace_probe_ops *ops, void *data) | |
39 | { | |
40 | void (*unregister_ftrace_function_probe_sym)(char *glob, | |
41 | struct ftrace_probe_ops *ops, void *data); | |
42 | ||
43 | unregister_ftrace_function_probe_sym = (void *) kallsyms_lookup_name("unregister_ftrace_function_probe_sym"); | |
44 | if (unregister_ftrace_function_probe_sym) { | |
45 | unregister_ftrace_function_probe_sym(glob, ops, data); | |
46 | } else { | |
47 | printk(KERN_WARNING "LTTng: unregister_ftrace_function_probe symbol lookup failed.\n"); | |
48 | WARN_ON(1); | |
49 | } | |
50 | } | |
51 | ||
52 | #else | |
53 | ||
54 | static inline | |
55 | int wrapper_register_ftrace_function_probe(char *glob, | |
56 | struct ftrace_probe_ops *ops, void *data); | |
57 | ||
58 | { | |
59 | return unregister_ftrace_function_probe(); | |
60 | } | |
61 | ||
62 | static inline | |
63 | void wrapper_unregister_ftrace_function_probe(char *glob, | |
64 | struct ftrace_probe_ops *ops, void *data); | |
65 | { | |
66 | return unregister_ftrace_function_probe(); | |
67 | } | |
68 | #endif | |
69 | ||
70 | #endif /* _LTT_WRAPPER_FTRACE_H */ |