tracepoints: add check trace callback type
Mathieu Desnoyers
reviewerPATCH 1/1 tracepoints: add check trace callback type
This check is meant to be used by tracepoint users which do a direct cast of callbacks to (void *) for direct registration, thus bypassing the register_trace_##name and unregister_trace_##name checks.
This permits to ensure that the callback type matches the function type at the call site, but without generating any code.
--- include/linux/tracepoint.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/tracepoint.h +6 -1
@@ -78,9 +78,11 @@ struct tracepoint { static inline int unregister_trace_##name(void (*probe)(proto)) \ { \ return tracepoint_probe_unregister(#name, (void *)probe);\ + } \ + static inline void check_trace_callback_type_##name(void (*cb)(proto)) \ + { \ } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \ __attribute__((section("__tracepoints_strings"))) = #name; \
@@ -112,6 +114,9 @@ extern void tracepoint_update_probe_rang static inline int unregister_trace_##name(void (*probe)(proto)) \ { \ return -ENOSYS; \ + } \ + static inline void check_trace_callback_type_##name(void (*cb)(proto)) \ + { \ }#define DEFINE_TRACE_FN (name, reg, unreg)
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
tip-bot for Mathieu Desnoyers
reviewer[tip:perf/core] tracepoints: Add check trace callback type
Commit-ID: 53da59aa6dd881fd0bbdd058a8a299d90ce9dd1d Gitweb: http://git.kernel.org/tip/53da59aa6dd881fd0bbdd058a8a299d90ce9dd1d Author: Mathieu Desnoyers <[email protected]> AuthorDate: Fri, 30 Apr 2010 12:59:59 -0400 Committer: Steven Rostedt <[email protected]> CommitDate: Fri, 14 May 2010 09:34:26 -0400
tracepoints: Add check trace callback type
This check is meant to be used by tracepoint users which do a direct cast of callbacks to (void *) for direct registration, thus bypassing the register_trace_##name and unregister_trace_##name checks.
This permits to ensure that the callback type matches the function type at the call site, but without generating any code.
LKML-Reference: <20100430165959.GA25605@Krystal>
--- include/linux/tracepoint.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
include/linux/tracepoint.h +6 -1
@@ -137,9 +137,11 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, static inline int unregister_trace_##name(void (*probe)(proto)) \ { \ return tracepoint_probe_unregister(#name, (void *)probe);\ + } \ + static inline void check_trace_callback_type_##name(void (*cb)(proto)) \ + { \ } -#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \ __attribute__((section("__tracepoints_strings"))) = #name; \
@@ -168,6 +170,9 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin, static inline int unregister_trace_##name(void (*probe)(proto)) \ { \ return -ENOSYS; \ + } \ + static inline void check_trace_callback_type_##name(void (*cb)(proto)) \ + { \ }#define DEFINE_TRACE_FN (name, reg, unreg)