compat: properly handle tracing
[~tnikolova/compat/.git] / include / linux / tracepoint.h
1 #ifndef _COMPAT_LINUX_TRACEPOINT_H
2 #define _COMPAT_LINUX_TRACEPOINT_H 1
3
4 #include <linux/version.h>
5
6 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32))
7 /*
8  * Disable all tracing for older kernels
9  * < 2.6.27             had no tracing
10  * 2.6.27               had broken tracing
11  * 2.6.28-2.6.32        didn't have anything like DECLARE_EVENT_CLASS
12  *                      and faking it would be extremely difficult
13  */
14 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
15 /*
16  * For 2.6.28+ include the original tracepoint.h but override
17  * the defines new code uses to disable tracing completely.
18  */
19 #include_next <linux/tracepoint.h>
20 #endif
21
22 #undef TRACE_EVENT
23 #define TRACE_EVENT(name, proto, ...) \
24 static inline void trace_ ## name(proto) {}
25 #undef DECLARE_EVENT_CLASS
26 #define DECLARE_EVENT_CLASS(...)
27 #undef DEFINE_EVENT
28 #define DEFINE_EVENT(evt_class, name, proto, ...) \
29 static inline void trace_ ## name(proto) {}
30
31 #define TP_PROTO(args...)       args
32 #define TP_ARGS(args...)        args
33 #define TP_CONDITION(args...)   args
34
35 #else
36 /* since 2.6.33, tracing hasn't changed, so just include the kernel's file */
37 #include_next <linux/tracepoint.h>
38
39 #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) */
40
41 #endif  /* _COMPAT_LINUX_TRACEPOINT_H */