xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/ibmf/ibmf_trace.h (revision 2570281cf351044b6936651ce26dbe1f801dcbd8)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_IB_MGT_IBMF_IBMF_TRACE_H
28 #define	_SYS_IB_MGT_IBMF_IBMF_TRACE_H
29 
30 /*
31  * This file contains the IBMF trace/debug macros.
32  */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Trace levels for printing
40  */
41 #define	DPRINT_L0	0	/* no messages */
42 #define	DPRINT_L1	1	/* major errors */
43 #define	DPRINT_L2	2	/* minor errors */
44 #define	DPRINT_L3	3	/* general debug */
45 #define	DPRINT_L4	4	/* general trace */
46 
47 /*
48  * Trace probe macros
49  */
50 
51 #define	IBMF_TRACE_0(debug, trlevel, arg01, arg02, arg03, arg04)	\
52 	if (ibmf_trace_level > 0) {				\
53 		ibmf_dprintf(trlevel, arg04);			\
54 	}
55 
56 /* CSTYLED */
57 #define	IBMF_TRACE_1(debug, trlevel, arg01, arg02, arg03, arg04, arg11, arg12, arg13)								\
58 	if (ibmf_trace_level > 0) {				\
59 		ibmf_dprintf(trlevel, arg04, arg13);		\
60 	}
61 
62 /* CSTYLED */
63 #define	IBMF_TRACE_2(debug, trlevel, arg01, arg02, arg03, arg04, arg11, arg12, arg13, arg21, arg22, arg23)					\
64 	if (ibmf_trace_level > 0) {				\
65 		ibmf_dprintf(trlevel, arg04, arg13, arg23);	\
66 	}
67 
68 /* CSTYLED */
69 #define	IBMF_TRACE_3(debug, trlevel, arg01, arg02, arg03, arg04, arg11, arg12, arg13, arg21, arg22, arg23, arg31, arg32, arg33)			\
70 	if (ibmf_trace_level > 0) {				\
71 		ibmf_dprintf(trlevel, arg04, arg13, arg23, arg33);	\
72 	}
73 
74 /* CSTYLED */
75 #define	IBMF_TRACE_4(debug, trlevel, arg01, arg02, arg03, arg04, arg11, arg12, arg13, arg21, arg22, arg23, arg31, arg32, arg33, arg41, arg42, arg43)	\
76 	if (ibmf_trace_level > 0) {				\
77 		ibmf_dprintf(trlevel, arg04, arg13, arg23, arg33, arg43);\
78 	}
79 
80 /* CSTYLED */
81 #define	IBMF_TRACE_5(debug, trlevel, arg01, arg02, arg03, arg04, arg11, arg12, arg13, arg21, arg22, arg23, arg31, arg32, arg33, arg41, arg42, arg43, arg51, arg52, arg53)	\
82 	if (ibmf_trace_level > 0) {				\
83 		ibmf_dprintf(trlevel, arg04, arg13, arg23, arg33, \
84 		    arg43, arg53);				\
85 	}
86 
87 void
88 ibmf_dprintf(int l, const char *fmt, ...);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* _SYS_IB_MGT_IBMF_IBMF_TRACE_H */
95