From 07936511f02e28650320f94e40230f097d344163 Mon Sep 17 00:00:00 2001 From: kristerw Date: Thu, 15 May 2003 20:25:31 +0000 Subject: [PATCH] The C language does not permit statements of the form (X ? Y : Z) = 0; even though gcc handles this by a stupid extension. Transform these to correct C. Approved by fvdl. --- sys/ufs/ffs/ffs_alloc.c | 16 ++++---- sys/ufs/ffs/ffs_inode.c | 38 +++++++++++-------- sys/ufs/ffs/ffs_softdep.c | 12 +++--- sys/ufs/ufs/inode.h | 30 +++++++++++---- sys/ufs/ufs/ufs_inode.c | 8 ++-- sys/ufs/ufs/ufs_lookup.c | 14 +++---- sys/ufs/ufs/ufs_readwrite.c | 8 ++-- sys/ufs/ufs/ufs_vnops.c | 76 ++++++++++++++++++------------------- 8 files changed, 112 insertions(+), 90 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 1f2aff9f0e52..14a0d9771682 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.64 2003/05/04 01:52:18 gmcgarry Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.65 2003/05/15 20:25:31 kristerw Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.64 2003/05/04 01:52:18 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.65 2003/05/15 20:25:31 kristerw Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -179,7 +179,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) bno = ffs_hashalloc(ip, cg, (long)bpref, size, ffs_alloccg); if (bno > 0) { - DIP(ip, blocks) += btodb(size); + DIP_ADD(ip, blocks, btodb(size)); ip->i_flag |= IN_CHANGE | IN_UPDATE; *bnp = bno; return (0); @@ -283,7 +283,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp, blknop) */ cg = dtog(fs, bprev); if ((bno = ffs_fragextend(ip, cg, bprev, osize, nsize)) != 0) { - DIP(ip, blocks) += btodb(nsize - osize); + DIP_ADD(ip, blocks, btodb(nsize - osize)); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (bpp != NULL) { @@ -364,7 +364,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp, blknop) if (nsize < request) ffs_blkfree(ip, bno + numfrags(fs, nsize), (long)(request - nsize)); - DIP(ip, blocks) += btodb(nsize - osize); + DIP_ADD(ip, blocks, btodb(nsize - osize)); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (bpp != NULL) { bp->b_blkno = fsbtodb(fs, bno); @@ -727,16 +727,16 @@ ffs_valloc(v) if (DIP(ip, blocks)) { /* XXX */ printf("free inode %s/%d had %" PRId64 " blocks\n", fs->fs_fsmnt, ino, DIP(ip, blocks)); - DIP(ip, blocks) = 0; + DIP_ASSIGN(ip, blocks, 0); } ip->i_flag &= ~IN_SPACECOUNTED; ip->i_flags = 0; - DIP(ip, flags) = 0; + DIP_ASSIGN(ip, flags, 0); /* * Set up a new generation number for this inode. */ ip->i_gen++; - DIP(ip, gen) = ip->i_gen; + DIP_ASSIGN(ip, gen, ip->i_gen); if (fs->fs_magic == FS_UFS2_MAGIC) { TIMEVAL_TO_TIMESPEC(&time, &ts); ip->i_ffs2_birthtime = ts.tv_sec; diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 9b8a74536cbd..84d22f5ae7ea 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_inode.c,v 1.56 2003/04/10 20:02:36 fvdl Exp $ */ +/* $NetBSD: ffs_inode.c,v 1.57 2003/05/15 20:25:32 kristerw Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.56 2003/04/10 20:02:36 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.57 2003/05/15 20:25:32 kristerw Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -208,7 +208,7 @@ ffs_truncate(v) KDASSERT(length == 0); memset(SHORTLINK(oip), 0, (size_t)oip->i_size); oip->i_size = 0; - DIP(oip, size) = 0; + DIP_ASSIGN(oip, size, 0); oip->i_flag |= IN_CHANGE | IN_UPDATE; return (VOP_UPDATE(ovp, NULL, NULL, UPDATE_WAIT)); } @@ -330,7 +330,7 @@ ffs_truncate(v) } } oip->i_size = length; - DIP(oip, size) = length; + DIP_ASSIGN(oip, size, length); uvm_vnp_setsize(ovp, length); /* * Calculate index into inode's block list of @@ -352,14 +352,14 @@ ffs_truncate(v) for (level = TRIPLE; level >= SINGLE; level--) { oldblks[NDADDR + level] = DIP(oip, ib[level]); if (lastiblock[level] < 0) { - DIP(oip, ib[level]) = 0; + DIP_ASSIGN(oip, ib[level], 0); lastiblock[level] = -1; } } for (i = 0; i < NDADDR; i++) { oldblks[i] = DIP(oip, db[i]); if (i > lastblock) - DIP(oip, db[i]) = 0; + DIP_ASSIGN(oip, db[i], 0); } oip->i_flag |= IN_CHANGE | IN_UPDATE; error = VOP_UPDATE(ovp, NULL, NULL, UPDATE_WAIT); @@ -374,15 +374,15 @@ ffs_truncate(v) */ for (i = 0; i < NDADDR; i++) { newblks[i] = DIP(oip, db[i]); - DIP(oip, db[i]) = oldblks[i]; + DIP_ASSIGN(oip, db[i], oldblks[i]); } for (i = 0; i < NIADDR; i++) { newblks[NDADDR + i] = DIP(oip, ib[i]); - DIP(oip, ib[i]) = oldblks[NDADDR + i]; + DIP_ASSIGN(oip, ib[i], oldblks[NDADDR + i]); } oip->i_size = osize; - DIP(oip, size) = osize; + DIP_ASSIGN(oip, size, osize); error = vtruncbuf(ovp, lastblock + 1, 0, 0); if (error && !allerror) allerror = error; @@ -405,7 +405,7 @@ ffs_truncate(v) allerror = error; blocksreleased += count; if (lastiblock[level] < 0) { - DIP(oip, ib[level]) = 0; + DIP_ASSIGN(oip, ib[level], 0); ffs_blkfree(oip, bn, fs->fs_bsize); blocksreleased += nblocks; } @@ -426,7 +426,7 @@ ffs_truncate(v) bn = ufs_rw64(oip->i_ffs2_db[i], UFS_FSNEEDSWAP(fs)); if (bn == 0) continue; - DIP(oip, db[i]) = 0; + DIP_ASSIGN(oip, db[i], 0); bsize = blksize(fs, oip, i); ffs_blkfree(oip, bn, bsize); blocksreleased += btodb(bsize); @@ -451,7 +451,7 @@ ffs_truncate(v) */ oldspace = blksize(fs, oip, lastblock); oip->i_size = length; - DIP(oip, size) = length; + DIP_ASSIGN(oip, size, length); newspace = blksize(fs, oip, lastblock); if (newspace == 0) panic("itrunc: newspace"); @@ -483,8 +483,8 @@ done: * Put back the real size. */ oip->i_size = length; - DIP(oip, size) = length; - DIP(oip, blocks) -= blocksreleased; + DIP_ASSIGN(oip, size, length); + DIP_ADD(oip, blocks, -blocksreleased); lockmgr(&gp->g_glock, LK_RELEASE, NULL); oip->i_flag |= IN_CHANGE; #ifdef QUOTA @@ -527,7 +527,13 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) #endif #define RBAP(ip, i) (((ip)->i_ump->um_fstype == UFS1) ? \ ufs_rw32(bap1[i], needswap) : ufs_rw64(bap2[i], needswap)) -#define BAP(ip, i) (((ip)->i_ump->um_fstype == UFS1) ? bap1[i] : bap2[i]) +#define BAP_ASSIGN(ip, i, value) \ + do { \ + if ((ip)->i_ump->um_fstype == UFS1) \ + bap1[i] = (value); \ + else \ + bap2[i] = (value); \ + } while(0) /* * Calculate index in current block of last @@ -578,7 +584,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) copy = malloc(fs->fs_bsize, M_TEMP, M_WAITOK); memcpy((caddr_t)copy, bp->b_data, (u_int)fs->fs_bsize); for (i = last + 1; i < NINDIR(fs); i++) - BAP(ip, i) = 0; + BAP_ASSIGN(ip, i, 0); error = bwrite(bp); if (error) allerror = error; diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8e051e26af1b..c33f445ac658 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_softdep.c,v 1.46 2003/04/03 19:28:07 fvdl Exp $ */ +/* $NetBSD: ffs_softdep.c,v 1.47 2003/05/15 20:25:32 kristerw Exp $ */ /* * Copyright 1998 Marshall Kirk McKusick. All Rights Reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.46 2003/04/03 19:28:07 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.47 2003/05/15 20:25:32 kristerw Exp $"); #include #include @@ -1908,9 +1908,9 @@ softdep_setup_freeblocks(ip, length, flags) ip->i_ffs2_ib[i] = 0; } } - DIP(ip, blocks) = 0; + DIP_ASSIGN(ip, blocks, 0); ip->i_size = 0; - DIP(ip, size) = 0; + DIP_ASSIGN(ip, size, 0); /* * If the file was removed, then the space being freed was * accounted for then (see softdep_filereleased()). If the @@ -3174,7 +3174,7 @@ handle_workitem_remove(dirrem) */ if ((dirrem->dm_state & RMDIR) == 0) { ip->i_nlink--; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (ip->i_nlink < ip->i_ffs_effnlink) panic("handle_workitem_remove: bad file delta"); @@ -3193,7 +3193,7 @@ handle_workitem_remove(dirrem) * the parent decremented to account for the loss of "..". */ ip->i_nlink -= 2; - DIP(ip, nlink) -= 2; + DIP_ADD(ip, nlink, -2); ip->i_flag |= IN_CHANGE; if (ip->i_nlink < ip->i_ffs_effnlink) panic("handle_workitem_remove: bad dir delta"); diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 03d00121b940..c758a284cf54 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -1,4 +1,4 @@ -/* $NetBSD: inode.h,v 1.34 2003/04/02 10:39:43 fvdl Exp $ */ +/* $NetBSD: inode.h,v 1.35 2003/05/15 20:25:33 kristerw Exp $ */ /* * Copyright (c) 1982, 1989, 1993 @@ -225,6 +225,22 @@ struct inode { (((ip)->i_ump->um_fstype == UFS1) ? \ (ip)->i_ffs1_##field : (ip)->i_ffs2_##field) +#define DIP_ASSIGN(ip, field, value) \ + do { \ + if ((ip)->i_ump->um_fstype == UFS1) \ + (ip)->i_ffs1_##field = (value); \ + else \ + (ip)->i_ffs2_##field = (value); \ + } while(0) + +#define DIP_ADD(ip, field, value) \ + do { \ + if ((ip)->i_ump->um_fstype == UFS1) \ + (ip)->i_ffs1_##field += (value); \ + else \ + (ip)->i_ffs2_##field += (value); \ + } while(0) + #define SHORTLINK(ip) \ (((ip)->i_ump->um_fstype == UFS1) ? \ (caddr_t)(ip)->i_ffs1_db : (caddr_t)(ip)->i_ffs2_db) @@ -247,19 +263,19 @@ struct indir { #define FFS_ITIMES(ip, acc, mod, cre) { \ if ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) { \ if ((ip)->i_flag & IN_ACCESS) { \ - DIP(ip, atime) = (acc)->tv_sec; \ - DIP(ip, atimensec) = (acc)->tv_nsec; \ + DIP_ASSIGN(ip, atime, (acc)->tv_sec); \ + DIP_ASSIGN(ip, atimensec, (acc)->tv_nsec); \ (ip)->i_flag |= IN_ACCESSED; \ } \ if ((ip)->i_flag & IN_UPDATE) { \ - DIP(ip, mtime) = (mod)->tv_sec; \ - DIP(ip, mtimensec) = (mod)->tv_nsec; \ + DIP_ASSIGN(ip, mtime, (mod)->tv_sec); \ + DIP_ASSIGN(ip, mtimensec, (mod)->tv_nsec); \ (ip)->i_modrev++; \ (ip)->i_flag |= IN_MODIFIED; \ } \ if ((ip)->i_flag & IN_CHANGE) { \ - DIP(ip, ctime) = (cre)->tv_sec; \ - DIP(ip, ctimensec) = (cre)->tv_nsec; \ + DIP_ASSIGN(ip, ctime, (cre)->tv_sec); \ + DIP_ASSIGN(ip, ctimensec, (cre)->tv_nsec); \ (ip)->i_flag |= IN_MODIFIED; \ } \ (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \ diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index c567683ebcfb..e1720760ce82 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_inode.c,v 1.36 2003/04/02 10:39:44 fvdl Exp $ */ +/* $NetBSD: ufs_inode.c,v 1.37 2003/05/15 20:25:33 kristerw Exp $ */ /* * Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.36 2003/04/02 10:39:44 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.37 2003/05/15 20:25:33 kristerw Exp $"); #include "opt_quota.h" @@ -104,10 +104,10 @@ ufs_inactive(v) * So, rather than creating a new entry point to do the * same thing, we just use softdep_change_linkcnt(). */ - DIP(ip, rdev) = 0; + DIP_ASSIGN(ip, rdev, 0); mode = ip->i_mode; ip->i_mode = 0; - DIP(ip, mode) = 0; + DIP_ASSIGN(ip, mode, 0); ip->i_flag |= IN_CHANGE | IN_UPDATE; if (DOINGSOFTDEP(vp)) softdep_change_linkcnt(ip); diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index fd0cb6882531..ab950175e942 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_lookup.c,v 1.43 2003/04/02 10:39:44 fvdl Exp $ */ +/* $NetBSD: ufs_lookup.c,v 1.44 2003/05/15 20:25:33 kristerw Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.43 2003/04/02 10:39:44 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.44 2003/05/15 20:25:33 kristerw Exp $"); #include #include @@ -449,7 +449,7 @@ found: if (dp->i_offset + DIRSIZ(FSFMT(vdp), ep, needswap) > dp->i_size) { ufs_dirbad(dp, dp->i_offset, "i_size too small"); dp->i_size = dp->i_offset + DIRSIZ(FSFMT(vdp), ep, needswap); - DIP(dp, size) = dp->i_size; + DIP_ASSIGN(dp, size, dp->i_size); dp->i_flag |= IN_CHANGE | IN_UPDATE; } brelse(bp); @@ -771,7 +771,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp) return (error); } dp->i_size = dp->i_offset + dirblksiz; - DIP(dp, size) = dp->i_size; + DIP_ASSIGN(dp, size, dp->i_size); dp->i_flag |= IN_CHANGE | IN_UPDATE; uvm_vnp_setsize(dvp, dp->i_size); dirp->d_reclen = ufs_rw16(dirblksiz, needswap); @@ -857,7 +857,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, size) = dp->i_size; + DIP_ASSIGN(dp, size, dp->i_size); } /* * Get the block containing the space for the new directory entry. @@ -1024,7 +1024,7 @@ out: if (ip) { ip->i_ffs_effnlink--; ip->i_nlink--; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; } error = VOP_BWRITE(bp); @@ -1063,7 +1063,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir) bdwrite(bp); } else { oip->i_nlink--; - DIP(oip, nlink) = oip->i_nlink; + DIP_ASSIGN(oip, nlink, oip->i_nlink); oip->i_flag |= IN_CHANGE; error = VOP_BWRITE(bp); } diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index 81855687e3d7..4286ffc2e357 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_readwrite.c,v 1.51 2003/04/02 10:39:44 fvdl Exp $ */ +/* $NetBSD: ufs_readwrite.c,v 1.52 2003/05/15 20:25:33 kristerw Exp $ */ /*- * Copyright (c) 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.51 2003/04/02 10:39:44 fvdl Exp $"); +__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.52 2003/05/15 20:25:33 kristerw Exp $"); #ifdef LFS_READWRITE #define BLKSIZE(a, b, c) blksize(a, b, c) @@ -443,7 +443,7 @@ WRITE(void *v) break; if (uio->uio_offset + xfersize > ip->i_size) { ip->i_size = uio->uio_offset + xfersize; - DIP(ip, size) = ip->i_size; + DIP_ASSIGN(ip, size, ip->i_size); uvm_vnp_setsize(vp, ip->i_size); extended = 1; } @@ -495,7 +495,7 @@ out: ip->i_flag |= IN_CHANGE | IN_UPDATE; if (resid > uio->uio_resid && ap->a_cred && ap->a_cred->cr_uid != 0) { ip->i_mode &= ~(ISUID | ISGID); - DIP(ip, mode) = ip->i_mode; + DIP_ASSIGN(ip, mode, ip->i_mode); } if (resid > uio->uio_resid) VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0)); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 3bf4a1a0bd8d..79a475a1d2ce 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.98 2003/04/29 07:45:23 yamt Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.99 2003/05/15 20:25:33 kristerw Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993, 1995 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.98 2003/04/29 07:45:23 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.99 2003/05/15 20:25:33 kristerw Exp $"); #ifndef _LKM #include "opt_quota.h" @@ -418,7 +418,7 @@ ufs_setattr(void *v) securelevel > 0) return (EPERM); ip->i_flags = vap->va_flags; - DIP(ip, flags) = ip->i_flags; + DIP_ASSIGN(ip, flags, ip->i_flags); } else { if ((ip->i_flags & (SF_IMMUTABLE | SF_APPEND)) || (vap->va_flags & UF_SETTABLE) != vap->va_flags) @@ -428,7 +428,7 @@ ufs_setattr(void *v) return (EPERM); ip->i_flags &= SF_SETTABLE; ip->i_flags |= (vap->va_flags & UF_SETTABLE); - DIP(ip, flags) = ip->i_flags; + DIP_ASSIGN(ip, flags, ip->i_flags); } ip->i_flag |= IN_CHANGE; if (vap->va_flags & (IMMUTABLE | APPEND)) @@ -524,7 +524,7 @@ ufs_chmod(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) ip->i_mode &= ~ALLPERMS; ip->i_mode |= (mode & ALLPERMS); ip->i_flag |= IN_CHANGE; - DIP(ip, mode) = ip->i_mode; + DIP_ASSIGN(ip, mode, ip->i_mode); return (0); } @@ -584,9 +584,9 @@ ufs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, } #endif ip->i_gid = gid; - DIP(ip, gid) = gid; + DIP_ASSIGN(ip, gid, gid); ip->i_uid = uid; - DIP(ip, uid) = uid; + DIP_ASSIGN(ip, uid, uid); #ifdef QUOTA if ((error = getinoquota(ip)) == 0) { if (ouid == uid) { @@ -609,9 +609,9 @@ ufs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, } } ip->i_gid = ogid; - DIP(ip, gid) = ogid; + DIP_ASSIGN(ip, gid, ogid); ip->i_uid = ouid; - DIP(ip, uid) = ouid; + DIP_ASSIGN(ip, uid, ouid); if (getinoquota(ip) == 0) { if (ouid == uid) { dqrele(vp, ip->i_dquot[USRQUOTA]); @@ -715,7 +715,7 @@ ufs_link(void *v) } ip->i_ffs_effnlink++; ip->i_nlink++; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(vp)) softdep_change_linkcnt(ip); @@ -727,7 +727,7 @@ ufs_link(void *v) if (error) { ip->i_ffs_effnlink--; ip->i_nlink--; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(vp)) softdep_change_linkcnt(ip); @@ -964,7 +964,7 @@ ufs_rename(void *v) */ ip->i_ffs_effnlink++; ip->i_nlink++; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(fvp)) softdep_change_linkcnt(ip); @@ -1027,7 +1027,7 @@ ufs_rename(void *v) } dp->i_ffs_effnlink++; dp->i_nlink++; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(tdvp)) softdep_change_linkcnt(dp); @@ -1035,7 +1035,7 @@ ufs_rename(void *v) UPDATE_DIROP)) != 0) { dp->i_ffs_effnlink--; dp->i_nlink--; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(tdvp)) softdep_change_linkcnt(dp); @@ -1048,7 +1048,7 @@ ufs_rename(void *v) if (doingdirectory && newparent) { dp->i_ffs_effnlink--; dp->i_nlink--; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(tdvp)) softdep_change_linkcnt(dp); @@ -1127,11 +1127,11 @@ ufs_rename(void *v) */ if (!newparent) { dp->i_nlink--; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; } xp->i_nlink--; - DIP(xp, nlink) = xp->i_nlink; + DIP_ASSIGN(xp, nlink, xp->i_nlink); xp->i_flag |= IN_CHANGE; if ((error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC, tcnp->cn_cred, tcnp->cn_proc))) @@ -1211,7 +1211,7 @@ ufs_rename(void *v) if (vn_lock(fvp, LK_EXCLUSIVE) == 0) { ip->i_ffs_effnlink--; ip->i_nlink--; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; ip->i_flag &= ~IN_RENAME; if (DOINGSOFTDEP(fvp)) @@ -1271,9 +1271,9 @@ ufs_mkdir(void *v) goto out; ip = VTOI(tvp); ip->i_uid = cnp->cn_cred->cr_uid; - DIP(ip, uid) = ip->i_uid; + DIP_ASSIGN(ip, uid, ip->i_uid); ip->i_gid = dp->i_gid; - DIP(ip, gid) = ip->i_gid; + DIP_ASSIGN(ip, gid, ip->i_gid); #ifdef QUOTA if ((error = getinoquota(ip)) || (error = chkiq(ip, 1, cnp->cn_cred, 0))) { @@ -1286,16 +1286,16 @@ ufs_mkdir(void *v) #endif ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; ip->i_mode = dmode; - DIP(ip, mode) = dmode; + DIP_ASSIGN(ip, mode, dmode); tvp->v_type = VDIR; /* Rest init'd in getnewvnode(). */ ip->i_ffs_effnlink = 2; ip->i_nlink = 2; - DIP(ip, nlink) = 2; + DIP_ASSIGN(ip, nlink, 2); if (DOINGSOFTDEP(tvp)) softdep_change_linkcnt(ip); if (cnp->cn_flags & ISWHITEOUT) { ip->i_flags |= UF_OPAQUE; - DIP(ip, flags) = ip->i_flags; + DIP_ASSIGN(ip, flags, ip->i_flags); } /* @@ -1305,7 +1305,7 @@ ufs_mkdir(void *v) */ dp->i_ffs_effnlink++; dp->i_nlink++; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(dvp)) softdep_change_linkcnt(dp); @@ -1342,7 +1342,7 @@ ufs_mkdir(void *v) B_CLRBUF, &bp)) != 0) goto bad; ip->i_size = dirblksiz; - DIP(ip, size) = dirblksiz; + DIP_ASSIGN(ip, size, dirblksiz); ip->i_flag |= IN_CHANGE | IN_UPDATE; uvm_vnp_setsize(tvp, ip->i_size); memcpy((caddr_t)bp->b_data, (caddr_t)&dirtemplate, sizeof dirtemplate); @@ -1387,7 +1387,7 @@ ufs_mkdir(void *v) } else { dp->i_ffs_effnlink--; dp->i_nlink--; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(dvp)) softdep_change_linkcnt(dp); @@ -1397,7 +1397,7 @@ ufs_mkdir(void *v) */ ip->i_ffs_effnlink = 0; ip->i_nlink = 0; - DIP(ip, nlink) = 0; + DIP_ASSIGN(ip, nlink, 0); ip->i_flag |= IN_CHANGE; #ifdef LFS /* If IN_ADIROP, account for it */ @@ -1497,10 +1497,10 @@ ufs_rmdir(void *v) */ if (!DOINGSOFTDEP(vp)) { dp->i_nlink--; - DIP(dp, nlink) = dp->i_nlink; + DIP_ASSIGN(dp, nlink, dp->i_nlink); dp->i_flag |= IN_CHANGE; ip->i_nlink--; - DIP(ip, nlink) = ip->i_nlink; + DIP_ASSIGN(ip, nlink, ip->i_nlink); ip->i_flag |= IN_CHANGE; error = VOP_TRUNCATE(vp, (off_t)0, IO_SYNC, cnp->cn_cred, cnp->cn_proc); @@ -1542,7 +1542,7 @@ ufs_symlink(void *v) ip = VTOI(vp); memcpy((char *)SHORTLINK(ip), ap->a_target, len); ip->i_size = len; - DIP(ip, size) = len; + DIP_ASSIGN(ip, size, len); uvm_vnp_setsize(vp, ip->i_size); ip->i_flag |= IN_CHANGE | IN_UPDATE; } else @@ -2079,9 +2079,9 @@ ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, } ip = VTOI(tvp); ip->i_gid = pdir->i_gid; - DIP(ip, gid) = ip->i_gid; + DIP_ASSIGN(ip, gid, ip->i_gid); ip->i_uid = cnp->cn_cred->cr_uid; - DIP(ip, uid) = ip->i_uid; + DIP_ASSIGN(ip, uid, ip->i_uid); #ifdef QUOTA if ((error = getinoquota(ip)) || (error = chkiq(ip, 1, cnp->cn_cred, 0))) { @@ -2094,23 +2094,23 @@ ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, #endif ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; ip->i_mode = mode; - DIP(ip, mode) = mode; + DIP_ASSIGN(ip, mode, mode); tvp->v_type = IFTOVT(mode); /* Rest init'd in getnewvnode(). */ ip->i_ffs_effnlink = 1; ip->i_nlink = 1; - DIP(ip, nlink) = 1; + DIP_ASSIGN(ip, nlink, 1); if (DOINGSOFTDEP(tvp)) softdep_change_linkcnt(ip); if ((ip->i_mode & ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) && suser(cnp->cn_cred, NULL)) { ip->i_mode &= ~ISGID; - DIP(ip, mode) = ip->i_mode; + DIP_ASSIGN(ip, mode, ip->i_mode); } if (cnp->cn_flags & ISWHITEOUT) { ip->i_flags |= UF_OPAQUE; - DIP(ip, flags) = ip->i_flags; + DIP_ASSIGN(ip, flags, ip->i_flags); } /* @@ -2136,7 +2136,7 @@ ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, vput(dvp); ip->i_ffs_effnlink = 0; ip->i_nlink = 0; - DIP(ip, nlink) = 0; + DIP_ASSIGN(ip, nlink, 0); ip->i_flag |= IN_CHANGE; #ifdef LFS /* If IN_ADIROP, account for it */ @@ -2184,7 +2184,7 @@ ufs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags, UVMHIST_LOG(ubchist, "vp %p old 0x%x new 0x%x", vp, ip->i_size, off + bsize, 0); ip->i_size = off + bsize; - DIP(ip, size) = ip->i_size; + DIP_ASSIGN(ip, size, ip->i_size); } off += bsize;