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