diff --git a/sys/dev/dksubr.c b/sys/dev/dksubr.c index 8144b2834687..cb1e6ed044ba 100644 --- a/sys/dev/dksubr.c +++ b/sys/dev/dksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $ */ +/* $NetBSD: dksubr.c,v 1.111 2019/12/08 12:15:24 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.110 2019/10/05 05:28:44 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.111 2019/12/08 12:15:24 mlelstv Exp $"); #include #include @@ -999,66 +999,6 @@ dk_makedisklabel(struct dk_softc *dksc) lp->d_checksum = dkcksum(lp); } -/* This function is taken from ccd.c:1.76 --rcd */ - -/* - * XXX this function looks too generic for dksubr.c, shouldn't we - * put it somewhere better? - */ - -/* - * Lookup the provided name in the filesystem. If the file exists, - * is a valid block device, and isn't being used by anyone else, - * set *vpp to the file's vnode. - */ -int -dk_lookup(struct pathbuf *pb, struct lwp *l, struct vnode **vpp) -{ - struct nameidata nd; - struct vnode *vp; - int error; - - if (l == NULL) - return ESRCH; /* Is ESRCH the best choice? */ - - NDINIT(&nd, LOOKUP, FOLLOW, pb); - if ((error = vn_open(&nd, FREAD | FWRITE, 0)) != 0) { - DPRINTF((DKDB_FOLLOW|DKDB_INIT), - ("%s: vn_open error = %d\n", __func__, error)); - return error; - } - - vp = nd.ni_vp; - if (vp->v_type != VBLK) { - error = ENOTBLK; - goto out; - } - - /* Reopen as anonymous vnode to protect against forced unmount. */ - if ((error = bdevvp(vp->v_rdev, vpp)) != 0) - goto out; - VOP_UNLOCK(vp); - if ((error = vn_close(vp, FREAD | FWRITE, l->l_cred)) != 0) { - vrele(*vpp); - return error; - } - if ((error = VOP_OPEN(*vpp, FREAD | FWRITE, l->l_cred)) != 0) { - vrele(*vpp); - return error; - } - mutex_enter((*vpp)->v_interlock); - (*vpp)->v_writecount++; - mutex_exit((*vpp)->v_interlock); - - IFDEBUG(DKDB_VNODE, vprint("dk_lookup: vnode info", *vpp)); - - return 0; -out: - VOP_UNLOCK(vp); - (void) vn_close(vp, FREAD | FWRITE, l->l_cred); - return error; -} - MODULE(MODULE_CLASS_MISC, dk_subr, NULL); static int diff --git a/sys/dev/dkvar.h b/sys/dev/dkvar.h index 0be2cd0d47c8..b45a85a49d3c 100644 --- a/sys/dev/dkvar.h +++ b/sys/dev/dkvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: dkvar.h,v 1.30 2017/11/01 19:15:31 mlelstv Exp $ */ +/* $NetBSD: dkvar.h,v 1.31 2019/12/08 12:15:24 mlelstv Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -110,6 +110,4 @@ int dk_dump(struct dk_softc *, dev_t, void dk_getdisklabel(struct dk_softc *, dev_t); void dk_getdefaultlabel(struct dk_softc *, struct disklabel *); -int dk_lookup(struct pathbuf *, struct lwp *, struct vnode **); - #endif /* ! _DEV_DKVAR_H_ */