diff options
author | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-03-08 00:18:21 +0000 |
---|---|---|
committer | behlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c> | 2008-03-08 00:18:21 +0000 |
commit | 05ae387b5024b6b7014287e09ed9ce74befe91a3 (patch) | |
tree | 2b3028c66e5da4a70f924ab8b8cd5d367c9216df /modules/spl | |
parent | 0b3cf046cb5b65ccaf22687e105a4380533c0305 (diff) |
Add somre debugging support
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@31 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'modules/spl')
-rw-r--r-- | modules/spl/Makefile.in | 1 | ||||
-rw-r--r-- | modules/spl/spl-err.c | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/modules/spl/Makefile.in b/modules/spl/Makefile.in index 667858aa9..1d152e61b 100644 --- a/modules/spl/Makefile.in +++ b/modules/spl/Makefile.in @@ -14,6 +14,7 @@ spl-objs += spl-thread.o spl-objs += spl-taskq.o spl-objs += spl-rwlock.o spl-objs += spl-vnode.o +spl-objs += spl-err.o spl-objs += spl-generic.o splmodule := spl.ko diff --git a/modules/spl/spl-err.c b/modules/spl/spl-err.c new file mode 100644 index 000000000..6641ff034 --- /dev/null +++ b/modules/spl/spl-err.c @@ -0,0 +1,45 @@ +#include <sys/sysmacros.h> +#include <sys/cmn_err.h> +#include "config.h" + +static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" }; +static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" }; + +void +vpanic(const char *fmt, va_list ap) +{ + char msg[MAXMSGLEN]; + + vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); + panic(msg); +} /* vpanic() */ +EXPORT_SYMBOL(vpanic); + +void +cmn_err(int ce, const char *fmt, ...) +{ + char msg[MAXMSGLEN]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); + va_end(ap); + + printk("%s", msg); +} /* cmn_err() */ +EXPORT_SYMBOL(cmn_err); + +void +vcmn_err(int ce, const char *fmt, va_list ap) +{ + char msg[MAXMSGLEN]; + + if (ce == CE_PANIC) + vpanic(fmt, ap); + + if (ce != CE_NOTE) { /* suppress noise in stress testing */ + vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); + printk("%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]); + } +} /* vcmn_err() */ +EXPORT_SYMBOL(vcmn_err); |