mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
Add somre debugging support
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@31 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
0b3cf046cb
commit
05ae387b50
@ -1,4 +1,16 @@
|
||||
#ifndef _SPL_CMN_ERR_H
|
||||
#define _SPL_CMN_ERR_H
|
||||
|
||||
#include <sys/varargs.h>
|
||||
|
||||
#define CE_CONT 0 /* continuation */
|
||||
#define CE_NOTE 1 /* notice */
|
||||
#define CE_WARN 2 /* warning */
|
||||
#define CE_PANIC 3 /* panic */
|
||||
#define CE_IGNORE 4 /* print nothing */
|
||||
|
||||
extern void cmn_err(int, const char *, ...);
|
||||
extern void vcmn_err(int, const char *, __va_list);
|
||||
extern void vpanic(const char *, __va_list);
|
||||
|
||||
#endif /* SPL_CMN_ERR_H */
|
||||
|
@ -6,6 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <sys/varargs.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
#define _KERNEL __KERNEL__
|
||||
@ -28,6 +29,7 @@ extern "C" {
|
||||
#define NBBY 8
|
||||
#define ENOTSUP ENOTSUPP
|
||||
|
||||
#define MAXMSGLEN 256
|
||||
#define MAXNAMELEN 256
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#define MAXOFFSET_T 0x7fffffffffffffffl
|
||||
@ -36,7 +38,6 @@ extern "C" {
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
|
||||
#define __va_list va_list
|
||||
#define max_ncpus 64
|
||||
#define _NOTE(x)
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifndef _SPL_VARARGS_H
|
||||
#define _SPL_VARARGS_H
|
||||
|
||||
#define __va_list va_list
|
||||
|
||||
#endif /* SPL_VARARGS_H */
|
||||
|
@ -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
|
||||
|
45
modules/spl/spl-err.c
Normal file
45
modules/spl/spl-err.c
Normal file
@ -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);
|
Loading…
Reference in New Issue
Block a user