xref: /illumos-gate/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_debug.h (revision 679c9deae74d7b935e94eaaff2566ea45c1afe2b)
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  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*
26  * Copyright 2019, Joyent, Inc.
27  */
28 
29 #ifndef _RDSV3_DEBUG_H
30 #define	_RDSV3_DEBUG_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define		LABEL	"RDSV3"
37 
38 /*
39  * warnings, console & syslog buffer.
40  * For Non recoverable or Major Errors
41  */
42 #define	RDSV3_LOG_L0	0
43 
44 /*
45  * syslog buffer or RDS trace buffer (console if booted /w debug)
46  * For additional information on Non recoverable errors and
47  * warnings/informational message for sys-admin types.
48  */
49 #define	RDSV3_LOG_L1	1
50 
51 /*
52  * debug only
53  * for more verbose trace than L1, for e.g. recoverable errors,
54  * or intersting trace
55  */
56 #define	RDSV3_LOG_L2	2
57 
58 /*
59  * debug only
60  * for more verbose trace than L2, for e.g. informational messages
61  */
62 #define	RDSV3_LOG_L3	3
63 
64 /*
65  * debug only
66  * for more verbose trace than L3, for e.g. printing function entries...
67  */
68 #define	RDSV3_LOG_L4	4
69 
70 /*
71  * debug only
72  * most verbose level. Used only for  excessive trace, for e.g.
73  * printing structures etc.
74  */
75 #define	RDSV3_LOG_L5	5
76 
77 /*
78  * debug only
79  * for messages from softints, taskqs, intr handlers, timeout handlers etc.
80  */
81 #define	RDSV3_LOG_LINTR	6
82 
83 
84 #ifdef DEBUG
85 #define	RDSV3_DPRINTF_INTR	rdsv3_dprintf_intr
86 #define	RDSV3_DPRINTF5		rdsv3_dprintf5
87 #define	RDSV3_DPRINTF4		rdsv3_dprintf4
88 #define	RDSV3_DPRINTF3		rdsv3_dprintf3
89 
90 void rdsv3_dprintf_intr(
91 		char		*name,
92 		char		*fmt, ...);
93 void rdsv3_dprintf5(
94 		char		*name,
95 		char		*fmt, ...);
96 void rdsv3_dprintf4(
97 		char		*name,
98 		char		*fmt, ...);
99 void rdsv3_dprintf3(
100 		char		*name,
101 		char		*fmt, ...);
102 #else
103 #define	RDSV3_DPRINTF_INTR(...)	(void)(0)
104 #define	RDSV3_DPRINTF5(...)	(void)(0)
105 #define	RDSV3_DPRINTF4(...)	(void)(0)
106 #define	RDSV3_DPRINTF3(...)	(void)(0)
107 #endif
108 
109 #define	RDSV3_DPRINTF2		rdsv3_dprintf2
110 #define	RDSV3_DPRINTF1		rdsv3_dprintf1
111 #define	RDSV3_DPRINTF0		rdsv3_dprintf0
112 
113 void rdsv3_dprintf2(
114 		char		*name,
115 		char		*fmt, ...);
116 void rdsv3_dprintf1(
117 		char		*name,
118 		char		*fmt, ...);
119 void rdsv3_dprintf0(
120 		char		*name,
121 		char		*fmt, ...);
122 
123 void rdsv3_trace(
124 		char		*name,
125 		uint8_t		lvl,
126 		char		*fmt, ...);
127 
128 void rdsv3_vprintk(
129 		char		*name,
130 		uint8_t		lvl,
131 		const char	*fmt,
132 		va_list		ap);
133 
134 /* defined in rds_debug.c */
135 void rdsv3_logging_initialization();
136 void rdsv3_logging_destroy();
137 int rdsv3_printk_ratelimit(void);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif	/* _RDSV3_DEBUG_H */
144