summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorassar <assar@cvs.openbsd.org>2001-07-26 02:10:42 +0000
committerassar <assar@cvs.openbsd.org>2001-07-26 02:10:42 +0000
commit9d3aef2f8343f433bc39e01bd86f02e3a4815af3 (patch)
tree5767d4e31c87272afaf2ef7a4c68622da92a9866 /sys/kern
parent884823bfdf5ae3686d10cc854ad323da4e92734e (diff)
change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it. update callers and file systems that implement these vnode operations ok'd by art
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c11
-rw-r--r--sys/kern/vnode_if.c4
-rw-r--r--sys/kern/vnode_if.src14
3 files changed, 16 insertions, 13 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 9fabe83751d..a8db38f7ece 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.78 2001/06/27 04:49:48 art Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.79 2001/07/26 02:10:41 assar Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1249,6 +1249,8 @@ sys_mknod(p, v, retval)
} else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
+ if (error == 0)
+ vput(nd.ni_vp);
}
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1299,7 +1301,10 @@ sys_mkfifo(p, v, retval)
vattr.va_type = VFIFO;
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- return (VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr));
+ error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ if (error == 0)
+ vput(nd.ni_vp);
+ return (error);
#endif /* FIFO */
}
@@ -1393,6 +1398,8 @@ sys_symlink(p, v, retval)
vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
+ if (error == 0)
+ vput(nd.ni_vp);
out:
FREE(path, M_NAMEI);
return (error);
diff --git a/sys/kern/vnode_if.c b/sys/kern/vnode_if.c
index 1f30d85c507..f5f698b6c13 100644
--- a/sys/kern/vnode_if.c
+++ b/sys/kern/vnode_if.c
@@ -154,7 +154,7 @@ int vop_mknod_vp_offsets[] = {
struct vnodeop_desc vop_mknod_desc = {
0,
"vop_mknod",
- 0 | VDESC_VP0_WILLRELE | VDESC_VPP_WILLRELE,
+ 0 | VDESC_VP0_WILLRELE,
vop_mknod_vp_offsets,
VOPARG_OFFSETOF(struct vop_mknod_args, a_vpp),
VDESC_NO_OFFSET,
@@ -797,7 +797,7 @@ int vop_symlink_vp_offsets[] = {
struct vnodeop_desc vop_symlink_desc = {
0,
"vop_symlink",
- 0 | VDESC_VP0_WILLRELE | VDESC_VPP_WILLRELE,
+ 0 | VDESC_VP0_WILLRELE,
vop_symlink_vp_offsets,
VOPARG_OFFSETOF(struct vop_symlink_args, a_vpp),
VDESC_NO_OFFSET,
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 91de785496f..e75c931d1a8 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -1,4 +1,4 @@
-# $OpenBSD: vnode_if.src,v 1.11 2001/06/23 02:21:05 csapuntz Exp $
+# $OpenBSD: vnode_if.src,v 1.12 2001/07/26 02:10:41 assar Exp $
# $NetBSD: vnode_if.src,v 1.10 1996/05/11 18:26:27 mycroft Exp $
#
# Copyright (c) 1992, 1993
@@ -102,12 +102,12 @@ vop_create {
#
#% mknod dvp L U U
-#% mknod vpp - X -
+#% mknod vpp - L -
#
vop_mknod {
IN SHOULDBELOCKED WILLRELE struct vnode *dvp;
- OUT WILLRELE struct vnode **vpp;
+ OUT struct vnode **vpp;
IN struct componentname *cnp;
IN struct vattr *vap;
};
@@ -314,16 +314,12 @@ vop_rmdir {
#
#% symlink dvp L U U
-#% symlink vpp - U -
-#
-# XXX - note that the return vnode has already been VRELE'ed
-# by the filesystem layer. To use it you must use vget,
-# possibly with a further namei.
+#% symlink vpp - L -
#
vop_symlink {
IN SHOULDBELOCKED WILLRELE struct vnode *dvp;
- OUT WILLRELE struct vnode **vpp;
+ OUT struct vnode **vpp;
IN struct componentname *cnp;
IN struct vattr *vap;
IN char *target;