1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
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
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 #ifndef _LTTNG_WRAPPER_FTRACE_H
13 #define _LTTNG_WRAPPER_FTRACE_H
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>
21 #ifdef CONFIG_KALLSYMS
23 #include <linux/kallsyms.h>
24 #include <wrapper/kallsyms.h>
27 int wrapper_register_ftrace_function_probe(char *glob
,
28 struct ftrace_probe_ops
*ops
, void *data
)
30 int (*register_ftrace_function_probe_sym
)(char *glob
,
31 struct ftrace_probe_ops
*ops
, void *data
);
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
);
37 printk_once(KERN_WARNING
"LTTng: register_ftrace_function_probe symbol lookup failed.\n");
43 void wrapper_unregister_ftrace_function_probe(char *glob
,
44 struct ftrace_probe_ops
*ops
, void *data
)
46 void (*unregister_ftrace_function_probe_sym
)(char *glob
,
47 struct ftrace_probe_ops
*ops
, void *data
);
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
);
53 printk_once(KERN_WARNING
"LTTng: unregister_ftrace_function_probe symbol lookup failed.\n");
61 int wrapper_register_ftrace_function_probe(char *glob
,
62 struct ftrace_probe_ops
*ops
, void *data
)
64 return register_ftrace_function_probe(glob
, ops
, data
);
68 void wrapper_unregister_ftrace_function_probe(char *glob
,
69 struct ftrace_probe_ops
*ops
, void *data
)
71 return unregister_ftrace_function_probe(glob
, ops
, data
);
75 #endif /* _LTTNG_WRAPPER_FTRACE_H */