summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_debug.h
blob: a32de1169eae6c150ab8617bd0fe86088c61f5f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */

/*
 * Copyright 2019, Joyent, Inc.
 */

#ifndef _RDSV3_DEBUG_H
#define	_RDSV3_DEBUG_H

#ifdef __cplusplus
extern "C" {
#endif

#define		LABEL	"RDSV3"

/*
 * warnings, console & syslog buffer.
 * For Non recoverable or Major Errors
 */
#define	RDSV3_LOG_L0	0

/*
 * syslog buffer or RDS trace buffer (console if booted /w debug)
 * For additional information on Non recoverable errors and
 * warnings/informational message for sys-admin types.
 */
#define	RDSV3_LOG_L1	1

/*
 * debug only
 * for more verbose trace than L1, for e.g. recoverable errors,
 * or intersting trace
 */
#define	RDSV3_LOG_L2	2

/*
 * debug only
 * for more verbose trace than L2, for e.g. informational messages
 */
#define	RDSV3_LOG_L3	3

/*
 * debug only
 * for more verbose trace than L3, for e.g. printing function entries...
 */
#define	RDSV3_LOG_L4	4

/*
 * debug only
 * most verbose level. Used only for  excessive trace, for e.g.
 * printing structures etc.
 */
#define	RDSV3_LOG_L5	5

/*
 * debug only
 * for messages from softints, taskqs, intr handlers, timeout handlers etc.
 */
#define	RDSV3_LOG_LINTR	6


#ifdef DEBUG
#define	RDSV3_DPRINTF_INTR	rdsv3_dprintf_intr
#define	RDSV3_DPRINTF5		rdsv3_dprintf5
#define	RDSV3_DPRINTF4		rdsv3_dprintf4
#define	RDSV3_DPRINTF3		rdsv3_dprintf3

void rdsv3_dprintf_intr(
		char		*name,
		char		*fmt, ...);
void rdsv3_dprintf5(
		char		*name,
		char		*fmt, ...);
void rdsv3_dprintf4(
		char		*name,
		char		*fmt, ...);
void rdsv3_dprintf3(
		char		*name,
		char		*fmt, ...);
#else
#define	RDSV3_DPRINTF_INTR(...)	(void)(0)
#define	RDSV3_DPRINTF5(...)	(void)(0)
#define	RDSV3_DPRINTF4(...)	(void)(0)
#define	RDSV3_DPRINTF3(...)	(void)(0)
#endif

#define	RDSV3_DPRINTF2		rdsv3_dprintf2
#define	RDSV3_DPRINTF1		rdsv3_dprintf1
#define	RDSV3_DPRINTF0		rdsv3_dprintf0

void rdsv3_dprintf2(
		char		*name,
		char		*fmt, ...);
void rdsv3_dprintf1(
		char		*name,
		char		*fmt, ...);
void rdsv3_dprintf0(
		char		*name,
		char		*fmt, ...);

void rdsv3_trace(
		char		*name,
		uint8_t		lvl,
		char		*fmt, ...);

void rdsv3_vprintk(
		char		*name,
		uint8_t		lvl,
		const char	*fmt,
		va_list		ap);

/* defined in rds_debug.c */
void rdsv3_logging_initialization();
void rdsv3_logging_destroy();
int rdsv3_printk_ratelimit(void);

#ifdef __cplusplus
}
#endif

#endif	/* _RDSV3_DEBUG_H */