Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/vfs_subr.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/vfs_subr.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.435 retrieving revision 1.436 diff -u -p -r1.435 -r1.436 --- src/sys/kern/vfs_subr.c 2012/05/12 18:42:08 1.435 +++ src/sys/kern/vfs_subr.c 2013/02/13 14:03:48 1.436 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.435 2012/05/12 18:42:08 chs Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.436 2013/02/13 14:03:48 hannken Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.435 2012/05/12 18:42:08 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.436 2013/02/13 14:03:48 hannken Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -513,23 +513,8 @@ getdevvp(dev_t dev, vnode_t **vpp, enum int vfinddev(dev_t dev, enum vtype type, vnode_t **vpp) { - vnode_t *vp; - mutex_enter(&device_lock); - for (vp = specfs_hash[SPECHASH(dev)]; vp; vp = vp->v_specnext) { - if (type == vp->v_type && dev == vp->v_rdev) - break; - } - if (vp == NULL) { - mutex_exit(&device_lock); - return 0; - } - mutex_enter(vp->v_interlock); - mutex_exit(&device_lock); - if (vget(vp, 0) != 0) - return 0; - *vpp = vp; - return 1; + return (spec_node_lookup_by_dev(type, dev, vpp) == 0); } /* @@ -539,34 +524,17 @@ vfinddev(dev_t dev, enum vtype type, vno void vdevgone(int maj, int minl, int minh, enum vtype type) { - vnode_t *vp, **vpp; + vnode_t *vp; dev_t dev; int mn; - vp = NULL; /* XXX gcc */ - - mutex_enter(&device_lock); for (mn = minl; mn <= minh; mn++) { dev = makedev(maj, mn); - vpp = &specfs_hash[SPECHASH(dev)]; - for (vp = *vpp; vp != NULL;) { - mutex_enter(vp->v_interlock); - if ((vp->v_iflag & VI_CLEAN) != 0 || - type != vp->v_type || dev != vp->v_rdev) { - mutex_exit(vp->v_interlock); - vp = vp->v_specnext; - continue; - } - mutex_exit(&device_lock); - if (vget(vp, 0) == 0) { - VOP_REVOKE(vp, REVOKEALL); - vrele(vp); - } - mutex_enter(&device_lock); - vp = *vpp; + while (spec_node_lookup_by_dev(type, dev, &vp) == 0) { + VOP_REVOKE(vp, REVOKEALL); + vrele(vp); } } - mutex_exit(&device_lock); } /*