Date: Mon, 23 Jul 2007 14:56:47 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 123966 for review Message-ID: <200707231456.l6NEulTC074787@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=123966 Change 123966 by rdivacky@rdivacky_witten on 2007/07/23 14:56:03 Merge ndp and ndl into one nd as in original code. Suggested by: kib Affected files ... .. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#48 edit Differences ... ==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#48 (text+ko) ==== @@ -1588,7 +1588,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, const char *path2, enum uio_seg segflg, int follow) { - struct nameidata ndp, ndl; + struct nameidata nd; struct vnode *pdvp = NULL, *ldvp = NULL; struct vnode *vp; struct mount *mp; @@ -1600,7 +1600,7 @@ if (error && !kern_absolute_path(path1, segflg)) return (error); - NDINIT_AT(&ndp, LOOKUP, ((error) ? ATBADF : 0) | follow | MPSAFE | + NDINIT_AT(&nd, LOOKUP, ((error) ? ATBADF : 0) | follow | MPSAFE | AUDITVNODE1, segflg, path1, td, pdvp); error = kern_get_at(td, fd2, &ldvp); @@ -1613,15 +1613,15 @@ return (error); } - NDINIT_AT(&ndl, CREATE, ((error) ? ATBADF : 0) | LOCKPARENT | + NDINIT_AT(&nd, CREATE, ((error) ? ATBADF : 0) | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, segflg, path2, td, ldvp); bwillwrite(); - if ((error = namei(&ndp)) != 0) + if ((error = namei(&nd)) != 0) goto out; - vfslocked = NDHASGIANT(&ndp); - NDFREE(&ndp, NDF_ONLY_PNBUF); - vp = ndp.ni_vp; + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); + vp = nd.ni_vp; if (vp->v_type == VDIR) { vrele(vp); VFS_UNLOCK_GIANT(vfslocked); @@ -1633,31 +1633,31 @@ VFS_UNLOCK_GIANT(vfslocked); goto out; } - if ((error = namei(&ndl)) == 0) { - lvfslocked = NDHASGIANT(&ndl); - if (ndl.ni_vp != NULL) { - if (ndl.ni_dvp == ndl.ni_vp) - vrele(ndl.ni_dvp); + if ((error = namei(&nd)) == 0) { + lvfslocked = NDHASGIANT(&nd); + if (nd.ni_vp != NULL) { + if (nd.ni_dvp == nd.ni_vp) + vrele(nd.ni_dvp); else - vput(ndl.ni_dvp); - vrele(ndl.ni_vp); + vput(nd.ni_dvp); + vrele(nd.ni_vp); error = EEXIST; } else if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td)) == 0) { - VOP_LEASE(ndl.ni_dvp, td, td->td_ucred, LEASE_WRITE); + VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE); VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); error = can_hardlink(vp, td, td->td_ucred); if (error == 0) #ifdef MAC error = mac_check_vnode_link(td->td_ucred, - ndl.ni_dvp, vp, &ndl.ni_cnd); + nd.ni_dvp, vp, &nd.ni_cnd); if (error == 0) #endif - error = VOP_LINK(ndl.ni_dvp, vp, &ndl.ni_cnd); + error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); VOP_UNLOCK(vp, 0, td); - vput(ndl.ni_dvp); + vput(nd.ni_dvp); } - NDFREE(&ndl, NDF_ONLY_PNBUF); + NDFREE(&nd, NDF_ONLY_PNBUF); VFS_UNLOCK_GIANT(lvfslocked); } vrele(vp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707231456.l6NEulTC074787>