1789Sahrens /* 2789Sahrens * CDDL HEADER START 3789Sahrens * 4789Sahrens * The contents of this file are subject to the terms of the 53093Sahrens * Common Development and Distribution License (the "License"). 63093Sahrens * You may not use this file except in compliance with the License. 7789Sahrens * 8789Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9789Sahrens * or http://www.opensolaris.org/os/licensing. 10789Sahrens * See the License for the specific language governing permissions 11789Sahrens * and limitations under the License. 12789Sahrens * 13789Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14789Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15789Sahrens * If applicable, add the following below this CDDL HEADER, with the 16789Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17789Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18789Sahrens * 19789Sahrens * CDDL HEADER END 20789Sahrens */ 21789Sahrens /* 22*12296SLin.Ling@Sun.COM * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23789Sahrens */ 24789Sahrens 25789Sahrens #ifndef _SYS_ZFS_DEBUG_H 26789Sahrens #define _SYS_ZFS_DEBUG_H 27789Sahrens 28789Sahrens #ifdef __cplusplus 29789Sahrens extern "C" { 30789Sahrens #endif 31789Sahrens 32789Sahrens #ifndef TRUE 33789Sahrens #define TRUE 1 34789Sahrens #endif 35789Sahrens 36789Sahrens #ifndef FALSE 37789Sahrens #define FALSE 0 38789Sahrens #endif 39789Sahrens 40789Sahrens /* 41789Sahrens * ZFS debugging 42789Sahrens */ 43789Sahrens 44789Sahrens #if defined(DEBUG) || !defined(_KERNEL) 45789Sahrens #define ZFS_DEBUG 46789Sahrens #endif 47789Sahrens 48789Sahrens extern int zfs_flags; 49789Sahrens 50789Sahrens #define ZFS_DEBUG_DPRINTF 0x0001 51789Sahrens #define ZFS_DEBUG_DBUF_VERIFY 0x0002 52789Sahrens #define ZFS_DEBUG_DNODE_VERIFY 0x0004 53789Sahrens #define ZFS_DEBUG_SNAPNAMES 0x0008 543093Sahrens #define ZFS_DEBUG_MODIFY 0x0010 55789Sahrens 56789Sahrens #ifdef ZFS_DEBUG 57789Sahrens extern void __dprintf(const char *file, const char *func, 58789Sahrens int line, const char *fmt, ...); 59789Sahrens #define dprintf(...) \ 60789Sahrens if (zfs_flags & ZFS_DEBUG_DPRINTF) \ 61789Sahrens __dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) 62789Sahrens #else 63789Sahrens #define dprintf(...) ((void)0) 64789Sahrens #endif /* ZFS_DEBUG */ 65789Sahrens 663713Sahrens extern void zfs_panic_recover(const char *fmt, ...); 673713Sahrens 68*12296SLin.Ling@Sun.COM typedef struct zfs_dbgmsg { 69*12296SLin.Ling@Sun.COM list_node_t zdm_node; 70*12296SLin.Ling@Sun.COM time_t zdm_timestamp; 71*12296SLin.Ling@Sun.COM char zdm_msg[1]; /* variable length allocation */ 72*12296SLin.Ling@Sun.COM } zfs_dbgmsg_t; 73*12296SLin.Ling@Sun.COM 74*12296SLin.Ling@Sun.COM extern void zfs_dbgmsg_init(void); 75*12296SLin.Ling@Sun.COM extern void zfs_dbgmsg_fini(void); 76*12296SLin.Ling@Sun.COM extern void zfs_dbgmsg(const char *fmt, ...); 77*12296SLin.Ling@Sun.COM 78789Sahrens #ifdef __cplusplus 79789Sahrens } 80789Sahrens #endif 81789Sahrens 82789Sahrens #endif /* _SYS_ZFS_DEBUG_H */ 83