1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2010-2018 B.A.T.M.A.N. contributors:
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 #if !defined(_NET_BATMAN_ADV_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
20 #define _NET_BATMAN_ADV_TRACE_H_
24 #include <linux/tracepoint.h>
27 #define TRACE_SYSTEM batadv
29 /* provide dummy function when tracing is disabled */
30 #if !defined(CONFIG_BATMAN_ADV_TRACING)
33 #define TRACE_EVENT(name, proto, ...) \
34 static inline void trace_ ## name(proto) {}
36 #endif /* CONFIG_BATMAN_ADV_TRACING */
38 #define BATADV_MAX_MSG_LEN 256
40 TRACE_EVENT(batadv_dbg,
42 TP_PROTO(struct batadv_priv *bat_priv,
43 struct va_format *vaf),
45 TP_ARGS(bat_priv, vaf),
48 __string(device, bat_priv->soft_iface->name)
49 __string(driver, KBUILD_MODNAME)
50 __dynamic_array(char, msg, BATADV_MAX_MSG_LEN)
54 __assign_str(device, bat_priv->soft_iface->name);
55 __assign_str(driver, KBUILD_MODNAME);
56 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
59 *vaf->va) >= BATADV_MAX_MSG_LEN);
70 #endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
72 #undef TRACE_INCLUDE_PATH
73 #define TRACE_INCLUDE_PATH .
74 #undef TRACE_INCLUDE_FILE
75 #define TRACE_INCLUDE_FILE trace
77 /* This part must be outside protection */
78 #include <trace/define_trace.h>