diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 49de28cc5ea9..7abfb479eddf 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_vnops.c,v 1.17 1995/06/11 19:31:37 rgrimes Exp $ */ +/* $Id: msdosfs_vnops.c,v 1.18 1995/06/28 07:06:48 davidg Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */ /*- @@ -903,8 +903,8 @@ msdosfs_remove(ap) int msdosfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 0a1be17102af..315fc629e9e8 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_vnops.c 8.6 (Berkeley) 2/17/94 - * $Id: union_vnops.c,v 1.8 1994/11/04 14:41:46 davidg Exp $ + * $Id: union_vnops.c,v 1.9 1995/06/28 07:06:46 davidg Exp $ */ #include @@ -898,8 +898,8 @@ union_remove(ap) int union_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { @@ -919,7 +919,7 @@ union_link(ap) VREF(vp); vrele(ap->a_tdvp); - error = VOP_LINK(vp, dvp, ap->a_cnp); + error = VOP_LINK(dvp, vp, ap->a_cnp); } else { /* * XXX: need to copy to upper layer diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index c9f62abee74f..99e2b5803519 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.28 1995/07/13 08:47:42 davidg Exp $ + * $Id: vfs_syscalls.c,v 1.29 1995/07/31 00:35:47 bde Exp $ */ #include @@ -839,15 +839,7 @@ link(p, uap, retval) nd.ni_dirp = uap->link; error = namei(&nd); if (!error) { - if (nd.ni_vp != NULL) - error = EEXIST; - if (!error) { - LEASE_CHECK(nd.ni_dvp, - p, p->p_ucred, LEASE_WRITE); - LEASE_CHECK(vp, - p, p->p_ucred, LEASE_WRITE); - error = VOP_LINK(vp, nd.ni_dvp, &nd.ni_cnd); - } else { + if (nd.ni_vp != NULL) { VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); @@ -855,6 +847,13 @@ link(p, uap, retval) vput(nd.ni_dvp); if (nd.ni_vp) vrele(nd.ni_vp); + error = EEXIST; + } else { + LEASE_CHECK(nd.ni_dvp, + p, p->p_ucred, LEASE_WRITE); + LEASE_CHECK(vp, + p, p->p_ucred, LEASE_WRITE); + error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); } } } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c9f62abee74f..99e2b5803519 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.28 1995/07/13 08:47:42 davidg Exp $ + * $Id: vfs_syscalls.c,v 1.29 1995/07/31 00:35:47 bde Exp $ */ #include @@ -839,15 +839,7 @@ link(p, uap, retval) nd.ni_dirp = uap->link; error = namei(&nd); if (!error) { - if (nd.ni_vp != NULL) - error = EEXIST; - if (!error) { - LEASE_CHECK(nd.ni_dvp, - p, p->p_ucred, LEASE_WRITE); - LEASE_CHECK(vp, - p, p->p_ucred, LEASE_WRITE); - error = VOP_LINK(vp, nd.ni_dvp, &nd.ni_cnd); - } else { + if (nd.ni_vp != NULL) { VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); @@ -855,6 +847,13 @@ link(p, uap, retval) vput(nd.ni_dvp); if (nd.ni_vp) vrele(nd.ni_vp); + error = EEXIST; + } else { + LEASE_CHECK(nd.ni_dvp, + p, p->p_ucred, LEASE_WRITE); + LEASE_CHECK(vp, + p, p->p_ucred, LEASE_WRITE); + error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); } } } diff --git a/sys/kern/vnode_if.pl b/sys/kern/vnode_if.pl index 5066a1c49c7a..577deb9d93b9 100644 --- a/sys/kern/vnode_if.pl +++ b/sys/kern/vnode_if.pl @@ -32,7 +32,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93 -# $Id: vnode_if.sh,v 1.2 1994/08/02 07:43:34 davidg Exp $ +# $Id: vnode_if.sh,v 1.3 1995/07/07 13:41:27 davidg Exp $ # # Script to produce VFS front-end sugar. @@ -372,27 +372,6 @@ static inline int VOP_BWRITE(bp) a.a_bp = bp; return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a)); } - -struct vop_link_args { - struct vnodeop_desc *a_desc; - struct vnode *a_vp; - struct vnode *a_tdvp; - struct componentname *a_cnp; -}; -extern struct vnodeop_desc vop_link_desc; -static inline int VOP_LINK(vp, tdvp, cnp) - struct vnode *vp; - struct vnode *tdvp; - struct componentname *cnp; -{ - struct vop_link_args a; - - a.a_desc = VDESC(vop_link); - a.a_vp = vp; - a.a_tdvp = tdvp; - a.a_cnp = cnp; - return (VCALL(tdvp, VOFFSET(vop_link), &a)); -} END_OF_SPECIAL_CASES cat << END_OF_SPECIAL_CASES >> $CFILE @@ -424,22 +403,6 @@ struct vnodeop_desc vop_bwrite_desc = { VDESC_NO_OFFSET, NULL, }; -int vop_link_vp_offsets[] = { - VOPARG_OFFSETOF(struct vop_link_args,a_vp), - VOPARG_OFFSETOF(struct vop_link_args,a_tdvp), - VDESC_NO_OFFSET -}; -struct vnodeop_desc vop_link_desc = { - 0, - "vop_link", - VDESC_VP1_WILLRELE, - vop_link_vp_offsets, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VOPARG_OFFSETOF(struct vop_link_args,a_cnp), - NULL, -}; END_OF_SPECIAL_CASES # Add the vfs_op_descs array to the C file. @@ -449,7 +412,6 @@ $AWK ' printf("\t&vop_default_desc, /* MUST BE FIRST */\n"); printf("\t&vop_strategy_desc, /* XXX: SPECIAL CASE */\n"); printf("\t&vop_bwrite_desc, /* XXX: SPECIAL CASE */\n"); - printf("\t&vop_link_desc, /* XXX: SPECIAL CASE */\n"); } END { printf("\tNULL\n};\n"); diff --git a/sys/kern/vnode_if.sh b/sys/kern/vnode_if.sh index 5066a1c49c7a..577deb9d93b9 100644 --- a/sys/kern/vnode_if.sh +++ b/sys/kern/vnode_if.sh @@ -32,7 +32,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93 -# $Id: vnode_if.sh,v 1.2 1994/08/02 07:43:34 davidg Exp $ +# $Id: vnode_if.sh,v 1.3 1995/07/07 13:41:27 davidg Exp $ # # Script to produce VFS front-end sugar. @@ -372,27 +372,6 @@ static inline int VOP_BWRITE(bp) a.a_bp = bp; return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a)); } - -struct vop_link_args { - struct vnodeop_desc *a_desc; - struct vnode *a_vp; - struct vnode *a_tdvp; - struct componentname *a_cnp; -}; -extern struct vnodeop_desc vop_link_desc; -static inline int VOP_LINK(vp, tdvp, cnp) - struct vnode *vp; - struct vnode *tdvp; - struct componentname *cnp; -{ - struct vop_link_args a; - - a.a_desc = VDESC(vop_link); - a.a_vp = vp; - a.a_tdvp = tdvp; - a.a_cnp = cnp; - return (VCALL(tdvp, VOFFSET(vop_link), &a)); -} END_OF_SPECIAL_CASES cat << END_OF_SPECIAL_CASES >> $CFILE @@ -424,22 +403,6 @@ struct vnodeop_desc vop_bwrite_desc = { VDESC_NO_OFFSET, NULL, }; -int vop_link_vp_offsets[] = { - VOPARG_OFFSETOF(struct vop_link_args,a_vp), - VOPARG_OFFSETOF(struct vop_link_args,a_tdvp), - VDESC_NO_OFFSET -}; -struct vnodeop_desc vop_link_desc = { - 0, - "vop_link", - VDESC_VP1_WILLRELE, - vop_link_vp_offsets, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VOPARG_OFFSETOF(struct vop_link_args,a_cnp), - NULL, -}; END_OF_SPECIAL_CASES # Add the vfs_op_descs array to the C file. @@ -449,7 +412,6 @@ $AWK ' printf("\t&vop_default_desc, /* MUST BE FIRST */\n"); printf("\t&vop_strategy_desc, /* XXX: SPECIAL CASE */\n"); printf("\t&vop_bwrite_desc, /* XXX: SPECIAL CASE */\n"); - printf("\t&vop_link_desc, /* XXX: SPECIAL CASE */\n"); } END { printf("\tNULL\n};\n"); diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index 37ef15ae81f3..c5f1094762fb 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -31,7 +31,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.src 8.3 (Berkeley) 2/3/94 -# $Id: vnode_if.src,v 1.4 1995/06/28 07:06:41 davidg Exp $ +# $Id: vnode_if.src,v 1.5 1995/07/07 13:41:28 davidg Exp $ # vop_lookup { IN struct vnode *dvp; @@ -148,15 +148,11 @@ vop_remove { IN struct componentname *cnp; }; -# Gack. The generated VCALL uses the first vp which might -# not be handled by the same FS as the directory (e.g. special -# device files)...so it's special-cased. -# -#vop_link { -# IN struct vnode *vp; -# IN WILLRELE struct vnode *tdvp; -# IN struct componentname *cnp; -#}; +vop_link { + IN WILLRELE struct vnode *tdvp; + IN struct vnode *vp; + IN struct componentname *cnp; +}; vop_rename { IN WILLRELE struct vnode *fdvp; diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index 5deda3e88d45..abd3bf4ee730 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1,7 +1,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.4 1995/05/03 23:04:26 julian Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.5 1995/05/30 08:06:53 rgrimes Exp $ * * symlinks can wait 'til later. */ @@ -820,8 +820,8 @@ DBPRINT(("remove\n")); */ int devfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c index 0a1be17102af..315fc629e9e8 100644 --- a/sys/miscfs/union/union_vnops.c +++ b/sys/miscfs/union/union_vnops.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)union_vnops.c 8.6 (Berkeley) 2/17/94 - * $Id: union_vnops.c,v 1.8 1994/11/04 14:41:46 davidg Exp $ + * $Id: union_vnops.c,v 1.9 1995/06/28 07:06:46 davidg Exp $ */ #include @@ -898,8 +898,8 @@ union_remove(ap) int union_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { @@ -919,7 +919,7 @@ union_link(ap) VREF(vp); vrele(ap->a_tdvp); - error = VOP_LINK(vp, dvp, ap->a_cnp); + error = VOP_LINK(dvp, vp, ap->a_cnp); } else { /* * XXX: need to copy to upper layer diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 49de28cc5ea9..7abfb479eddf 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_vnops.c,v 1.17 1995/06/11 19:31:37 rgrimes Exp $ */ +/* $Id: msdosfs_vnops.c,v 1.18 1995/06/28 07:06:48 davidg Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */ /*- @@ -903,8 +903,8 @@ msdosfs_remove(ap) int msdosfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index d8659d1474eb..8330da65726c 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94 - * $Id: nfs_serv.c,v 1.17 1995/06/28 07:06:50 davidg Exp $ + * $Id: nfs_serv.c,v 1.18 1995/06/28 12:01:03 davidg Exp $ */ /* @@ -2026,7 +2026,7 @@ out: if (!error) { nqsrv_getl(vp, ND_WRITE); nqsrv_getl(xp, ND_WRITE); -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); #else error = VOP_LINK(vp, nd.ni_dvp, &nd.ni_cnd); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 2b66340c5cb5..1a08ca250190 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.21 1995/07/24 12:50:49 dfr Exp $ + * $Id: nfs_vnops.c,v 1.22 1995/07/24 16:38:05 dfr Exp $ */ /* @@ -1646,14 +1646,14 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) int nfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { #if defined(__NetBSD__) /* - * Since the args are reversed in the VOP_LINK() calls, + * Since the args are reversed in the VOP_LINK() calls, * switch them back. Argh! */ register struct vnode *vp = ap->a_tdvp; diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 2b66340c5cb5..1a08ca250190 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.21 1995/07/24 12:50:49 dfr Exp $ + * $Id: nfs_vnops.c,v 1.22 1995/07/24 16:38:05 dfr Exp $ */ /* @@ -1646,14 +1646,14 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) int nfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { #if defined(__NetBSD__) /* - * Since the args are reversed in the VOP_LINK() calls, + * Since the args are reversed in the VOP_LINK() calls, * switch them back. Argh! */ register struct vnode *vp = ap->a_tdvp; diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index d8659d1474eb..8330da65726c 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94 - * $Id: nfs_serv.c,v 1.17 1995/06/28 07:06:50 davidg Exp $ + * $Id: nfs_serv.c,v 1.18 1995/06/28 12:01:03 davidg Exp $ */ /* @@ -2026,7 +2026,7 @@ out: if (!error) { nqsrv_getl(vp, ND_WRITE); nqsrv_getl(xp, ND_WRITE); -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); #else error = VOP_LINK(vp, nd.ni_dvp, &nd.ni_cnd); diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk index 5066a1c49c7a..577deb9d93b9 100644 --- a/sys/tools/vnode_if.awk +++ b/sys/tools/vnode_if.awk @@ -32,7 +32,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93 -# $Id: vnode_if.sh,v 1.2 1994/08/02 07:43:34 davidg Exp $ +# $Id: vnode_if.sh,v 1.3 1995/07/07 13:41:27 davidg Exp $ # # Script to produce VFS front-end sugar. @@ -372,27 +372,6 @@ static inline int VOP_BWRITE(bp) a.a_bp = bp; return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a)); } - -struct vop_link_args { - struct vnodeop_desc *a_desc; - struct vnode *a_vp; - struct vnode *a_tdvp; - struct componentname *a_cnp; -}; -extern struct vnodeop_desc vop_link_desc; -static inline int VOP_LINK(vp, tdvp, cnp) - struct vnode *vp; - struct vnode *tdvp; - struct componentname *cnp; -{ - struct vop_link_args a; - - a.a_desc = VDESC(vop_link); - a.a_vp = vp; - a.a_tdvp = tdvp; - a.a_cnp = cnp; - return (VCALL(tdvp, VOFFSET(vop_link), &a)); -} END_OF_SPECIAL_CASES cat << END_OF_SPECIAL_CASES >> $CFILE @@ -424,22 +403,6 @@ struct vnodeop_desc vop_bwrite_desc = { VDESC_NO_OFFSET, NULL, }; -int vop_link_vp_offsets[] = { - VOPARG_OFFSETOF(struct vop_link_args,a_vp), - VOPARG_OFFSETOF(struct vop_link_args,a_tdvp), - VDESC_NO_OFFSET -}; -struct vnodeop_desc vop_link_desc = { - 0, - "vop_link", - VDESC_VP1_WILLRELE, - vop_link_vp_offsets, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VDESC_NO_OFFSET, - VOPARG_OFFSETOF(struct vop_link_args,a_cnp), - NULL, -}; END_OF_SPECIAL_CASES # Add the vfs_op_descs array to the C file. @@ -449,7 +412,6 @@ $AWK ' printf("\t&vop_default_desc, /* MUST BE FIRST */\n"); printf("\t&vop_strategy_desc, /* XXX: SPECIAL CASE */\n"); printf("\t&vop_bwrite_desc, /* XXX: SPECIAL CASE */\n"); - printf("\t&vop_link_desc, /* XXX: SPECIAL CASE */\n"); } END { printf("\tNULL\n};\n"); diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 138931e70d23..d05953e01834 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_vnops.c 8.5 (Berkeley) 12/30/93 - * $Id: lfs_vnops.c,v 1.11 1995/06/28 12:01:10 davidg Exp $ + * $Id: lfs_vnops.c,v 1.12 1995/07/13 08:48:07 davidg Exp $ */ #include @@ -381,8 +381,8 @@ lfs_rmdir(ap) int lfs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; { diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index addd221fefaa..37000ccbb132 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94 - * $Id: ufs_vnops.c,v 1.24 1995/05/30 08:15:39 rgrimes Exp $ + * $Id: ufs_vnops.c,v 1.25 1995/06/28 07:06:55 davidg Exp $ */ #include @@ -666,8 +666,8 @@ out: int ufs_link(ap) struct vop_link_args /* { - struct vnode *a_vp; struct vnode *a_tdvp; + struct vnode *a_vp; struct componentname *a_cnp; } */ *ap; {