]> git.proxmox.com Git - mirror_zfs-debian.git/blob - include/sys/trace_dbgmsg.h
Imported Upstream version 0.6.5.3
[mirror_zfs-debian.git] / include / sys / trace_dbgmsg.h
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 http://www.opensolaris.org/os/licensing.
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 /* Do not include this file directly. Please use <sys/trace.h> instead. */
23 #ifndef _SYS_TRACE_DBGMSG_INDIRECT
24 #error "trace_dbgmsg.h included directly"
25 #endif
26
27 /*
28 * This file defines tracepoint events for use by the dbgmsg(),
29 * dprintf(), and SET_ERROR() interfaces. These are grouped here because
30 * they all provide a way to store simple messages in the debug log (as
31 * opposed to events used by the DTRACE_PROBE interfaces which typically
32 * dump structured data).
33 *
34 * This header is included inside the trace.h multiple inclusion guard,
35 * and it is guarded above against direct inclusion, so it and need not
36 * be guarded separately.
37 */
38
39 /*
40 * Generic support for four argument tracepoints of the form:
41 *
42 * DTRACE_PROBE4(...,
43 * const char *, ...,
44 * const char *, ...,
45 * int, ...,
46 * const char *, ...);
47 */
48
49 DECLARE_EVENT_CLASS(zfs_dprintf_class,
50 TP_PROTO(const char *file, const char *function, int line,
51 const char *msg),
52 TP_ARGS(file, function, line, msg),
53 TP_STRUCT__entry(
54 __field(const char *, file)
55 __field(const char *, function)
56 __field(int, line)
57 __string(msg, msg)
58 ),
59 TP_fast_assign(
60 __entry->file = file;
61 __entry->function = function;
62 __entry->line = line;
63 __assign_str(msg, msg);
64 ),
65 TP_printk("%s:%d:%s(): %s", __entry->file, __entry->line,
66 __entry->function, __get_str(msg))
67 );
68
69 #define DEFINE_DPRINTF_EVENT(name) \
70 DEFINE_EVENT(zfs_dprintf_class, name, \
71 TP_PROTO(const char *file, const char *function, int line, \
72 const char *msg), \
73 TP_ARGS(file, function, line, msg))
74 DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf);
75
76 /*
77 * Generic support for four argument tracepoints of the form:
78 *
79 * DTRACE_PROBE4(...,
80 * const char *, ...,
81 * const char *, ...,
82 * int, ...,
83 * uintptr_t, ...);
84 */
85
86 DECLARE_EVENT_CLASS(zfs_set_error_class,
87 TP_PROTO(const char *file, const char *function, int line,
88 uintptr_t error),
89 TP_ARGS(file, function, line, error),
90 TP_STRUCT__entry(
91 __field(const char *, file)
92 __field(const char *, function)
93 __field(int, line)
94 __field(uintptr_t, error)
95 ),
96 TP_fast_assign(
97 __entry->file = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
98 __entry->function = function;
99 __entry->line = line;
100 __entry->error = error;
101 ),
102 TP_printk("%s:%d:%s(): error 0x%lx", __entry->file, __entry->line,
103 __entry->function, __entry->error)
104 );
105
106 #define DEFINE_SET_ERROR_EVENT(name) \
107 DEFINE_EVENT(zfs_set_error_class, name, \
108 TP_PROTO(const char *file, const char *function, int line, \
109 uintptr_t error), \
110 TP_ARGS(file, function, line, error))
111 DEFINE_SET_ERROR_EVENT(zfs_set__error);