From: Chris Torek Date: Wed, 8 Jul 1992 08:21:13 +0000 (-0800) Subject: Chris sez time is volatile X-Git-Tag: BSD-4_4-Snapshot-Development~6101 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/fa4f99ac53d7d27367f558a8d5654aa030acfef5 Chris sez time is volatile SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.102 SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.102 --- diff --git a/usr/src/sys/ufs/ffs/ufs_vnops.c b/usr/src/sys/ufs/ffs/ufs_vnops.c index 9ef5a0bfbe..782d8c9816 100644 --- a/usr/src/sys/ufs/ffs/ufs_vnops.c +++ b/usr/src/sys/ufs/ffs/ufs_vnops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ufs_vnops.c 7.101 (Berkeley) %G% + * @(#)ufs_vnops.c 7.102 (Berkeley) %G% */ #include @@ -597,6 +597,7 @@ ufs_link(ap) register struct vnode *tdvp = ap->a_tdvp; register struct componentname *cnp = ap->a_cnp; register struct inode *ip; + struct timeval tv; int error; if (vp->v_mount != tdvp->v_mount) { @@ -621,7 +622,8 @@ ufs_link(ap) ILOCK(ip); ip->i_nlink++; ip->i_flag |= ICHG; - error = VOP_UPDATE(tdvp, &time, &time, 1); + tv = time; + error = VOP_UPDATE(tdvp, &tv, &tv, 1); if (!error) error = ufs_direnter(ip, vp, cnp); if (vp != tdvp) @@ -834,6 +836,7 @@ ufs_rename(ap) register struct componentname *fcnp = ap->a_fcnp; register struct inode *ip, *xp, *dp; struct dirtemplate dirbuf; + struct timeval tv; int doingdirectory = 0, oldparent = 0, newparent = 0; int error = 0; int fdvpneedsrele = 1, tdvpneedsrele = 1; @@ -909,7 +912,8 @@ ufs_rename(ap) */ ip->i_nlink++; ip->i_flag |= ICHG; - error = VOP_UPDATE(fvp, &time, &time, 1); + tv = time; + error = VOP_UPDATE(fvp, &tv, &tv, 1); IUNLOCK(ip); /* @@ -974,14 +978,14 @@ ufs_rename(ap) } dp->i_nlink++; dp->i_flag |= ICHG; - if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1)) + if (error = VOP_UPDATE(ITOV(dp), &tv, &tv, 1)) goto bad; } if (error = ufs_direnter(ip, tdvp, tcnp)) { if (doingdirectory && newparent) { dp->i_nlink--; dp->i_flag |= ICHG; - (void)VOP_UPDATE(ITOV(dp), &time, &time, 1); + (void)VOP_UPDATE(ITOV(dp), &tv, &tv, 1); } goto bad; } @@ -1192,8 +1196,8 @@ ufs_mkdir(ap) register struct inode *ip, *dp; struct vnode *tvp; struct dirtemplate dirtemplate, *dtp; - int error; - int dmode; + struct timeval tv; + int error, dmode; #ifdef DIAGNOSTIC if ((cnp->cn_flags & HASBUF) == 0) @@ -1234,7 +1238,8 @@ ufs_mkdir(ap) ip->i_mode = dmode; ITOV(ip)->v_type = VDIR; /* Rest init'd in iget() */ ip->i_nlink = 2; - error = VOP_UPDATE(ITOV(ip), &time, &time, 1); + tv = time; + error = VOP_UPDATE(ITOV(ip), &tv, &tv, 1); /* * Bump link count in parent directory @@ -1244,7 +1249,7 @@ ufs_mkdir(ap) */ dp->i_nlink++; dp->i_flag |= ICHG; - if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1)) + if (error = VOP_UPDATE(ITOV(dp), &tv, &tv, 1)) goto bad; /* Initialize directory with "." and ".." from static template. */ @@ -1914,6 +1919,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) struct componentname *cnp; { register struct inode *ip, *pdir; + struct timeval tv; struct vnode *tvp; int error; @@ -1955,7 +1961,8 @@ ufs_makeinode(mode, dvp, vpp, cnp) /* * Make sure inode goes to disk before directory entry. */ - if (error = VOP_UPDATE(tvp, &time, &time, 1)) + tv = time; + if (error = VOP_UPDATE(tvp, &tv, &tv, 1)) goto bad; if (error = ufs_direnter(ip, dvp, cnp)) goto bad; diff --git a/usr/src/sys/ufs/ufs/ufs_vnops.c b/usr/src/sys/ufs/ufs/ufs_vnops.c index 9ef5a0bfbe..782d8c9816 100644 --- a/usr/src/sys/ufs/ufs/ufs_vnops.c +++ b/usr/src/sys/ufs/ufs/ufs_vnops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ufs_vnops.c 7.101 (Berkeley) %G% + * @(#)ufs_vnops.c 7.102 (Berkeley) %G% */ #include @@ -597,6 +597,7 @@ ufs_link(ap) register struct vnode *tdvp = ap->a_tdvp; register struct componentname *cnp = ap->a_cnp; register struct inode *ip; + struct timeval tv; int error; if (vp->v_mount != tdvp->v_mount) { @@ -621,7 +622,8 @@ ufs_link(ap) ILOCK(ip); ip->i_nlink++; ip->i_flag |= ICHG; - error = VOP_UPDATE(tdvp, &time, &time, 1); + tv = time; + error = VOP_UPDATE(tdvp, &tv, &tv, 1); if (!error) error = ufs_direnter(ip, vp, cnp); if (vp != tdvp) @@ -834,6 +836,7 @@ ufs_rename(ap) register struct componentname *fcnp = ap->a_fcnp; register struct inode *ip, *xp, *dp; struct dirtemplate dirbuf; + struct timeval tv; int doingdirectory = 0, oldparent = 0, newparent = 0; int error = 0; int fdvpneedsrele = 1, tdvpneedsrele = 1; @@ -909,7 +912,8 @@ ufs_rename(ap) */ ip->i_nlink++; ip->i_flag |= ICHG; - error = VOP_UPDATE(fvp, &time, &time, 1); + tv = time; + error = VOP_UPDATE(fvp, &tv, &tv, 1); IUNLOCK(ip); /* @@ -974,14 +978,14 @@ ufs_rename(ap) } dp->i_nlink++; dp->i_flag |= ICHG; - if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1)) + if (error = VOP_UPDATE(ITOV(dp), &tv, &tv, 1)) goto bad; } if (error = ufs_direnter(ip, tdvp, tcnp)) { if (doingdirectory && newparent) { dp->i_nlink--; dp->i_flag |= ICHG; - (void)VOP_UPDATE(ITOV(dp), &time, &time, 1); + (void)VOP_UPDATE(ITOV(dp), &tv, &tv, 1); } goto bad; } @@ -1192,8 +1196,8 @@ ufs_mkdir(ap) register struct inode *ip, *dp; struct vnode *tvp; struct dirtemplate dirtemplate, *dtp; - int error; - int dmode; + struct timeval tv; + int error, dmode; #ifdef DIAGNOSTIC if ((cnp->cn_flags & HASBUF) == 0) @@ -1234,7 +1238,8 @@ ufs_mkdir(ap) ip->i_mode = dmode; ITOV(ip)->v_type = VDIR; /* Rest init'd in iget() */ ip->i_nlink = 2; - error = VOP_UPDATE(ITOV(ip), &time, &time, 1); + tv = time; + error = VOP_UPDATE(ITOV(ip), &tv, &tv, 1); /* * Bump link count in parent directory @@ -1244,7 +1249,7 @@ ufs_mkdir(ap) */ dp->i_nlink++; dp->i_flag |= ICHG; - if (error = VOP_UPDATE(ITOV(dp), &time, &time, 1)) + if (error = VOP_UPDATE(ITOV(dp), &tv, &tv, 1)) goto bad; /* Initialize directory with "." and ".." from static template. */ @@ -1914,6 +1919,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) struct componentname *cnp; { register struct inode *ip, *pdir; + struct timeval tv; struct vnode *tvp; int error; @@ -1955,7 +1961,8 @@ ufs_makeinode(mode, dvp, vpp, cnp) /* * Make sure inode goes to disk before directory entry. */ - if (error = VOP_UPDATE(tvp, &time, &time, 1)) + tv = time; + if (error = VOP_UPDATE(tvp, &tv, &tv, 1)) goto bad; if (error = ufs_direnter(ip, dvp, cnp)) goto bad;