FreeBSD ZFS
The Zettabyte File System

sys/zfs_debug.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
00023  * Copyright (c) 2012 by Delphix. All rights reserved.
00024  */
00025 
00026 #ifndef _SYS_ZFS_DEBUG_H
00027 #define _SYS_ZFS_DEBUG_H
00028 
00029 #ifdef  __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #ifndef TRUE
00034 #define TRUE 1
00035 #endif
00036 
00037 #ifndef FALSE
00038 #define FALSE 0
00039 #endif
00040 
00041 /*
00042  * ZFS debugging
00043  */
00044 
00045 #if defined(DEBUG) || !defined(_KERNEL)
00046 #if !defined(ZFS_DEBUG)
00047 #define ZFS_DEBUG
00048 #endif
00049 #endif
00050 
00051 extern int zfs_flags;
00052 
00053 #define ZFS_DEBUG_DPRINTF       0x0001
00054 #define ZFS_DEBUG_DBUF_VERIFY   0x0002
00055 #define ZFS_DEBUG_DNODE_VERIFY  0x0004
00056 #define ZFS_DEBUG_SNAPNAMES     0x0008
00057 #define ZFS_DEBUG_MODIFY        0x0010
00058 
00059 #ifdef ZFS_DEBUG
00060 extern void __dprintf(const char *file, const char *func,
00061     int line, const char *fmt, ...);
00062 #define dprintf(...) \
00063         if (zfs_flags & ZFS_DEBUG_DPRINTF) \
00064                 __dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__)
00065 #else
00066 #define dprintf(...) ((void)0)
00067 #endif /* ZFS_DEBUG */
00068 
00069 extern void zfs_panic_recover(const char *fmt, ...);
00070 
00071 typedef struct zfs_dbgmsg {
00072         list_node_t zdm_node;
00073         time_t zdm_timestamp;
00074         char zdm_msg[1]; 
00075 } zfs_dbgmsg_t;
00076 
00077 extern void zfs_dbgmsg_init(void);
00078 extern void zfs_dbgmsg_fini(void);
00079 extern void zfs_dbgmsg(const char *fmt, ...);
00080 
00081 #ifdef illumos
00082 #ifndef _KERNEL
00083 extern int dprintf_find_string(const char *string);
00084 #endif
00085 #endif /* illumos */
00086 
00087 #ifdef  __cplusplus
00088 }
00089 #endif
00090 
00091 #endif  /* _SYS_ZFS_DEBUG_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines