X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Finclude%2Fsys%2Fzfs_debug.h;h=f08d7cd2bc8e79e476a1f15a93ec0237c6bfa02f;hb=47d0ed1e6f8a8ee67492ec63173a27df8e4ca059;hp=450ac1c81b429cf7d200e7f703f53908c94c3673;hpb=172bb4bd5e4afef721dd4d2972d8680d983f144b;p=zfs.git diff --git a/module/zfs/include/sys/zfs_debug.h b/module/zfs/include/sys/zfs_debug.h index 450ac1c..f08d7cd 100644 --- a/module/zfs/include/sys/zfs_debug.h +++ b/module/zfs/include/sys/zfs_debug.h @@ -19,15 +19,12 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SYS_ZFS_DEBUG_H #define _SYS_ZFS_DEBUG_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -57,17 +54,40 @@ extern int zfs_flags; #define ZFS_DEBUG_MODIFY 0x0010 #ifdef ZFS_DEBUG +#if defined(_KERNEL) && defined(HAVE_SPL) +/* + * Log ZFS debug messages as the spl SS_USER1 subsystem. + */ +#include + +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS +#endif +#define SS_DEBUG_SUBSYS SS_USER1 +#define dprintf(...) SDEBUG_LIMIT(SD_DPRINTF, __VA_ARGS__) +#else extern void __dprintf(const char *file, const char *func, int line, const char *fmt, ...); #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; + +extern void zfs_dbgmsg_init(void); +extern void zfs_dbgmsg_fini(void); +extern void zfs_dbgmsg(const char *fmt, ...); + #ifdef __cplusplus } #endif