X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=include%2Fsys%2Fzfs_debug.h;h=591d0df8f7114e99fc9c08455cc3e68211e971ce;hb=9ae529ec5dbdc828ff8326beae58062971d74b2e;hp=f08d7cd2bc8e79e476a1f15a93ec0237c6bfa02f;hpb=6283f55ea1b91e680386388c17d14b89e344fa8d;p=zfs.git diff --git a/include/sys/zfs_debug.h b/include/sys/zfs_debug.h index f08d7cd..591d0df 100644 --- a/include/sys/zfs_debug.h +++ b/include/sys/zfs_debug.h @@ -25,10 +25,6 @@ #ifndef _SYS_ZFS_DEBUG_H #define _SYS_ZFS_DEBUG_H -#ifdef __cplusplus -extern "C" { -#endif - #ifndef TRUE #define TRUE 1 #endif @@ -38,14 +34,14 @@ extern "C" { #endif /* - * ZFS debugging + * ZFS debugging - Always enabled for user space builds. */ - -#if defined(DEBUG) || !defined(_KERNEL) +#if !defined(ZFS_DEBUG) && !defined(_KERNEL) #define ZFS_DEBUG #endif extern int zfs_flags; +extern int zfs_recover; #define ZFS_DEBUG_DPRINTF 0x0001 #define ZFS_DEBUG_DBUF_VERIFY 0x0002 @@ -53,43 +49,33 @@ extern int zfs_flags; #define ZFS_DEBUG_SNAPNAMES 0x0008 #define ZFS_DEBUG_MODIFY 0x0010 -#ifdef ZFS_DEBUG -#if defined(_KERNEL) && defined(HAVE_SPL) /* - * Log ZFS debug messages as the spl SS_USER1 subsystem. + * Always log zfs debug messages to the spl debug subsystem as SS_USER1. + * When the SPL is configured with debugging enabled these messages will + * appear in the internal spl debug log, otherwise they are a no-op. */ +#if defined(_KERNEL) + #include +#define dprintf(...) \ + if (zfs_flags & ZFS_DEBUG_DPRINTF) \ + __SDEBUG(NULL, SS_USER1, SD_DPRINTF, __VA_ARGS__) -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif -#define SS_DEBUG_SUBSYS SS_USER1 -#define dprintf(...) SDEBUG_LIMIT(SD_DPRINTF, __VA_ARGS__) +/* + * When zfs is running is user space the debugging is always enabled. + * The messages will be printed using the __dprintf() function and + * filtered based on the zfs_flags variable. + */ #else -extern void __dprintf(const char *file, const char *func, - int line, const char *fmt, ...); -#define dprintf(...) \ - if (zfs_flags & ZFS_DEBUG_DPRINTF) \ +#define dprintf(...) \ + if (zfs_flags & ZFS_DEBUG_DPRINTF) \ __dprintf(__FILE__, __func__, __LINE__, __VA_ARGS__) -#endif /* _KERNEL && HAVE_SPL */ -#else -#define dprintf(...) ((void)0) -#endif /* ZFS_DEBUG */ - -extern void zfs_panic_recover(const char *fmt, ...); -typedef struct zfs_dbgmsg { - list_node_t zdm_node; - time_t zdm_timestamp; - char zdm_msg[1]; /* variable length allocation */ -} zfs_dbgmsg_t; +#endif /* _KERNEL */ -extern void zfs_dbgmsg_init(void); -extern void zfs_dbgmsg_fini(void); -extern void zfs_dbgmsg(const char *fmt, ...); - -#ifdef __cplusplus -} -#endif +void zfs_panic_recover(const char *fmt, ...); +#define zfs_dbgmsg(...) dprintf(__VA_ARGS__) +void zfs_dbgmsg_init(void); +void zfs_dbgmsg_fini(void); #endif /* _SYS_ZFS_DEBUG_H */