[PATCH] compat: complete tracepoint backport

From: Luis R. Rodriguez
Date: Wed Mar 28 2012 - 05:45:07 EST


Tested also against compat-wireless against:

* 2.6.33
* 2.6.32

I'm happy with this.

compat ckmake:

Trying kernel 3.3.0-030300rc2-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-13-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-22-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxx>
---
include/linux/tracepoint.h | 145 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 140 insertions(+), 5 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index a5bd743..44c9a5d 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -13,10 +13,12 @@
#define TP_STRUCT__entry(args...) args
#endif

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
/* Backports 091ad365, a rename */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#define DECLARE_EVENT_CLASS TRACE_EVENT_TEMPLATE
+#endif

+/* Backpports 2939b0469 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
#define TP_PROTO TPPROTO
#define TP_ARGS TPARGS
@@ -24,7 +26,143 @@
#define TP_RAW_FMT TPRAWFMT
#endif

-#endif
+/* Force disabling tracing */
+
+#undef TRACE_EVENT
+#define TRACE_EVENT(name, proto, ...) \
+DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(...)
+#undef DEFINE_EVENT
+
+#define DEFINE_EVENT(template, name, proto, args) \
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+
+#undef DECLARE_TRACE_NOARGS
+#define DECLARE_TRACE_NOARGS(name) \
+ __DECLARE_TRACE(name, void, , 1, void *__data, __data)
+
+
+/* Backports 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
+
+#undef DECLARE_TRACE
+#define DECLARE_TRACE(name, proto, args) \
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
+ PARAMS(void *__data, proto), \
+ PARAMS(__data, args))
+
+#undef DECLARE_TRACE_CONDITION
+#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
+ PARAMS(void *__data, proto), \
+ PARAMS(__data, args))
+
+#else
+
+#undef DECLARE_TRACE
+#define DECLARE_TRACE(name, proto, args) \
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
+ PARAMS(void *__data, proto), \
+ PARAMS(__data, args))
+
+#undef DECLARE_TRACE_CONDITION
+#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
+ PARAMS(void *__data, proto), \
+ PARAMS(__data, args))
+#endif /* backport 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
+
+/* Backports 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
+
+/* Backports c420970ef476d7d68df119711700666224001f43 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
+
+#undef __DECLARE_TRACE
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline void trace_##name##_rcuidle(proto) \
+ { } \
+ static inline int \
+ register_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline void \
+ unregister_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
+ { \
+ }
+#else
+
+#undef __DECLARE_TRACE
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline void trace_##name##_rcuidle(proto) \
+ { } \
+ static inline int \
+ register_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline int \
+ unregister_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
+ { \
+ }
+#endif /* backport c420970ef476d7d68df119711700666224001f43 */
+
+#else
+
+#undef __DECLARE_TRACE
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline void trace_##name##_rcuidle(proto) \
+ { } \
+ static inline int \
+ register_trace_##name(void (*probe)(data_proto), \
+ void *data) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline int \
+ unregister_trace_##name(void (*probe)(data_proto), \
+ void *data) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
+ { \
+ }
+
+#endif /* backport 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
+
+#undef DEFINE_TRACE_FN
+#define DEFINE_TRACE_FN(name, reg, unreg)
+
+#undef DEFINE_TRACE
+#define DEFINE_TRACE(name)
+
+#undef EXPORT_TRACEPOINT_SYMBOL_GPL
+#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
+
+#undef EXPORT_TRACEPOINT_SYMBOL
+#define EXPORT_TRACEPOINT_SYMBOL(name)
+
+#ifdef CONFIG_TRACEPOINTS
+#else /* CONFIG_TRACEPOINTS */
+#endif /* CONFIG_TRACEPOINTS */

#else /* just disable tracing */

@@ -42,9 +180,6 @@ static inline void trace_ ## name(proto) {}
#define TP_ARGS(args...) args
#define TP_CONDITION(args...) args

-struct tracepoint_iter {
-};
-
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */

#endif /* _COMPAT_LINUX_TRACEPOINT_H */
--
1.7.10.rc1.22.gf5241

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/