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