Deleted Added
full compact
vfs_syscalls.c (29495) vfs_syscalls.c (29653)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
39 * $Id: vfs_syscalls.c,v 1.70 1997/09/15 19:11:07 phk Exp $
39 * $Id: vfs_syscalls.c,v 1.71 1997/09/16 08:05:09 phk Exp $
40 */
41
42/*
43 * XXX - The following is required because of some magic done
44 * in getdirentries() below which is only done if the translucent
45 * filesystem `UNION' is compiled into the kernel. This is broken,
46 * but I don't have time to study the code deeply enough to understand
47 * what's going on and determine an appropriate fix. -GAW

--- 1104 unchanged lines hidden (view full) ---

1152 } */ *uap;
1153 register_t *retval;
1154{
1155 struct vattr vattr;
1156 char *path;
1157 int error;
1158 struct nameidata nd;
1159
40 */
41
42/*
43 * XXX - The following is required because of some magic done
44 * in getdirentries() below which is only done if the translucent
45 * filesystem `UNION' is compiled into the kernel. This is broken,
46 * but I don't have time to study the code deeply enough to understand
47 * what's going on and determine an appropriate fix. -GAW

--- 1104 unchanged lines hidden (view full) ---

1152 } */ *uap;
1153 register_t *retval;
1154{
1155 struct vattr vattr;
1156 char *path;
1157 int error;
1158 struct nameidata nd;
1159
1160 MALLOC(path, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
1160 path = zalloc(namei_zone);
1161 if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL))
1162 goto out;
1163 NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, link), p);
1164 if (error = namei(&nd))
1165 goto out;
1166 if (nd.ni_vp) {
1167 VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
1168 if (nd.ni_dvp == nd.ni_vp)

--- 6 unchanged lines hidden (view full) ---

1175 }
1176 VATTR_NULL(&vattr);
1177 vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
1178 VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
1179 error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
1180 ASSERT_VOP_UNLOCKED(nd.ni_dvp, "symlink");
1181 ASSERT_VOP_UNLOCKED(nd.ni_vp, "symlink");
1182out:
1161 if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL))
1162 goto out;
1163 NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, link), p);
1164 if (error = namei(&nd))
1165 goto out;
1166 if (nd.ni_vp) {
1167 VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
1168 if (nd.ni_dvp == nd.ni_vp)

--- 6 unchanged lines hidden (view full) ---

1175 }
1176 VATTR_NULL(&vattr);
1177 vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
1178 VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
1179 error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
1180 ASSERT_VOP_UNLOCKED(nd.ni_dvp, "symlink");
1181 ASSERT_VOP_UNLOCKED(nd.ni_vp, "symlink");
1182out:
1183 FREE(path, M_NAMEI);
1183 zfree(namei_zone, path);
1184 return (error);
1185}
1186
1187/*
1188 * Delete a whiteout from the filesystem.
1189 */
1190/* ARGSUSED */
1191int

--- 1091 unchanged lines hidden (view full) ---

2283 vrele(fromnd.ni_dvp);
2284 vrele(fvp);
2285 }
2286 vrele(tond.ni_startdir);
2287 ASSERT_VOP_UNLOCKED(fromnd.ni_dvp, "rename");
2288 ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
2289 ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
2290 ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
1184 return (error);
1185}
1186
1187/*
1188 * Delete a whiteout from the filesystem.
1189 */
1190/* ARGSUSED */
1191int

--- 1091 unchanged lines hidden (view full) ---

2283 vrele(fromnd.ni_dvp);
2284 vrele(fvp);
2285 }
2286 vrele(tond.ni_startdir);
2287 ASSERT_VOP_UNLOCKED(fromnd.ni_dvp, "rename");
2288 ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
2289 ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
2290 ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
2291 FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
2291 zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
2292out1:
2293 if (fromnd.ni_startdir)
2294 vrele(fromnd.ni_startdir);
2292out1:
2293 if (fromnd.ni_startdir)
2294 vrele(fromnd.ni_startdir);
2295 FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
2295 zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
2296 if (error == -1)
2297 return (0);
2298 return (error);
2299}
2300
2301/*
2302 * Make a directory file.
2303 */

--- 307 unchanged lines hidden (view full) ---

2611 aiov.iov_base = SCARG(uap, buf);
2612 aiov.iov_len = SCARG(uap, count);
2613 auio.uio_iov = &aiov;
2614 auio.uio_iovcnt = 1;
2615 auio.uio_rw = UIO_READ;
2616 auio.uio_segflg = UIO_USERSPACE;
2617 auio.uio_procp = p;
2618 auio.uio_resid = SCARG(uap, count);
2296 if (error == -1)
2297 return (0);
2298 return (error);
2299}
2300
2301/*
2302 * Make a directory file.
2303 */

--- 307 unchanged lines hidden (view full) ---

2611 aiov.iov_base = SCARG(uap, buf);
2612 aiov.iov_len = SCARG(uap, count);
2613 auio.uio_iov = &aiov;
2614 auio.uio_iovcnt = 1;
2615 auio.uio_rw = UIO_READ;
2616 auio.uio_segflg = UIO_USERSPACE;
2617 auio.uio_procp = p;
2618 auio.uio_resid = SCARG(uap, count);
2619 /* vn_lock(vp, LK_SHARED | LK_RETRY, p); */
2619 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
2620 loff = auio.uio_offset = fp->f_offset;
2621 error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL);
2622 fp->f_offset = auio.uio_offset;
2623 VOP_UNLOCK(vp, 0, p);
2624 if (error)
2625 return (error);
2626

--- 209 unchanged lines hidden ---
2620 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
2621 loff = auio.uio_offset = fp->f_offset;
2622 error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL);
2623 fp->f_offset = auio.uio_offset;
2624 VOP_UNLOCK(vp, 0, p);
2625 if (error)
2626 return (error);
2627

--- 209 unchanged lines hidden ---