X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=include%2Fust%2Ftracepoint.h;h=5e7f9d86967580fd314ca1b21621e678ff585f85;hb=34dca3cc6e0b230c988b16117b967a094560f4ed;hp=3d61f72883c762cc44ad64fb5c4c005d281d2084;hpb=9edd34bd25f52dd39b354a84f02697254121aefd;p=ust.git diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h index 3d61f72..5e7f9d8 100644 --- a/include/ust/tracepoint.h +++ b/include/ust/tracepoint.h @@ -70,12 +70,13 @@ struct tracepoint { /* * it_func[0] is never NULL because there is at least one element in the array * when the array itself is non NULL. + * __attribute__((unused)) is for backward compatibility API. */ #define __DO_TRACE(tp, proto, args) \ do { \ struct tracepoint_probe *__tp_it_probe_ptr; \ void *__tp_it_func; \ - void *__tp_cb_data; \ + void *__tp_cb_data __attribute__((unused)); \ \ rcu_read_lock(); \ __tp_it_probe_ptr = rcu_dereference((tp)->probes); \ @@ -124,6 +125,29 @@ struct tracepoint { { \ return __tracepoint_probe_unregister(#name, (void *)probe, \ data); \ + } \ + /* \ + * Backward-compatibility API (will be deprecated): \ + * trace_* \ + * register_trace_* \ + * unregister_trace_* \ + */ \ + static inline void trace_##name(proto) \ + { \ + __CHECK_TRACE(name, TP_PROTO(proto), \ + TP_ARGS(args)); \ + } \ + static inline int \ + register_trace_##name(void (*probe)(proto)) \ + { \ + return __tracepoint_probe_register(#name, (void *)probe,\ + NULL); \ + } \ + static inline int \ + unregister_trace_##name(void (*probe)(proto)) \ + { \ + return __tracepoint_probe_unregister(#name, (void *)probe, \ + NULL); \ } /* @@ -194,6 +218,16 @@ int tracepoint_register_lib(struct tracepoint * const *tracepoints_start, extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start); +/* + * Backward-compatibility API (will be deprecated): + * DEFINE_TRACE + * DECLARE_TRACE + * register_tracepoint + * unregister_tracepoint + */ +#define DEFINE_TRACE _DEFINE_TRACEPOINT +#define DECLARE_TRACE(name, proto, args) \ + _DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args)) #ifndef TRACEPOINT_EVENT /*