From 7c93282e42ba2bfa6d4155f87d99e1186979388c Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 24 Jan 2005 13:58:08 +0000 Subject: [PATCH] Change vprint() to vn_printf() which takes varargs. Add #define for vprint() to call vn_printf(). --- sys/kern/vfs_subr.c | 27 +++++++++++++++------------ sys/sys/vnode.h | 3 ++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9367fd3275a8..5c48ac5529b2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -2482,20 +2484,20 @@ static char *typename[] = {"VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"}; void -vprint(label, vp) - char *label; - struct vnode *vp; +vn_printf(struct vnode *vp, const char *fmt, ...) { + va_list ap; char buf[96]; - if (label != NULL) - printf("%s: %p: ", label, (void *)vp); - else - printf("%p: ", (void *)vp); - printf("tag %s, type %s\n ", vp->v_tag, typename[vp->v_type]); - printf("usecount %d, writecount %d, refcount %d mountedhere %p\n", + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf("%p: ", (void *)vp); + printf("tag %s, type %s\n", vp->v_tag, typename[vp->v_type]); + printf(" usecount %d, writecount %d, refcount %d mountedhere %p\n", vp->v_usecount, vp->v_writecount, vp->v_holdcnt, vp->v_mountedhere); buf[0] = '\0'; + buf[1] = '\0'; if (vp->v_vflag & VV_ROOT) strcat(buf, "|VV_ROOT"); if (vp->v_vflag & VV_TEXT) @@ -2510,11 +2512,12 @@ vprint(label, vp) strcat(buf, "|VI_DOOMED"); if (vp->v_iflag & VI_FREE) strcat(buf, "|VI_FREE"); - if (buf[0] != '\0') - printf(" flags (%s)", &buf[1]); + printf(" flags (%s)\n", buf + 1); if (mtx_owned(VI_MTX(vp))) printf(" VI_LOCKed"); - printf("\n "); + if (vp->v_object != NULL); + printf(" v_object %p\n", vp->v_object); + printf(" "); lockmgr_printinfo(vp->v_vnlock); printf("\n"); if (vp->v_data != NULL) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index c90cdd182f3a..4e9bd1080bad 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -614,7 +614,8 @@ int vinvalbuf(struct vnode *vp, int save, struct thread *td, int slpflag, int slptimeo); int vtruncbuf(struct vnode *vp, struct ucred *cred, struct thread *td, off_t length, int blksize); -void vprint(char *label, struct vnode *vp); +void vn_printf(struct vnode *vp, const char *fmt, ...); +#define vprint(label, vp) vn_printf((vp), "%s\n", (label)) int vrecycle(struct vnode *vp, struct mtx *inter_lkp, struct thread *td); int vn_close(struct vnode *vp,