xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/zfs_debug.h (revision 0125049cd6136d1d2ca9e982382a915b6d7916ce)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
56b4acc8bSahrens  * Common Development and Distribution License (the "License").
66b4acc8bSahrens  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
22*0125049cSahrens  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens #ifndef _SYS_ZFS_DEBUG_H
27fa9e4066Sahrens #define	_SYS_ZFS_DEBUG_H
28fa9e4066Sahrens 
29fa9e4066Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
30fa9e4066Sahrens 
31fa9e4066Sahrens #ifdef	__cplusplus
32fa9e4066Sahrens extern "C" {
33fa9e4066Sahrens #endif
34fa9e4066Sahrens 
35fa9e4066Sahrens #ifndef TRUE
36fa9e4066Sahrens #define	TRUE 1
37fa9e4066Sahrens #endif
38fa9e4066Sahrens 
39fa9e4066Sahrens #ifndef FALSE
40fa9e4066Sahrens #define	FALSE 0
41fa9e4066Sahrens #endif
42fa9e4066Sahrens 
43fa9e4066Sahrens /*
44fa9e4066Sahrens  * ZFS debugging
45fa9e4066Sahrens  */
46fa9e4066Sahrens 
47fa9e4066Sahrens #if defined(DEBUG) || !defined(_KERNEL)
48fa9e4066Sahrens #define	ZFS_DEBUG
49fa9e4066Sahrens #endif
50fa9e4066Sahrens 
51fa9e4066Sahrens extern int zfs_flags;
52fa9e4066Sahrens 
53fa9e4066Sahrens #define	ZFS_DEBUG_DPRINTF	0x0001
54fa9e4066Sahrens #define	ZFS_DEBUG_DBUF_VERIFY	0x0002
55fa9e4066Sahrens #define	ZFS_DEBUG_DNODE_VERIFY	0x0004
56fa9e4066Sahrens #define	ZFS_DEBUG_SNAPNAMES	0x0008
576b4acc8bSahrens #define	ZFS_DEBUG_MODIFY	0x0010
58fa9e4066Sahrens 
59fa9e4066Sahrens #ifdef ZFS_DEBUG
60fa9e4066Sahrens extern void __dprintf(const char *file, const char *func,
61fa9e4066Sahrens     int line, const char *fmt, ...);
62fa9e4066Sahrens #define	dprintf(...) \
63fa9e4066Sahrens 	if (zfs_flags & ZFS_DEBUG_DPRINTF) \
64fa9e4066Sahrens 		__dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
65fa9e4066Sahrens #else
66fa9e4066Sahrens #define	dprintf(...) ((void)0)
67fa9e4066Sahrens #endif /* ZFS_DEBUG */
68fa9e4066Sahrens 
69*0125049cSahrens extern void zfs_panic_recover(const char *fmt, ...);
70*0125049cSahrens 
71fa9e4066Sahrens #ifdef	__cplusplus
72fa9e4066Sahrens }
73fa9e4066Sahrens #endif
74fa9e4066Sahrens 
75fa9e4066Sahrens #endif	/* _SYS_ZFS_DEBUG_H */
76