drbd: The kernel code is now equivalent to out of tree release 8.3.7
[safe/jmp/linux-2.6] / include / linux / tracepoint.h
index 4353f3f..f59604e 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * Kernel Tracepoint API.
  *
- * See Documentation/tracepoint.txt.
+ * See Documentation/trace/tracepoints.txt.
  *
  * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
  *
@@ -23,6 +23,8 @@ struct tracepoint;
 struct tracepoint {
        const char *name;               /* Tracepoint name */
        int state;                      /* State. */
+       void (*regfunc)(void);
+       void (*unregfunc)(void);
        void **funcs;
 } __attribute__((aligned(32)));                /*
                                         * Aligned on 32 bytes because it is
@@ -34,7 +36,7 @@ struct tracepoint {
 #ifndef DECLARE_TRACE
 
 #define TP_PROTO(args...)      args
-#define TP_ARGS(args...)               args
+#define TP_ARGS(args...)       args
 
 #ifdef CONFIG_TRACEPOINTS
 
@@ -78,12 +80,16 @@ struct tracepoint {
                return tracepoint_probe_unregister(#name, (void *)probe);\
        }
 
-#define DEFINE_TRACE(name)                                             \
+
+#define DEFINE_TRACE_FN(name, reg, unreg)                              \
        static const char __tpstrtab_##name[]                           \
        __attribute__((section("__tracepoints_strings"))) = #name;      \
        struct tracepoint __tracepoint_##name                           \
        __attribute__((section("__tracepoints"), aligned(32))) =        \
-               { __tpstrtab_##name, 0, NULL }
+               { __tpstrtab_##name, 0, reg, unreg, NULL }
+
+#define DEFINE_TRACE(name)                                             \
+       DEFINE_TRACE_FN(name, NULL, NULL);
 
 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)                             \
        EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -108,6 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
                return -ENOSYS;                                         \
        }
 
+#define DEFINE_TRACE_FN(name, reg, unreg)
 #define DEFINE_TRACE(name)
 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
 #define EXPORT_TRACEPOINT_SYMBOL(name)
@@ -158,10 +165,14 @@ static inline void tracepoint_synchronize_unregister(void)
 
 #define PARAMS(args...) args
 
-#ifndef TRACE_FORMAT
-#define TRACE_FORMAT(name, proto, args, fmt)           \
-       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
-#endif
+#endif /* _LINUX_TRACEPOINT_H */
+
+/*
+ * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
+ *  This is due to the way trace events work. If a file includes two
+ *  trace event headers under one "CREATE_TRACE_POINTS" the first include
+ *  will override the TRACE_EVENT and break the second include.
+ */
 
 #ifndef TRACE_EVENT
 /*
@@ -203,7 +214,7 @@ static inline void tracepoint_synchronize_unregister(void)
  *     * This is how the trace record is structured and will
  *     * be saved into the ring buffer. These are the fields
  *     * that will be exposed to user-space in
- *     * /debug/tracing/events/<*>/format.
+ *     * /sys/kernel/debug/tracing/events/<*>/format.
  *     *
  *     * The declared 'local variable' is called '__entry'
  *     *
@@ -263,11 +274,22 @@ static inline void tracepoint_synchronize_unregister(void)
  * tracepoint callback (this is used by programmatic plugins and
  * can also by used by generic instrumentation like SystemTap), and
  * it is also used to expose a structured trace record in
- * /debug/tracing/events/.
+ * /sys/kernel/debug/tracing/events/.
+ *
+ * A set of (un)registration functions can be passed to the variant
+ * TRACE_EVENT_FN to perform any (un)registration work.
  */
 
+#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
+#define DEFINE_EVENT(template, name, proto, args)              \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+
 #define TRACE_EVENT(name, proto, args, struct, assign, print)  \
        DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
-#endif
+#define TRACE_EVENT_FN(name, proto, args, struct,              \
+               assign, print, reg, unreg)                      \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
-#endif
+#endif /* ifdef TRACE_EVENT (see note above) */