--- src/sys/vm/vm_swap.c 2004/10/12 19:21:16 1.15 +++ src/sys/vm/vm_swap.c 2004/11/12 00:09:56 1.16 @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include /* XXX */ #include #include @@ -183,7 +183,7 @@ swapon(struct swapon_args *uap) struct thread *td = curthread; struct vattr attr; struct vnode *vp; - struct nameidata nd; + struct nlookupdata nd; int error; struct ucred *cred; @@ -194,14 +194,16 @@ swapon(struct swapon_args *uap) if (error) return (error); - NDINIT(&nd, NAMEI_LOOKUP, CNP_FOLLOW, UIO_USERSPACE, uap->name, td); - error = namei(&nd); + vp = NULL; + error = nlookup_init(&nd, uap->name, UIO_USERSPACE, NLC_FOLLOW); + if (error == 0) + error = nlookup(&nd); + if (error == 0) + error = cache_vref(nd.nl_ncp, nd.nl_cred, &vp); + nlookup_done(&nd); if (error) return (error); - NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; - if (vn_isdisk(vp, &error)) error = swaponvp(td, vp, 0); else if (vp->v_type == VREG && vp->v_tag == VT_NFS && @@ -266,7 +268,7 @@ swaponvp(struct thread *td, struct vnode return EINVAL; found: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - error = VOP_OPEN(vp, FREAD | FWRITE, cred, td); + error = VOP_OPEN(vp, FREAD | FWRITE, cred, NULL, td); VOP_UNLOCK(vp, 0, td); if (error) return (error);