1eda14cbcSMatt Macy /*
2eda14cbcSMatt Macy  * CDDL HEADER START
3eda14cbcSMatt Macy  *
4eda14cbcSMatt Macy  * The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy  * Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy  * You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy  *
8eda14cbcSMatt Macy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*271171e0SMartin Matuska  * or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy  * See the License for the specific language governing permissions
11eda14cbcSMatt Macy  * and limitations under the License.
12eda14cbcSMatt Macy  *
13eda14cbcSMatt Macy  * When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy  * If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy  * fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy  * information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy  *
19eda14cbcSMatt Macy  * CDDL HEADER END
20eda14cbcSMatt Macy  */
21eda14cbcSMatt Macy 
22eda14cbcSMatt Macy #if defined(_KERNEL)
23eda14cbcSMatt Macy #if defined(HAVE_DECLARE_EVENT_CLASS)
24eda14cbcSMatt Macy 
25eda14cbcSMatt Macy #undef TRACE_SYSTEM
26eda14cbcSMatt Macy #define	TRACE_SYSTEM zfs
27eda14cbcSMatt Macy 
28eda14cbcSMatt Macy #undef TRACE_SYSTEM_VAR
29eda14cbcSMatt Macy #define	TRACE_SYSTEM_VAR zfs_dbgmsg
30eda14cbcSMatt Macy 
31eda14cbcSMatt Macy #if !defined(_TRACE_DBGMSG_H) || defined(TRACE_HEADER_MULTI_READ)
32eda14cbcSMatt Macy #define	_TRACE_DBGMSG_H
33eda14cbcSMatt Macy 
34eda14cbcSMatt Macy #include <linux/tracepoint.h>
35eda14cbcSMatt Macy 
36eda14cbcSMatt Macy /*
37eda14cbcSMatt Macy  * This file defines tracepoint events for use by the dbgmsg(),
38eda14cbcSMatt Macy  * dprintf(), and SET_ERROR() interfaces. These are grouped here because
39eda14cbcSMatt Macy  * they all provide a way to store simple messages in the debug log (as
40eda14cbcSMatt Macy  * opposed to events used by the DTRACE_PROBE interfaces which typically
41eda14cbcSMatt Macy  * dump structured data).
42eda14cbcSMatt Macy  *
43eda14cbcSMatt Macy  * This header is included inside the trace.h multiple inclusion guard,
44eda14cbcSMatt Macy  * and it is guarded above against direct inclusion, so it and need not
45eda14cbcSMatt Macy  * be guarded separately.
46eda14cbcSMatt Macy  */
47eda14cbcSMatt Macy 
48eda14cbcSMatt Macy /*
49eda14cbcSMatt Macy  * Generic support for one argument tracepoints of the form:
50eda14cbcSMatt Macy  *
51eda14cbcSMatt Macy  * DTRACE_PROBE1(...,
52eda14cbcSMatt Macy  *     const char *, ...);
53eda14cbcSMatt Macy  */
54eda14cbcSMatt Macy /* BEGIN CSTYLED */
55eda14cbcSMatt Macy DECLARE_EVENT_CLASS(zfs_dprintf_class,
56eda14cbcSMatt Macy 	TP_PROTO(const char *msg),
57eda14cbcSMatt Macy 	TP_ARGS(msg),
58eda14cbcSMatt Macy 	TP_STRUCT__entry(
59eda14cbcSMatt Macy 	    __string(msg, msg)
60eda14cbcSMatt Macy 	),
61eda14cbcSMatt Macy 	TP_fast_assign(
62eda14cbcSMatt Macy 	    __assign_str(msg, msg);
63eda14cbcSMatt Macy 	),
64eda14cbcSMatt Macy 	TP_printk("%s", __get_str(msg))
65eda14cbcSMatt Macy );
66eda14cbcSMatt Macy /* END CSTYLED */
67eda14cbcSMatt Macy 
68eda14cbcSMatt Macy #define	DEFINE_DPRINTF_EVENT(name) \
69eda14cbcSMatt Macy DEFINE_EVENT(zfs_dprintf_class, name, \
70eda14cbcSMatt Macy     TP_PROTO(const char *msg), \
71eda14cbcSMatt Macy     TP_ARGS(msg))
72eda14cbcSMatt Macy DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf);
73eda14cbcSMatt Macy 
74eda14cbcSMatt Macy #endif /* _TRACE_DBGMSG_H */
75eda14cbcSMatt Macy 
76eda14cbcSMatt Macy #undef TRACE_INCLUDE_PATH
77eda14cbcSMatt Macy #undef TRACE_INCLUDE_FILE
78eda14cbcSMatt Macy #define	TRACE_INCLUDE_PATH sys
79eda14cbcSMatt Macy #define	TRACE_INCLUDE_FILE trace_dbgmsg
80eda14cbcSMatt Macy #include <trace/define_trace.h>
81eda14cbcSMatt Macy 
82eda14cbcSMatt Macy #else
83eda14cbcSMatt Macy 
84eda14cbcSMatt Macy DEFINE_DTRACE_PROBE1(zfs__dprintf);
85eda14cbcSMatt Macy 
86eda14cbcSMatt Macy #endif /* HAVE_DECLARE_EVENT_CLASS */
87eda14cbcSMatt Macy #endif /* _KERNEL */
88