]> git.proxmox.com Git - mirror_spl-debian.git/blame - modules/spl/spl-err.c
Prep for for 0.3.0 tag, this is the tag which was used for all
[mirror_spl-debian.git] / modules / spl / spl-err.c
CommitLineData
05ae387b 1#include <sys/sysmacros.h>
2#include <sys/cmn_err.h>
3#include "config.h"
4
937879f1 5#ifdef DEBUG_SUBSYSTEM
6#undef DEBUG_SUBSYSTEM
7#endif
8
9#define DEBUG_SUBSYSTEM S_GENERIC
10
cc7449cc 11#ifndef NDEBUG
05ae387b 12static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
13static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
cc7449cc 14#endif
05ae387b 15
16void
17vpanic(const char *fmt, va_list ap)
18{
19 char msg[MAXMSGLEN];
20
21 vsnprintf(msg, MAXMSGLEN - 1, fmt, ap);
22 panic(msg);
23} /* vpanic() */
24EXPORT_SYMBOL(vpanic);
25
26void
27cmn_err(int ce, const char *fmt, ...)
28{
29 char msg[MAXMSGLEN];
30 va_list ap;
31
32 va_start(ap, fmt);
33 vsnprintf(msg, MAXMSGLEN - 1, fmt, ap);
34 va_end(ap);
35
937879f1 36 CERROR("%s", msg);
05ae387b 37} /* cmn_err() */
38EXPORT_SYMBOL(cmn_err);
39
40void
41vcmn_err(int ce, const char *fmt, va_list ap)
42{
43 char msg[MAXMSGLEN];
44
45 if (ce == CE_PANIC)
46 vpanic(fmt, ap);
47
48 if (ce != CE_NOTE) { /* suppress noise in stress testing */
49 vsnprintf(msg, MAXMSGLEN - 1, fmt, ap);
937879f1 50 CERROR("%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]);
05ae387b 51 }
52} /* vcmn_err() */
53EXPORT_SYMBOL(vcmn_err);