Use vlog(9). Open-coding vlog here breaks lkm's because including

<sys/kprintf.h> includes opt_multiprocessor.h. One could argue
that the lock stuff should just move to subr_prf.c since nothing
else uses it.
This commit is contained in:
christos 2005-03-26 19:39:08 +00:00
parent 3136f75efa
commit aca59c847f
1 changed files with 4 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_debug.c,v 1.27 2005/03/08 04:49:35 simonb Exp $ */
/* $NetBSD: lfs_debug.c,v 1.28 2005/03/26 19:39:08 christos Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -71,14 +71,13 @@
#include <machine/stdarg.h>
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.27 2005/03/08 04:49:35 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.28 2005/03/26 19:39:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/buf.h>
#include <sys/kprintf.h>
#include <sys/syslog.h>
#include <ufs/ufs/inode.h>
@ -299,35 +298,18 @@ int lfs_debug_log_subsys[DLOG_MAX];
/*
* Log events from various debugging areas of LFS, depending on what
* the user has enabled.
* XXX This should call a vlog() function instead.
*/
void
lfs_debug_log(int subsys, const char *fmt, ...)
{
int s;
va_list ap;
extern int log_open;
/* If not debugging this subsys, exit */
if (lfs_debug_log_subsys[subsys] == 0)
return;
/* If we are, do what log(9) does */
/* XXX want a vlog() */
KPRINTF_MUTEX_ENTER(s);
klogpri(LOG_DEBUG); /* log the level first */
va_start(ap, fmt);
kprintf(fmt, TOLOG, NULL, NULL, ap);
va_start(fmt, ap);
vlog(LOG_DEBUG, fmt, ap);
va_end(ap);
if (!log_open) {
va_start(ap, fmt);
kprintf(fmt, TOCONS, NULL, NULL, ap);
va_end(ap);
}
KPRINTF_MUTEX_EXIT(s);
logwakeup(); /* wake up anyone waiting for log msgs */
}
#endif /* DEBUG */