Date: Fri, 28 Dec 2007 14:50:49 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 131879 for review Message-ID: <200712281450.lBSEondt014252@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=131879 Change 131879 by rdivacky@rdivacky_witten on 2007/12/28 14:49:50 Mostly cosmetic changes to shrink the diff a little. Affected files ... .. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#55 edit Differences ... ==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#55 (text+ko) ==== @@ -1020,7 +1020,6 @@ kern_openat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, int flags, int mode) { - struct nameidata nd; struct proc *p = td->td_proc; struct filedesc *fdp = p->p_fd; struct file *fp; @@ -1031,23 +1030,22 @@ struct file *nfp; int type, indx, error; struct flock lf; + struct nameidata nd; int vfslocked; AUDIT_ARG(fflags, flags); AUDIT_ARG(mode, mode); /* XXX: audit dirfd */ + if ((flags & O_ACCMODE) == O_ACCMODE) + return (EINVAL); NDINIT_AT(&nd, LOOKUP, 0 | FOLLOW | AUDITVNODE1 | MPSAFE, pathseg, path, td, fd); - if ((flags & O_ACCMODE) == O_ACCMODE) { - error = EINVAL; - goto out; - } flags = FFLAGS(flags); error = falloc(td, &nfp, &indx); if (error) - goto out; + return (error); /* An extra reference on `nfp' has been held for us by falloc(). */ fp = nfp; cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; @@ -1062,8 +1060,7 @@ if (error == ENXIO && fp->f_ops != &badfileops) { fdrop(fp, td); td->td_retval[0] = indx; - error = 0; - goto out; + return (0); } /* @@ -1077,8 +1074,7 @@ dupfdopen(td, fdp, indx, td->td_dupfd, flags, error)) == 0) { td->td_retval[0] = indx; fdrop(fp, td); - error = 0; - goto out; + return (0); } /* * Clean up the descriptor, but only if another thread hadn't @@ -1089,7 +1085,7 @@ if (error == ERESTART) error = EINTR; - goto out; + return (error); } td->td_dupfd = 0; vfslocked = NDHASGIANT(&nd); @@ -1149,8 +1145,6 @@ fdrop(fp, td); td->td_retval[0] = indx; return (0); -out: - return (error); bad: VFS_UNLOCK_GIANT(vfslocked); fdclose(fdp, fp, indx, td); @@ -1257,8 +1251,8 @@ } if (error) return (error); +restart: bwillwrite(); -restart: NDINIT_AT(&nd, CREATE, 0 | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) @@ -1382,8 +1376,8 @@ int vfslocked; AUDIT_ARG(mode, mode); +restart: bwillwrite(); -restart: NDINIT_AT(&nd, CREATE, 0 | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) @@ -1532,9 +1526,9 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, const char *path2, enum uio_seg segflg, int follow) { - struct nameidata nd; struct vnode *vp; struct mount *mp; + struct nameidata nd; int vfslocked; int lvfslocked; int error; @@ -1544,20 +1538,19 @@ AUDITVNODE1, segflg, path1, td, fd1); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if (vp->v_type == VDIR) { vrele(vp); VFS_UNLOCK_GIANT(vfslocked); - error = EPERM; /* POSIX */ - goto out; + return (EPERM); /* POSIX */ } if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) { vrele(vp); VFS_UNLOCK_GIANT(vfslocked); - goto out; + return (error); } NDINIT_AT(&nd, CREATE, 0 | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, segflg, path2, td, fd2); @@ -1591,8 +1584,6 @@ vrele(vp); vn_finished_write(mp); VFS_UNLOCK_GIANT(vfslocked); - -out: return (error); } @@ -1656,8 +1647,8 @@ goto out; } AUDIT_ARG(text, syspath); +restart: bwillwrite(); -restart: NDINIT_AT(&nd, CREATE, 0 | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, segflg, path2, td, fd); if ((error = namei(&nd)) != 0) @@ -1821,8 +1812,8 @@ struct nameidata nd; int vfslocked; +restart: bwillwrite(); -restart: NDINIT_AT(&nd, DELETE, 0 | LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) @@ -2091,9 +2082,9 @@ kern_accessat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, int flags) { - struct nameidata nd; struct ucred *cred, *tmpcred; struct vnode *vp; + struct nameidata nd; int vfslocked; int error; @@ -2330,7 +2321,7 @@ LOCKLEAF | AUDITVNODE1 | MPSAFE, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -2340,7 +2331,6 @@ printf("stat(%d): %s\n", vfslocked, path); if (error == 0) *sbp = sb; -out: return (error); } @@ -2388,7 +2378,7 @@ NDINIT_AT(&nd, LOOKUP, 0 | NOFOLLOW | LOCKLEAF | LOCKSHARED | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); vp = nd.ni_vp; error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td); @@ -2397,7 +2387,6 @@ VFS_UNLOCK_GIANT(vfslocked); if (error == 0) *sbp = sb; -out: return (error); } @@ -2577,17 +2566,18 @@ kern_readlinkat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, char *buf, enum uio_seg bufseg, int count) { - struct nameidata nd; struct vnode *vp; struct iovec aiov; struct uio auio; - int error, vfslocked; + int error; + struct nameidata nd; + int vfslocked; NDINIT_AT(&nd, LOOKUP, 0 | NOFOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); NDFREE(&nd, NDF_ONLY_PNBUF); vfslocked = NDHASGIANT(&nd); vp = nd.ni_vp; @@ -2596,7 +2586,7 @@ if (error) { vput(vp); VFS_UNLOCK_GIANT(vfslocked); - goto out; + return (error); } #endif if (vp->v_type != VLNK) @@ -2616,7 +2606,6 @@ vput(vp); VFS_UNLOCK_GIANT(vfslocked); td->td_retval[0] = count - auio.uio_resid; -out: return (error); } @@ -2853,13 +2842,12 @@ AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); error = setfmode(td, nd.ni_vp, mode); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); -out: return (error); } @@ -2896,13 +2884,12 @@ NDINIT_AT(&nd, LOOKUP, NOFOLLOW | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); error = setfmode(td, nd.ni_vp, mode); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); -out: return (error); } @@ -3036,13 +3023,12 @@ AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); error = setfown(td, nd.ni_vp, uid, gid); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); -out: return (error); } @@ -3087,13 +3073,12 @@ AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); error = setfown(td, nd.ni_vp, uid, gid); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); -out: return (error); } @@ -3265,15 +3250,14 @@ AUDITVNODE1, pathseg, path, td, fd); if ((error = getutimes(tptr, tptrseg, ts)) != 0) - goto out; + return (error); if ((error = namei(&nd)) != 0) - goto out; + return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); error = setutimes(td, nd.ni_vp, ts, 2, tptr == NULL); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); -out: return (error); } @@ -3668,15 +3652,14 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, const char *new, enum uio_seg pathseg) { - struct nameidata fromnd, tond; struct mount *mp = NULL; struct vnode *tvp, *fvp, *tdvp; + struct nameidata fromnd, tond; int tvfslocked; int fvfslocked; int error; bwillwrite(); - #ifdef MAC NDINIT_AT(&fromnd, DELETE, 0 | LOCKPARENT | LOCKLEAF | SAVESTART | MPSAFE | AUDITVNODE1, pathseg, old, td, oldfd); @@ -3689,7 +3672,7 @@ pathseg, new, td, newfd); if ((error = namei(&fromnd)) != 0) - goto out2; + return (error); fvfslocked = NDHASGIANT(&fromnd); tvfslocked = 0; #ifdef MAC @@ -3777,8 +3760,6 @@ vrele(fromnd.ni_startdir); VFS_UNLOCK_GIANT(fvfslocked); VFS_UNLOCK_GIANT(tvfslocked); - -out2: /* Nothing to do, return success. */ if (error == -1) return (0); @@ -3837,8 +3818,8 @@ int vfslocked; AUDIT_ARG(mode, mode); +restart: bwillwrite(); -restart: NDINIT_AT(&nd, CREATE, 0 | LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, segflg, path, td, fd); nd.ni_cnd.cn_flags |= WILLBEDIR; @@ -3928,8 +3909,8 @@ struct nameidata nd; int vfslocked; +restart: bwillwrite(); -restart: NDINIT_AT(&nd, DELETE, 0 | LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1, pathseg, path, td, fd); if ((error = namei(&nd)) != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712281450.lBSEondt014252>