Fix: timer_expire_entry changed in 4.19.312
[lttng-modules.git] / wrapper / ftrace.h
1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
3 * wrapper/ftrace.h
4 *
5 * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
6 * available, else we need to have a kernel that exports this function to GPL
7 * modules.
8 *
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 */
11
12 #ifndef _LTTNG_WRAPPER_FTRACE_H
13 #define _LTTNG_WRAPPER_FTRACE_H
14
15 #include <linux/ftrace.h>
16 #include <linux/version.h>
17 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
18 #include <../kernel/trace/trace.h>
19 #endif
20
21 #ifdef CONFIG_KALLSYMS
22
23 #include <linux/kallsyms.h>
24 #include <wrapper/kallsyms.h>
25
26 static inline
27 int wrapper_register_ftrace_function_probe(char *glob,
28 struct ftrace_probe_ops *ops, void *data)
29 {
30 int (*register_ftrace_function_probe_sym)(char *glob,
31 struct ftrace_probe_ops *ops, void *data);
32
33 register_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("register_ftrace_function_probe");
34 if (register_ftrace_function_probe_sym) {
35 return register_ftrace_function_probe_sym(glob, ops, data);
36 } else {
37 printk_once(KERN_WARNING "LTTng: register_ftrace_function_probe symbol lookup failed.\n");
38 return -EINVAL;
39 }
40 }
41
42 static inline
43 void wrapper_unregister_ftrace_function_probe(char *glob,
44 struct ftrace_probe_ops *ops, void *data)
45 {
46 void (*unregister_ftrace_function_probe_sym)(char *glob,
47 struct ftrace_probe_ops *ops, void *data);
48
49 unregister_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("unregister_ftrace_function_probe");
50 if (unregister_ftrace_function_probe_sym) {
51 unregister_ftrace_function_probe_sym(glob, ops, data);
52 } else {
53 printk_once(KERN_WARNING "LTTng: unregister_ftrace_function_probe symbol lookup failed.\n");
54 WARN_ON(1);
55 }
56 }
57
58 #else
59
60 static inline
61 int wrapper_register_ftrace_function_probe(char *glob,
62 struct ftrace_probe_ops *ops, void *data)
63 {
64 return register_ftrace_function_probe(glob, ops, data);
65 }
66
67 static inline
68 void wrapper_unregister_ftrace_function_probe(char *glob,
69 struct ftrace_probe_ops *ops, void *data)
70 {
71 return unregister_ftrace_function_probe(glob, ops, data);
72 }
73 #endif
74
75 #endif /* _LTTNG_WRAPPER_FTRACE_H */
This page took 0.029613 seconds and 4 git commands to generate.