Avoid using casts as lvalues. Introduce DIP_SET macro which sets proper

inode field based on UFS version. Use DIP ro read values and DIP_SET
to modify them throughout FFS code base.
This commit is contained in:
kan 2004-07-28 06:41:27 +00:00
parent 7a2c503e1b
commit 586367666d
11 changed files with 120 additions and 109 deletions

View File

@ -152,7 +152,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp)
cg = dtog(fs, bpref);
bno = ffs_hashalloc(ip, cg, bpref, size, ffs_alloccg);
if (bno > 0) {
DIP(ip, i_blocks) += btodb(size);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + btodb(size));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
*bnp = bno;
return (0);
@ -256,7 +256,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, cred, bpp)
if (bno) {
if (bp->b_blkno != fsbtodb(fs, bno))
panic("ffs_realloccg: bad blockno");
DIP(ip, i_blocks) += btodb(nsize - osize);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + btodb(nsize - osize));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
allocbuf(bp, nsize);
bp->b_flags |= B_DONE;
@ -324,7 +324,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, cred, bpp)
if (nsize < request)
ffs_blkfree(fs, ip->i_devvp, bno + numfrags(fs, nsize),
(long)(request - nsize), ip->i_number);
DIP(ip, i_blocks) += btodb(nsize - osize);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + btodb(nsize - osize));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
allocbuf(bp, nsize);
bp->b_flags |= B_DONE;
@ -874,16 +874,16 @@ ffs_valloc(pvp, mode, cred, vpp)
if (DIP(ip, i_blocks) && (fs->fs_flags & FS_UNCLEAN) == 0) { /* XXX */
printf("free inode %s/%lu had %ld blocks\n",
fs->fs_fsmnt, (u_long)ino, (long)DIP(ip, i_blocks));
DIP(ip, i_blocks) = 0;
DIP_SET(ip, i_blocks, 0);
}
ip->i_flags = 0;
DIP(ip, i_flags) = 0;
DIP_SET(ip, i_flags, 0);
/*
* Set up a new generation number for this inode.
*/
if (ip->i_gen == 0 || ++ip->i_gen == 0)
ip->i_gen = arc4random() / 2 + 1;
DIP(ip, i_gen) = ip->i_gen;
DIP_SET(ip, i_gen, ip->i_gen);
if (fs->fs_magic == FS_UFS2_MAGIC) {
vfs_timestamp(&ts);
ip->i_din2->di_birthtime = ts.tv_sec;
@ -2268,7 +2268,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
break;
ip = VTOI(vp);
ip->i_nlink += cmd.size;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_effnlink += cmd.size;
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(vp))
@ -2287,7 +2287,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
if ((error = VFS_VGET(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp)))
break;
ip = VTOI(vp);
DIP(ip, i_blocks) += cmd.size;
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + cmd.size);
ip->i_flag |= IN_CHANGE;
vput(vp);
break;

View File

@ -229,7 +229,7 @@ ffs_truncate(vp, length, flags, cred, td)
#endif
bzero(SHORTLINK(oip), (u_int)oip->i_size);
oip->i_size = 0;
DIP(oip, i_size) = 0;
DIP_SET(oip, i_size, 0);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
if (needextclean)
softdep_setup_freeblocks(oip, length, IO_EXT);
@ -291,7 +291,7 @@ ffs_truncate(vp, length, flags, cred, td)
if (error)
return (error);
oip->i_size = length;
DIP(oip, i_size) = length;
DIP_SET(oip, i_size, length);
if (bp->b_bufsize == fs->fs_bsize)
bp->b_flags |= B_CLUSTEROK;
if (flags & IO_SYNC)
@ -312,7 +312,7 @@ ffs_truncate(vp, length, flags, cred, td)
offset = blkoff(fs, length);
if (offset == 0) {
oip->i_size = length;
DIP(oip, i_size) = length;
DIP_SET(oip, i_size, length);
} else {
lbn = lblkno(fs, length);
flags |= BA_CLRBUF;
@ -333,7 +333,7 @@ ffs_truncate(vp, length, flags, cred, td)
(error = VOP_FSYNC(ovp, cred, MNT_WAIT, td)) != 0)
return (error);
oip->i_size = length;
DIP(oip, i_size) = length;
DIP_SET(oip, i_size, length);
size = blksize(fs, oip, lbn);
if (ovp->v_type != VDIR)
bzero((char *)bp->b_data + offset,
@ -367,14 +367,14 @@ ffs_truncate(vp, length, flags, cred, td)
for (level = TRIPLE; level >= SINGLE; level--) {
oldblks[NDADDR + level] = DIP(oip, i_ib[level]);
if (lastiblock[level] < 0) {
DIP(oip, i_ib[level]) = 0;
DIP_SET(oip, i_ib[level], 0);
lastiblock[level] = -1;
}
}
for (i = 0; i < NDADDR; i++) {
oldblks[i] = DIP(oip, i_db[i]);
if (i > lastblock)
DIP(oip, i_db[i]) = 0;
DIP_SET(oip, i_db[i], 0);
}
oip->i_flag |= IN_CHANGE | IN_UPDATE;
allerror = UFS_UPDATE(ovp, 1);
@ -387,14 +387,14 @@ ffs_truncate(vp, length, flags, cred, td)
*/
for (i = 0; i < NDADDR; i++) {
newblks[i] = DIP(oip, i_db[i]);
DIP(oip, i_db[i]) = oldblks[i];
DIP_SET(oip, i_db[i], oldblks[i]);
}
for (i = 0; i < NIADDR; i++) {
newblks[NDADDR + i] = DIP(oip, i_ib[i]);
DIP(oip, i_ib[i]) = oldblks[NDADDR + i];
DIP_SET(oip, i_ib[i], oldblks[NDADDR + i]);
}
oip->i_size = osize;
DIP(oip, i_size) = osize;
DIP_SET(oip, i_size, osize);
error = vtruncbuf(ovp, cred, td, length, fs->fs_bsize);
if (error && (allerror == 0))
@ -415,7 +415,7 @@ ffs_truncate(vp, length, flags, cred, td)
allerror = error;
blocksreleased += count;
if (lastiblock[level] < 0) {
DIP(oip, i_ib[level]) = 0;
DIP_SET(oip, i_ib[level], 0);
ffs_blkfree(fs, oip->i_devvp, bn, fs->fs_bsize,
oip->i_number);
blocksreleased += nblocks;
@ -434,7 +434,7 @@ ffs_truncate(vp, length, flags, cred, td)
bn = DIP(oip, i_db[i]);
if (bn == 0)
continue;
DIP(oip, i_db[i]) = 0;
DIP_SET(oip, i_db[i], 0);
bsize = blksize(fs, oip, i);
ffs_blkfree(fs, oip->i_devvp, bn, bsize, oip->i_number);
blocksreleased += btodb(bsize);
@ -456,7 +456,7 @@ ffs_truncate(vp, length, flags, cred, td)
*/
oldspace = blksize(fs, oip, lastblock);
oip->i_size = length;
DIP(oip, i_size) = length;
DIP_SET(oip, i_size, length);
newspace = blksize(fs, oip, lastblock);
if (newspace == 0)
panic("ffs_truncate: newspace");
@ -492,11 +492,11 @@ ffs_truncate(vp, length, flags, cred, td)
* Put back the real size.
*/
oip->i_size = length;
DIP(oip, i_size) = length;
DIP(oip, i_blocks) -= blocksreleased;
DIP_SET(oip, i_size, length);
DIP_SET(oip, i_blocks, DIP(oip, i_blocks) - blocksreleased);
if (DIP(oip, i_blocks) < 0) /* sanity */
DIP(oip, i_blocks) = 0;
DIP_SET(oip, i_blocks, 0);
oip->i_flag |= IN_CHANGE;
#ifdef QUOTA
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
@ -579,7 +579,10 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
MALLOC(copy, caddr_t, fs->fs_bsize, M_TEMP, M_WAITOK);
bcopy((caddr_t)bp->b_data, copy, (u_int)fs->fs_bsize);
for (i = last + 1; i < NINDIR(fs); i++)
BAP(ip, i) = 0;
if (ip->i_ump->um_fstype == UFS1)
bap1[i] = 0;
else
bap2[i] = 0;
if (DOINGASYNC(vp)) {
bawrite(bp);
} else {

View File

@ -211,7 +211,7 @@ ffs_snapshot(mp, snapfile)
if (error)
goto out;
ip->i_size = lblktosize(fs, (off_t)numblks);
DIP(ip, i_size) = ip->i_size;
DIP_SET(ip, i_size, ip->i_size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if ((error = readblock(bp, numblks - 1)) != 0)
goto out;
@ -286,7 +286,7 @@ ffs_snapshot(mp, snapfile)
* Change inode to snapshot type file.
*/
ip->i_flags |= SF_SNAPSHOT;
DIP(ip, i_flags) = ip->i_flags;
DIP_SET(ip, i_flags, ip->i_flags);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
/*
* Ensure that the snapshot is completely on disk.
@ -455,7 +455,7 @@ ffs_snapshot(mp, snapfile)
ffs_blkfree(copy_fs, vp, DIP(xp, i_db[loc]),
len, xp->i_number);
blkno = DIP(xp, i_db[loc]);
DIP(xp, i_db[loc]) = 0;
DIP_SET(xp, i_db[loc], 0);
}
}
snaplistsize += 1;
@ -466,7 +466,7 @@ ffs_snapshot(mp, snapfile)
error = expunge_ufs2(vp, xp, copy_fs, fullacct_ufs2,
BLK_NOCOPY);
if (blkno)
DIP(xp, i_db[loc]) = blkno;
DIP_SET(xp, i_db[loc], blkno);
if (!error)
error = ffs_freefile(copy_fs, vp, xp->i_number,
xp->i_mode);
@ -738,9 +738,9 @@ cgaccount(cg, vp, nbp, passno)
if (base < NDADDR) {
for ( ; loc < NDADDR; loc++) {
if (ffs_isblock(fs, cg_blksfree(cgp), loc))
DIP(ip, i_db[loc]) = BLK_NOCOPY;
DIP_SET(ip, i_db[loc], BLK_NOCOPY);
else if (passno == 2 && DIP(ip, i_db[loc])== BLK_NOCOPY)
DIP(ip, i_db[loc]) = 0;
DIP_SET(ip, i_db[loc], 0);
else if (passno == 1 && DIP(ip, i_db[loc])== BLK_NOCOPY)
panic("ffs_snapshot: lost direct block");
}
@ -1452,12 +1452,13 @@ ffs_snapremove(vp)
for (blkno = 1; blkno < NDADDR; blkno++) {
dblk = DIP(ip, i_db[blkno]);
if (dblk == BLK_NOCOPY || dblk == BLK_SNAP)
DIP(ip, i_db[blkno]) = 0;
DIP_SET(ip, i_db[blkno], 0);
else if ((dblk == blkstofrags(fs, blkno) &&
ffs_snapblkfree(fs, ip->i_devvp, dblk, fs->fs_bsize,
ip->i_number))) {
DIP(ip, i_blocks) -= btodb(fs->fs_bsize);
DIP(ip, i_db[blkno]) = 0;
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) -
btodb(fs->fs_bsize));
DIP_SET(ip, i_db[blkno], 0);
}
}
numblks = howmany(ip->i_size, fs->fs_bsize);
@ -1500,7 +1501,7 @@ ffs_snapremove(vp)
* Clear snapshot flag and drop reference.
*/
ip->i_flags &= ~SF_SNAPSHOT;
DIP(ip, i_flags) = ip->i_flags;
DIP_SET(ip, i_flags, ip->i_flags);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
}
@ -1597,7 +1598,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
}
snapshot_locked = 1;
if (lbn < NDADDR) {
DIP(ip, i_db[lbn]) = BLK_NOCOPY;
DIP_SET(ip, i_db[lbn], BLK_NOCOPY);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else if (ip->i_ump->um_fstype == UFS1) {
((ufs1_daddr_t *)(ibp->b_data))[indiroff] =
@ -1644,7 +1645,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
(intmax_t)lbn, inum);
#endif
if (lbn < NDADDR) {
DIP(ip, i_db[lbn]) = bno;
DIP_SET(ip, i_db[lbn], bno);
} else if (ip->i_ump->um_fstype == UFS1) {
((ufs1_daddr_t *)(ibp->b_data))[indiroff] = bno;
bdwrite(ibp);
@ -1652,7 +1653,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum)
((ufs2_daddr_t *)(ibp->b_data))[indiroff] = bno;
bdwrite(ibp);
}
DIP(ip, i_blocks) += btodb(size);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + btodb(size));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
VOP_UNLOCK(vp, 0, td);
return (1);

View File

@ -1968,15 +1968,15 @@ softdep_setup_freeblocks(ip, length, flags)
} else {
freeblks->fb_oldsize = ip->i_size;
ip->i_size = 0;
DIP(ip, i_size) = 0;
DIP_SET(ip, i_size, 0);
freeblks->fb_chkcnt = datablocks;
for (i = 0; i < NDADDR; i++) {
freeblks->fb_dblks[i] = DIP(ip, i_db[i]);
DIP(ip, i_db[i]) = 0;
DIP_SET(ip, i_db[i], 0);
}
for (i = 0; i < NIADDR; i++) {
freeblks->fb_iblks[i] = DIP(ip, i_ib[i]);
DIP(ip, i_ib[i]) = 0;
DIP_SET(ip, i_ib[i], 0);
}
/*
* If the file was removed, then the space being freed was
@ -1997,7 +1997,7 @@ softdep_setup_freeblocks(ip, length, flags)
ip->i_din2->di_extb[i] = 0;
}
}
DIP(ip, i_blocks) -= freeblks->fb_chkcnt;
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - freeblks->fb_chkcnt);
/*
* Push the zero'ed inode to to its disk buffer so that we are free
* to delete its dependencies below. Once the dependencies are gone
@ -2510,7 +2510,8 @@ handle_workitem_freeblocks(freeblks, flags)
VFS_VGET(freeblks->fb_mnt, freeblks->fb_previousinum,
(flags & LK_NOWAIT) | LK_EXCLUSIVE, &vp) == 0) {
ip = VTOI(vp);
DIP(ip, i_blocks) += freeblks->fb_chkcnt - blocksreleased;
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + \
freeblks->fb_chkcnt - blocksreleased);
ip->i_flag |= IN_CHANGE;
vput(vp);
}
@ -3315,7 +3316,7 @@ handle_workitem_remove(dirrem, xp)
*/
if ((dirrem->dm_state & RMDIR) == 0) {
ip->i_nlink--;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (ip->i_nlink < ip->i_effnlink) {
FREE_LOCK(&lk);
@ -3336,7 +3337,7 @@ handle_workitem_remove(dirrem, xp)
* the parent decremented to account for the loss of "..".
*/
ip->i_nlink -= 2;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (ip->i_nlink < ip->i_effnlink) {
FREE_LOCK(&lk);

View File

@ -1331,7 +1331,7 @@ ffs_vget(mp, ino, flags, vpp)
ip->i_gen = arc4random() / 2 + 1;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
ip->i_flag |= IN_MODIFIED;
DIP(ip, i_gen) = ip->i_gen;
DIP_SET(ip, i_gen, ip->i_gen);
}
}
/*

View File

@ -667,7 +667,7 @@ ffs_write(ap)
if (uio->uio_offset + xfersize > ip->i_size) {
ip->i_size = uio->uio_offset + xfersize;
DIP(ip, i_size) = ip->i_size;
DIP_SET(ip, i_size, ip->i_size);
extended = 1;
}
@ -722,7 +722,7 @@ ffs_write(ap)
if (resid > uio->uio_resid && ap->a_cred &&
suser_cred(ap->a_cred, SUSER_ALLOWJAIL)) {
ip->i_mode &= ~(ISUID | ISGID);
DIP(ip, i_mode) = ip->i_mode;
DIP_SET(ip, i_mode, ip->i_mode);
}
if (resid > uio->uio_resid)
VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));

View File

@ -136,6 +136,12 @@ struct inode {
#define DIP(ip, field) \
(((ip)->i_ump->um_fstype == UFS1) ? \
(ip)->i_din1->d##field : (ip)->i_din2->d##field)
#define DIP_SET(ip, field, val) do { \
if ((ip)->i_ump->um_fstype == UFS1) \
(ip)->i_din1->d##field = (val); \
else \
(ip)->i_din2->d##field = (val); \
} while (0)
#define MAXSYMLINKLEN(ip) \
((ip)->i_ump->um_fstype == UFS1) ? \

View File

@ -136,7 +136,7 @@ ufs_sync_inode_from_acl(struct acl *acl, struct inode *ip)
ip->i_mode &= ACL_PRESERVE_MASK;
ip->i_mode |= acl_posix1e_acl_to_mode(acl);
DIP(ip, i_mode) = ip->i_mode;
DIP_SET(ip, i_mode, ip->i_mode);
}
/*

View File

@ -103,10 +103,10 @@ ufs_inactive(ap)
* So, rather than creating a new entry point to do the
* same thing, we just use softdep_change_linkcnt().
*/
DIP(ip, i_rdev) = 0;
DIP_SET(ip, i_rdev, 0);
mode = ip->i_mode;
ip->i_mode = 0;
DIP(ip, i_mode) = 0;
DIP_SET(ip, i_mode, 0);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (DOINGSOFTDEP(vp))
softdep_change_linkcnt(ip);

View File

@ -465,7 +465,7 @@ ufs_lookup(ap)
if (dp->i_offset + DIRSIZ(OFSFMT(vdp), ep) > dp->i_size) {
ufs_dirbad(dp, dp->i_offset, "i_size too small");
dp->i_size = dp->i_offset + DIRSIZ(OFSFMT(vdp), ep);
DIP(dp, i_size) = dp->i_size;
DIP_SET(dp, i_size, dp->i_size);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
}
brelse(bp);
@ -758,7 +758,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
return (error);
}
dp->i_size = dp->i_offset + DIRBLKSIZ;
DIP(dp, i_size) = dp->i_size;
DIP_SET(dp, i_size, dp->i_size);
dp->i_flag |= IN_CHANGE | IN_UPDATE;
vnode_pager_setsize(dvp, (u_long)dp->i_size);
dirp->d_reclen = DIRBLKSIZ;
@ -839,7 +839,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
*/
if (dp->i_offset + dp->i_count > dp->i_size) {
dp->i_size = dp->i_offset + dp->i_count;
DIP(dp, i_size) = dp->i_size;
DIP_SET(dp, i_size, dp->i_size);
}
/*
* Get the block containing the space for the new directory entry.
@ -1051,7 +1051,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir)
if (ip) {
ip->i_effnlink--;
ip->i_nlink--;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
}
if (flags & DOWHITEOUT)
@ -1105,7 +1105,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir)
bdwrite(bp);
} else {
oip->i_nlink--;
DIP(oip, i_nlink) = oip->i_nlink;
DIP_SET(oip, i_nlink, oip->i_nlink);
oip->i_flag |= IN_CHANGE;
if (DOINGASYNC(vdp)) {
bdwrite(bp);

View File

@ -163,17 +163,17 @@ ufs_itimes(vp)
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
vfs_timestamp(&ts);
if (ip->i_flag & IN_ACCESS) {
DIP(ip, i_atime) = ts.tv_sec;
DIP(ip, i_atimensec) = ts.tv_nsec;
DIP_SET(ip, i_atime, ts.tv_sec);
DIP_SET(ip, i_atimensec, ts.tv_nsec);
}
if (ip->i_flag & IN_UPDATE) {
DIP(ip, i_mtime) = ts.tv_sec;
DIP(ip, i_mtimensec) = ts.tv_nsec;
DIP_SET(ip, i_mtime, ts.tv_sec);
DIP_SET(ip, i_mtimensec, ts.tv_nsec);
ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE) {
DIP(ip, i_ctime) = ts.tv_sec;
DIP(ip, i_ctimensec) = ts.tv_nsec;
DIP_SET(ip, i_ctime, ts.tv_sec);
DIP_SET(ip, i_ctimensec, ts.tv_nsec);
}
}
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE);
@ -233,7 +233,7 @@ ufs_mknod(ap)
* Want to be able to use this to make badblock
* inodes, so don't truncate the dev number.
*/
DIP(ip, i_rdev) = vap->va_rdev;
DIP_SET(ip, i_rdev, vap->va_rdev);
}
/*
* Remove inode, then reload it through VFS_VGET so it is
@ -513,7 +513,7 @@ ufs_setattr(ap)
(ip->i_flags & SF_SNAPSHOT) != 0))
return (EPERM);
ip->i_flags = vap->va_flags;
DIP(ip, i_flags) = vap->va_flags;
DIP_SET(ip, i_flags, vap->va_flags);
} else {
if (ip->i_flags
& (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
@ -521,7 +521,7 @@ ufs_setattr(ap)
return (EPERM);
ip->i_flags &= SF_SETTABLE;
ip->i_flags |= (vap->va_flags & UF_SETTABLE);
DIP(ip, i_flags) = ip->i_flags;
DIP_SET(ip, i_flags, ip->i_flags);
}
ip->i_flag |= IN_CHANGE;
if (vap->va_flags & (IMMUTABLE | APPEND))
@ -590,12 +590,12 @@ ufs_setattr(ap)
ip->i_flag |= IN_MODIFIED;
ufs_itimes(vp);
if (vap->va_atime.tv_sec != VNOVAL) {
DIP(ip, i_atime) = vap->va_atime.tv_sec;
DIP(ip, i_atimensec) = vap->va_atime.tv_nsec;
DIP_SET(ip, i_atime, vap->va_atime.tv_sec);
DIP_SET(ip, i_atimensec, vap->va_atime.tv_nsec);
}
if (vap->va_mtime.tv_sec != VNOVAL) {
DIP(ip, i_mtime) = vap->va_mtime.tv_sec;
DIP(ip, i_mtimensec) = vap->va_mtime.tv_nsec;
DIP_SET(ip, i_mtime, vap->va_mtime.tv_sec);
DIP_SET(ip, i_mtimensec, vap->va_mtime.tv_nsec);
}
if (vap->va_birthtime.tv_sec != VNOVAL &&
ip->i_ump->um_fstype == UFS2) {
@ -656,7 +656,7 @@ ufs_chmod(vp, mode, cred, td)
}
ip->i_mode &= ~ALLPERMS;
ip->i_mode |= (mode & ALLPERMS);
DIP(ip, i_mode) = ip->i_mode;
DIP_SET(ip, i_mode, ip->i_mode);
ip->i_flag |= IN_CHANGE;
return (0);
}
@ -723,9 +723,9 @@ ufs_chown(vp, uid, gid, cred, td)
}
#endif
ip->i_gid = gid;
DIP(ip, i_gid) = gid;
DIP_SET(ip, i_gid, gid);
ip->i_uid = uid;
DIP(ip, i_uid) = uid;
DIP_SET(ip, i_uid, uid);
#ifdef QUOTA
if ((error = getinoquota(ip)) == 0) {
if (ouid == uid) {
@ -748,9 +748,9 @@ ufs_chown(vp, uid, gid, cred, td)
}
}
ip->i_gid = ogid;
DIP(ip, i_gid) = ogid;
DIP_SET(ip, i_gid, ogid);
ip->i_uid = ouid;
DIP(ip, i_uid) = ouid;
DIP_SET(ip, i_uid, ouid);
if (getinoquota(ip) == 0) {
if (ouid == uid) {
dqrele(vp, ip->i_dquot[USRQUOTA]);
@ -772,7 +772,7 @@ ufs_chown(vp, uid, gid, cred, td)
ip->i_flag |= IN_CHANGE;
if (suser_cred(cred, SUSER_ALLOWJAIL) && (ouid != uid || ogid != gid)) {
ip->i_mode &= ~(ISUID | ISGID);
DIP(ip, i_mode) = ip->i_mode;
DIP_SET(ip, i_mode, ip->i_mode);
}
return (0);
}
@ -842,7 +842,7 @@ ufs_link(ap)
}
ip->i_effnlink++;
ip->i_nlink++;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(vp))
softdep_change_linkcnt(ip);
@ -855,7 +855,7 @@ ufs_link(ap)
if (error) {
ip->i_effnlink--;
ip->i_nlink--;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(vp))
softdep_change_linkcnt(ip);
@ -1057,7 +1057,7 @@ ufs_rename(ap)
*/
ip->i_effnlink++;
ip->i_nlink++;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(fvp))
softdep_change_linkcnt(ip);
@ -1123,7 +1123,7 @@ ufs_rename(ap)
}
dp->i_effnlink++;
dp->i_nlink++;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tdvp))
softdep_change_linkcnt(dp);
@ -1138,7 +1138,7 @@ ufs_rename(ap)
if (doingdirectory && newparent) {
dp->i_effnlink--;
dp->i_nlink--;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tdvp))
softdep_change_linkcnt(dp);
@ -1217,11 +1217,11 @@ ufs_rename(ap)
*/
if (!newparent) {
dp->i_nlink--;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
}
xp->i_nlink--;
DIP(xp, i_nlink) = xp->i_nlink;
DIP_SET(xp, i_nlink, xp->i_nlink);
xp->i_flag |= IN_CHANGE;
ioflag = IO_NORMAL;
if (DOINGASYNC(tvp))
@ -1320,7 +1320,7 @@ ufs_rename(ap)
if (vn_lock(fvp, LK_EXCLUSIVE, td) == 0) {
ip->i_effnlink--;
ip->i_nlink--;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
ip->i_flag &= ~IN_RENAME;
if (DOINGSOFTDEP(fvp))
@ -1378,7 +1378,7 @@ ufs_mkdir(ap)
goto out;
ip = VTOI(tvp);
ip->i_gid = dp->i_gid;
DIP(ip, i_gid) = dp->i_gid;
DIP_SET(ip, i_gid, dp->i_gid);
#ifdef SUIDDIR
{
#ifdef QUOTA
@ -1397,7 +1397,7 @@ ufs_mkdir(ap)
(dp->i_mode & ISUID) && dp->i_uid) {
dmode |= ISUID;
ip->i_uid = dp->i_uid;
DIP(ip, i_uid) = dp->i_uid;
DIP_SET(ip, i_uid, dp->i_uid);
#ifdef QUOTA
if (dp->i_uid != cnp->cn_cred->cr_uid) {
/*
@ -1416,7 +1416,7 @@ ufs_mkdir(ap)
#endif
} else {
ip->i_uid = cnp->cn_cred->cr_uid;
DIP(ip, i_uid) = ip->i_uid;
DIP_SET(ip, i_uid, ip->i_uid);
}
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
@ -1429,7 +1429,7 @@ ufs_mkdir(ap)
}
#else /* !SUIDDIR */
ip->i_uid = cnp->cn_cred->cr_uid;
DIP(ip, i_uid) = ip->i_uid;
DIP_SET(ip, i_uid, ip->i_uid);
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
@ -1461,7 +1461,7 @@ ufs_mkdir(ap)
if (acl->acl_cnt != 0) {
dmode = acl_posix1e_newfilemode(dmode, acl);
ip->i_mode = dmode;
DIP(ip, i_mode) = dmode;
DIP_SET(ip, i_mode, dmode);
*dacl = *acl;
ufs_sync_acl_from_inode(ip, acl);
break;
@ -1473,7 +1473,7 @@ ufs_mkdir(ap)
* Just use the mode as-is.
*/
ip->i_mode = dmode;
DIP(ip, i_mode) = dmode;
DIP_SET(ip, i_mode, dmode);
FREE(acl, M_ACL);
FREE(dacl, M_ACL);
dacl = acl = NULL;
@ -1489,19 +1489,19 @@ ufs_mkdir(ap)
} else {
#endif /* !UFS_ACL */
ip->i_mode = dmode;
DIP(ip, i_mode) = dmode;
DIP_SET(ip, i_mode, dmode);
#ifdef UFS_ACL
}
#endif
tvp->v_type = VDIR; /* Rest init'd in getnewvnode(). */
ip->i_effnlink = 2;
ip->i_nlink = 2;
DIP(ip, i_nlink) = 2;
DIP_SET(ip, i_nlink, 2);
if (DOINGSOFTDEP(tvp))
softdep_change_linkcnt(ip);
if (cnp->cn_flags & ISWHITEOUT) {
ip->i_flags |= UF_OPAQUE;
DIP(ip, i_flags) = ip->i_flags;
DIP_SET(ip, i_flags, ip->i_flags);
}
/*
@ -1511,7 +1511,7 @@ ufs_mkdir(ap)
*/
dp->i_effnlink++;
dp->i_nlink++;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(dvp))
softdep_change_linkcnt(dp);
@ -1577,7 +1577,7 @@ ufs_mkdir(ap)
BA_CLRBUF, &bp)) != 0)
goto bad;
ip->i_size = DIRBLKSIZ;
DIP(ip, i_size) = DIRBLKSIZ;
DIP_SET(ip, i_size, DIRBLKSIZ);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
vnode_pager_setsize(tvp, (u_long)ip->i_size);
bcopy((caddr_t)&dirtemplate, (caddr_t)bp->b_data, sizeof dirtemplate);
@ -1625,7 +1625,7 @@ ufs_mkdir(ap)
} else {
dp->i_effnlink--;
dp->i_nlink--;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(dvp))
softdep_change_linkcnt(dp);
@ -1635,7 +1635,7 @@ ufs_mkdir(ap)
*/
ip->i_effnlink = 0;
ip->i_nlink = 0;
DIP(ip, i_nlink) = 0;
DIP_SET(ip, i_nlink, 0);
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tvp))
softdep_change_linkcnt(ip);
@ -1724,10 +1724,10 @@ ufs_rmdir(ap)
*/
if (!DOINGSOFTDEP(vp)) {
dp->i_nlink--;
DIP(dp, i_nlink) = dp->i_nlink;
DIP_SET(dp, i_nlink, dp->i_nlink);
dp->i_flag |= IN_CHANGE;
ip->i_nlink--;
DIP(ip, i_nlink) = ip->i_nlink;
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
ioflag = IO_NORMAL;
if (DOINGASYNC(vp))
@ -1774,7 +1774,7 @@ ufs_symlink(ap)
ip = VTOI(vp);
bcopy(ap->a_target, SHORTLINK(ip), len);
ip->i_size = len;
DIP(ip, i_size) = len;
DIP_SET(ip, i_size, len);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
@ -2385,7 +2385,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
return (error);
ip = VTOI(tvp);
ip->i_gid = pdir->i_gid;
DIP(ip, i_gid) = pdir->i_gid;
DIP_SET(ip, i_gid, pdir->i_gid);
#ifdef SUIDDIR
{
#ifdef QUOTA
@ -2403,7 +2403,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
(pdir->i_mode & ISUID) &&
(pdir->i_uid != cnp->cn_cred->cr_uid) && pdir->i_uid) {
ip->i_uid = pdir->i_uid;
DIP(ip, i_uid) = ip->i_uid;
DIP_SET(ip, i_uid, ip->i_uid);
mode &= ~07111;
#ifdef QUOTA
/*
@ -2421,7 +2421,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
#endif
} else {
ip->i_uid = cnp->cn_cred->cr_uid;
DIP(ip, i_uid) = ip->i_uid;
DIP_SET(ip, i_uid, ip->i_uid);
}
#ifdef QUOTA
@ -2435,7 +2435,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
}
#else /* !SUIDDIR */
ip->i_uid = cnp->cn_cred->cr_uid;
DIP(ip, i_uid) = ip->i_uid;
DIP_SET(ip, i_uid, ip->i_uid);
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
@ -2472,7 +2472,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
*/
mode = acl_posix1e_newfilemode(mode, acl);
ip->i_mode = mode;
DIP(ip, i_mode) = mode;
DIP_SET(ip, i_mode, mode);
ufs_sync_acl_from_inode(ip, acl);
break;
}
@ -2483,7 +2483,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
* Just use the mode as-is.
*/
ip->i_mode = mode;
DIP(ip, i_mode) = mode;
DIP_SET(ip, i_mode, mode);
FREE(acl, M_ACL);
acl = NULL;
break;
@ -2498,25 +2498,25 @@ ufs_makeinode(mode, dvp, vpp, cnp)
} else {
#endif
ip->i_mode = mode;
DIP(ip, i_mode) = mode;
DIP_SET(ip, i_mode, mode);
#ifdef UFS_ACL
}
#endif
tvp->v_type = IFTOVT(mode); /* Rest init'd in getnewvnode(). */
ip->i_effnlink = 1;
ip->i_nlink = 1;
DIP(ip, i_nlink) = 1;
DIP_SET(ip, i_nlink, 1);
if (DOINGSOFTDEP(tvp))
softdep_change_linkcnt(ip);
if ((ip->i_mode & ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) &&
suser_cred(cnp->cn_cred, SUSER_ALLOWJAIL)) {
ip->i_mode &= ~ISGID;
DIP(ip, i_mode) = ip->i_mode;
DIP_SET(ip, i_mode, ip->i_mode);
}
if (cnp->cn_flags & ISWHITEOUT) {
ip->i_flags |= UF_OPAQUE;
DIP(ip, i_flags) = ip->i_flags;
DIP_SET(ip, i_flags, ip->i_flags);
}
/*
@ -2577,7 +2577,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
*/
ip->i_effnlink = 0;
ip->i_nlink = 0;
DIP(ip, i_nlink) = 0;
DIP_SET(ip, i_nlink, 0);
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(tvp))
softdep_change_linkcnt(ip);