1 #ifndef _LTTNG_WRAPPER_TRACEPOINT_H
2 #define _LTTNG_WRAPPER_TRACEPOINT_H
7 * wrapper around DECLARE_EVENT_CLASS.
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; only
14 * version 2.1 of the License.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <linux/version.h>
27 #include <linux/tracepoint.h>
28 #include <linux/module.h>
30 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
32 #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
36 #ifndef HAVE_KABI_2635_TRACEPOINT
38 #define kabi_2635_tracepoint_probe_register tracepoint_probe_register
39 #define kabi_2635_tracepoint_probe_unregister tracepoint_probe_unregister
40 #define kabi_2635_tracepoint_probe_register_noupdate tracepoint_probe_register_noupdate
41 #define kabi_2635_tracepoint_probe_unregister_noupdate tracepoint_probe_unregister_noupdate
43 #endif /* HAVE_KABI_2635_TRACEPOINT */
45 #ifdef CONFIG_MODULE_SIG
47 #include <linux/kallsyms.h>
51 int wrapper_tracepoint_module_notify(struct notifier_block
*nb
,
52 unsigned long val
, struct module
*mod
)
54 int (*tracepoint_module_notify_sym
)(struct notifier_block
*nb
,
55 unsigned long val
, struct module
*mod
);
57 tracepoint_module_notify_sym
=
58 (void *) kallsyms_lookup_funcptr("tracepoint_module_notify");
59 if (tracepoint_module_notify_sym
) {
60 return tracepoint_module_notify_sym(nb
, val
, mod
);
62 printk(KERN_WARNING
"LTTng: tracepoint_module_notify symbol lookup failed. It probably means you kernel don't need this work-around. Please consider upgrading LTTng modules to make this warning go away.\n");
68 int wrapper_lttng_fixup_sig(struct module
*mod
)
73 * This is for module.c confusing force loaded modules with
76 if (!THIS_MODULE
->sig_ok
&&
77 THIS_MODULE
->taints
& (1U << TAINT_FORCED_MODULE
)) {
78 THIS_MODULE
->taints
&= ~(1U << TAINT_FORCED_MODULE
);
79 ret
= wrapper_tracepoint_module_notify(NULL
,
80 MODULE_STATE_COMING
, mod
);
81 THIS_MODULE
->taints
|= (1U << TAINT_FORCED_MODULE
);
86 #else /* CONFIG_MODULE_SIG */
89 int wrapper_lttng_fixup_sig(struct module
*mod
)
94 #endif /* #else CONFIG_MODULE_SIG */
96 #endif /* _LTTNG_WRAPPER_TRACEPOINT_H */