-/*
- * Update the access, modified, and inode change times as specified
- * by the IACC, IMOD, and ICHG flags respectively. The IUPD flag
- * is used to specify that the inode needs to be updated but that
- * the times have already been set. The access and modified times
- * are taken from the second and third parameters; the inode change
- * time is always taken from the current time. If waitfor is set,
- * then wait for the disk write of the inode to complete.
- */
-lfs_iupdat(ip, ta, tm, waitfor)
- register struct inode *ip;
- struct timeval *ta, *tm;
- int waitfor;
-{
- struct buf *bp;
- struct vnode *vp = ITOV(ip);
- struct dinode *dp;
- register struct fs *fs;
-
- fs = ip->i_fs;
- if ((ip->i_flag & (IUPD|IACC|ICHG|IMOD)) == 0)
- return (0);
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (0);
- error = bread(ip->i_devvp, fsbtodb(fs, itod(fs, ip->i_number)),
- (int)fs->lfs_bsize, NOCRED, &bp);
- if (error) {
- brelse(bp);
- return (error);
- }
- if (ip->i_flag&IACC)
- ip->i_atime = ta->tv_sec;
- if (ip->i_flag&IUPD)
- ip->i_mtime = tm->tv_sec;
- if (ip->i_flag&ICHG)
- ip->i_ctime = time.tv_sec;
- ip->i_flag &= ~(IUPD|IACC|ICHG|IMOD); /* LFS */
- *lfs_ifind(fs, ip->i_number, bp->b_un.b_dino) = ip->i_din;
- if (waitfor) {
- return (bwrite(bp));
- } else {
- bdwrite(bp);
- return (0);
- }
-}
-