Skip to content

Commit 53da59a

Browse files
compudjrostedt
authored andcommitted
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. Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> LKML-Reference: <20100430165959.GA25605@Krystal> CC: Ingo Molnar <mingo@elte.hu> CC: Andrew Morton <akpm@linux-foundation.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: Peter Zijlstra <peterz@infradead.org> CC: Arnaldo Carvalho de Melo <acme@redhat.com> CC: Lai Jiangshan <laijs@cn.fujitsu.com> CC: Li Zefan <lizf@cn.fujitsu.com> CC: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 8f08201 commit 53da59a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎include/linux/tracepoint.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
137137
static inline int unregister_trace_##name(void (*probe)(proto)) \
138138
{ \
139139
return tracepoint_probe_unregister(#name, (void *)probe);\
140+
} \
141+
static inline void check_trace_callback_type_##name(void (*cb)(proto)) \
142+
{ \
140143
}
141144

142-
143145
#define DEFINE_TRACE_FN(name, reg, unreg) \
144146
static const char __tpstrtab_##name[] \
145147
__attribute__((section("__tracepoints_strings"))) = #name; \
@@ -168,6 +170,9 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
168170
static inline int unregister_trace_##name(void (*probe)(proto)) \
169171
{ \
170172
return -ENOSYS; \
173+
} \
174+
static inline void check_trace_callback_type_##name(void (*cb)(proto)) \
175+
{ \
171176
}
172177

173178
#define DEFINE_TRACE_FN(name, reg, unreg)

0 commit comments

Comments
 (0)