Merge tag 'v3.14.25' into backport/v3.14.24-ltsi-rc1+v3.14.25/snapshot-merge.wip
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / lttng / probes / define_trace.h
1 /*
2  * define_trace.h
3  *
4  * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
5  * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; only
10  * version 2.1 of the License.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 /*
23  * Trace files that want to automate creationg of all tracepoints defined
24  * in their file should include this file. The following are macros that the
25  * trace file may define:
26  *
27  * TRACE_SYSTEM defines the system the tracepoint is for
28  *
29  * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
30  *     This macro may be defined to tell define_trace.h what file to include.
31  *     Note, leave off the ".h".
32  *
33  * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
34  *     then this macro can define the path to use. Note, the path is relative to
35  *     define_trace.h, not the file including it. Full path names for out of tree
36  *     modules must be used.
37  */
38
39 #ifdef CREATE_TRACE_POINTS
40
41 /* Prevent recursion */
42 #undef CREATE_TRACE_POINTS
43
44 #include <linux/stringify.h>
45 /*
46  * module.h includes tracepoints, and because ftrace.h
47  * pulls in module.h:
48  *  trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
49  *  linux/ftrace.h -> linux/module.h
50  * we must include module.h here before we play with any of
51  * the TRACE_EVENT() macros, otherwise the tracepoints included
52  * by module.h may break the build.
53  */
54 #include <linux/module.h>
55
56 #undef TRACE_EVENT_MAP
57 #define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print) \
58         DEFINE_TRACE(name)
59
60 #undef TRACE_EVENT_CONDITION_MAP
61 #define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \
62         TRACE_EVENT(name,                                               \
63                 PARAMS(proto),                                          \
64                 PARAMS(args),                                           \
65                 PARAMS(tstruct),                                        \
66                 PARAMS(assign),                                         \
67                 PARAMS(print))
68
69 #undef TRACE_EVENT_FN_MAP
70 #define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct,             \
71                 assign, print, reg, unreg)                      \
72         DEFINE_TRACE_FN(name, reg, unreg)
73
74 #undef DEFINE_EVENT_MAP
75 #define DEFINE_EVENT_MAP(template, name, map, proto, args) \
76         DEFINE_TRACE(name)
77
78 #undef DEFINE_EVENT_PRINT_MAP
79 #define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print) \
80         DEFINE_TRACE(name)
81
82 #undef DEFINE_EVENT_CONDITION_MAP
83 #define DEFINE_EVENT_CONDITION_MAP(template, name, map, proto, args, cond) \
84         DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
85
86
87 #undef TRACE_EVENT
88 #define TRACE_EVENT(name, proto, args, tstruct, assign, print)  \
89         DEFINE_TRACE(name)
90
91 #undef TRACE_EVENT_CONDITION
92 #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
93         TRACE_EVENT(name,                                               \
94                 PARAMS(proto),                                          \
95                 PARAMS(args),                                           \
96                 PARAMS(tstruct),                                        \
97                 PARAMS(assign),                                         \
98                 PARAMS(print))
99
100 #undef TRACE_EVENT_FN
101 #define TRACE_EVENT_FN(name, proto, args, tstruct,              \
102                 assign, print, reg, unreg)                      \
103         DEFINE_TRACE_FN(name, reg, unreg)
104
105 #undef DEFINE_EVENT
106 #define DEFINE_EVENT(template, name, proto, args) \
107         DEFINE_TRACE(name)
108
109 #undef DEFINE_EVENT_PRINT
110 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)  \
111         DEFINE_TRACE(name)
112
113 #undef DEFINE_EVENT_CONDITION
114 #define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
115         DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
116
117 #undef DECLARE_TRACE
118 #define DECLARE_TRACE(name, proto, args)        \
119         DEFINE_TRACE(name)
120
121 #undef TRACE_INCLUDE
122 #undef __TRACE_INCLUDE
123
124 #ifndef TRACE_INCLUDE_FILE
125 # define TRACE_INCLUDE_FILE TRACE_SYSTEM
126 # define UNDEF_TRACE_INCLUDE_FILE
127 #endif
128
129 #ifndef TRACE_INCLUDE_PATH
130 # define __TRACE_INCLUDE(system) <trace/events/system.h>
131 # define UNDEF_TRACE_INCLUDE_PATH
132 #else
133 # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
134 #endif
135
136 # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
137
138 /* Let the trace headers be reread */
139 #define TRACE_HEADER_MULTI_READ
140
141 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
142
143 /* Make all open coded DECLARE_TRACE nops */
144 #undef DECLARE_TRACE
145 #define DECLARE_TRACE(name, proto, args)
146
147 #ifdef LTTNG_PACKAGE_BUILD
148 #include "lttng-events.h"
149 #endif
150
151 #undef TRACE_EVENT
152 #undef TRACE_EVENT_FN
153 #undef TRACE_EVENT_CONDITION
154 #undef DEFINE_EVENT
155 #undef DEFINE_EVENT_PRINT
156 #undef DEFINE_EVENT_CONDITION
157 #undef TRACE_EVENT_MAP
158 #undef TRACE_EVENT_FN_MAP
159 #undef TRACE_EVENT_CONDITION_MAP
160 #undef DECLARE_EVENT_CLASS
161 #undef DEFINE_EVENT_MAP
162 #undef DEFINE_EVENT_PRINT_MAP
163 #undef DEFINE_EVENT_CONDITION_MAP
164 #undef TRACE_HEADER_MULTI_READ
165
166 /* Only undef what we defined in this file */
167 #ifdef UNDEF_TRACE_INCLUDE_FILE
168 # undef TRACE_INCLUDE_FILE
169 # undef UNDEF_TRACE_INCLUDE_FILE
170 #endif
171
172 #ifdef UNDEF_TRACE_INCLUDE_PATH
173 # undef TRACE_INCLUDE_PATH
174 # undef UNDEF_TRACE_INCLUDE_PATH
175 #endif
176
177 /* We may be processing more files */
178 #define CREATE_TRACE_POINTS
179
180 #endif /* CREATE_TRACE_POINTS */