Revert poll exclusive
[deliverable/lttng-modules.git] / wrapper / ftrace.h
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");
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");
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 return unregister_ftrace_function_probe();
59 }
60
61 static inline
62 void wrapper_unregister_ftrace_function_probe(char *glob,
63 struct ftrace_probe_ops *ops, void *data)
64 {
65 return unregister_ftrace_function_probe();
66 }
67 #endif
68
69 #endif /* _LTT_WRAPPER_FTRACE_H */
This page took 0.035722 seconds and 5 git commands to generate.