1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Trace files that want to automate creation of all tracepoints defined
4 * in their file should include this file. The following are macros that the
5 * trace file may define:
7 * TRACE_SYSTEM defines the system the tracepoint is for
9 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
10 * This macro may be defined to tell define_trace.h what file to include.
11 * Note, leave off the ".h".
13 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
14 * then this macro can define the path to use. Note, the path is relative to
15 * define_trace.h, not the file including it. Full path names for out of tree
16 * modules must be used.
19 #ifdef CREATE_CUSTOM_TRACE_EVENTS
21 /* Prevent recursion */
22 #undef CREATE_CUSTOM_TRACE_EVENTS
24 #include <linux/stringify.h>
26 #undef TRACE_CUSTOM_EVENT
27 #define TRACE_CUSTOM_EVENT(name, proto, args, tstruct, assign, print)
29 #undef DEFINE_CUSTOM_EVENT
30 #define DEFINE_CUSTOM_EVENT(template, name, proto, args)
33 #undef __TRACE_INCLUDE
35 #ifndef TRACE_INCLUDE_FILE
36 # define TRACE_INCLUDE_FILE TRACE_SYSTEM
37 # define UNDEF_TRACE_INCLUDE_FILE
40 #ifndef TRACE_INCLUDE_PATH
41 # define __TRACE_INCLUDE(system) <trace/events/system.h>
42 # define UNDEF_TRACE_INCLUDE_PATH
44 # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
47 # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
49 /* Let the trace headers be reread */
50 #define TRACE_CUSTOM_MULTI_READ
52 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
54 #ifdef TRACEPOINTS_ENABLED
55 #include <trace/trace_custom_events.h>
58 #undef TRACE_CUSTOM_EVENT
59 #undef DECLARE_CUSTOM_EVENT_CLASS
60 #undef DEFINE_CUSTOM_EVENT
61 #undef TRACE_CUSTOM_MULTI_READ
63 /* Only undef what we defined in this file */
64 #ifdef UNDEF_TRACE_INCLUDE_FILE
65 # undef TRACE_INCLUDE_FILE
66 # undef UNDEF_TRACE_INCLUDE_FILE
69 #ifdef UNDEF_TRACE_INCLUDE_PATH
70 # undef TRACE_INCLUDE_PATH
71 # undef UNDEF_TRACE_INCLUDE_PATH
74 /* We may be processing more files */
75 #define CREATE_CUSTOM_TRACE_POINTS
77 #endif /* CREATE_CUSTOM_TRACE_POINTS */