summaryrefslogtreecommitdiff
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2016-10-16 22:26:35 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2016-10-16 22:26:35 +0000
commitef39023ff7faf9863cb2b475a456f9f658565033 (patch)
tree103cd8c87b42649fa95aee357c959f0f00035249 /usr.sbin/makefs
parentaaa5e4722f14625922d77c94f57043553db655ca (diff)
remove swapping add macros
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/ffs.c6
-rw-r--r--usr.sbin/makefs/ffs/ffs_alloc.c14
-rw-r--r--usr.sbin/makefs/ufs/ffs/ffs_subr.c8
-rw-r--r--usr.sbin/makefs/ufs/ufs/ufs_bswap.h7
4 files changed, 15 insertions, 20 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 5d4abc776f2..e2ee71bc3af 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.c,v 1.6 2016/10/16 21:59:28 tedu Exp $ */
+/* $OpenBSD: ffs.c,v 1.7 2016/10/16 22:26:34 tedu Exp $ */
/* $NetBSD: ffs.c,v 1.66 2015/12/21 00:58:08 christos Exp $ */
/*
@@ -1075,11 +1075,11 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
"ffs_write_inode: cg %d out of inodes for ino %u",
cg, ino);
setbit(cg_inosused(cgp, 0), cgino);
- ufs_add32(cgp->cg_cs.cs_nifree, -1, 0);
+ cgp->cg_cs.cs_nifree -= 1;
fs->fs_cstotal.cs_nifree--;
fs->fs_cs(fs, cg).cs_nifree--;
if (S_ISDIR(DIP(dp, mode))) {
- ufs_add32(cgp->cg_cs.cs_ndir, 1, 0);
+ cgp->cg_cs.cs_ndir += 1;
fs->fs_cstotal.cs_ndir++;
fs->fs_cs(fs, cg).cs_ndir++;
}
diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c
index d4738d49078..3b10a4df168 100644
--- a/usr.sbin/makefs/ffs/ffs_alloc.c
+++ b/usr.sbin/makefs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.5 2016/10/16 22:19:10 tedu Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.6 2016/10/16 22:26:34 tedu Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.29 2016/06/24 19:24:11 christos Exp $ */
/* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */
@@ -334,24 +334,24 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
for (i = frags; i < fs->fs_frag; i++)
setbit(cg_blksfree(cgp, 0), bpref + i);
i = fs->fs_frag - frags;
- ufs_add32(cgp->cg_cs.cs_nffree, i, 0);
+ cgp->cg_cs.cs_nffree += i;
fs->fs_cstotal.cs_nffree += i;
fs->fs_cs(fs, cg).cs_nffree += i;
fs->fs_fmod = 1;
- ufs_add32(cgp->cg_frsum[i], 1, 0);
+ cgp->cg_frsum[i] += 1;
bdwrite(bp);
return (bno);
}
bno = ffs_mapsearch(fs, cgp, bpref, allocsiz);
for (i = 0; i < frags; i++)
clrbit(cg_blksfree(cgp, 0), bno + i);
- ufs_add32(cgp->cg_cs.cs_nffree, -frags, 0);
+ cgp->cg_cs.cs_nffree -= frags;
fs->fs_cstotal.cs_nffree -= frags;
fs->fs_cs(fs, cg).cs_nffree -= frags;
fs->fs_fmod = 1;
- ufs_add32(cgp->cg_frsum[allocsiz], -1, 0);
+ cgp->cg_frsum[allocsiz] -= 1;
if (frags != allocsiz)
- ufs_add32(cgp->cg_frsum[allocsiz - frags], 1, 0);
+ cgp->cg_frsum[allocsiz - frags] += 1;
blkno = cg * fs->fs_fpg + bno;
bdwrite(bp);
return blkno;
@@ -401,7 +401,7 @@ gotit:
blkno = ffs_fragstoblks(fs, bno);
ffs_clrblock(fs, blksfree, (long)blkno);
ffs_clusteracct(fs, cgp, blkno, -1);
- ufs_add32(cgp->cg_cs.cs_nbfree, -1, 0);
+ cgp->cg_cs.cs_nbfree -= 1;
fs->fs_cstotal.cs_nbfree--;
fs->fs_cs(fs, ufs_rw32(cgp->cg_cgx, 0)).cs_nbfree--;
fs->fs_fmod = 1;
diff --git a/usr.sbin/makefs/ufs/ffs/ffs_subr.c b/usr.sbin/makefs/ufs/ffs/ffs_subr.c
index d6825c79259..5284fd8b96a 100644
--- a/usr.sbin/makefs/ufs/ffs/ffs_subr.c
+++ b/usr.sbin/makefs/ufs/ffs/ffs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_subr.c,v 1.4 2016/10/16 22:19:10 tedu Exp $ */
+/* $OpenBSD: ffs_subr.c,v 1.5 2016/10/16 22:26:34 tedu Exp $ */
/* $NetBSD: ffs_subr.c,v 1.49 2016/05/07 11:59:08 maxv Exp $ */
/*
@@ -204,11 +204,11 @@ ffs_clusteracct(struct fs *fs, struct cg *cgp, int32_t blkno, int cnt)
i = back + forw + 1;
if (i > fs->fs_contigsumsize)
i = fs->fs_contigsumsize;
- ufs_add32(sump[i], cnt, 0);
+ sump[i] += cnt;
if (back > 0)
- ufs_add32(sump[back], -cnt, 0);
+ sump[back] -= cnt;
if (forw > 0)
- ufs_add32(sump[forw], -cnt, 0);
+ sump[forw] -= cnt;
/*
* Update cluster summary information.
diff --git a/usr.sbin/makefs/ufs/ufs/ufs_bswap.h b/usr.sbin/makefs/ufs/ufs/ufs_bswap.h
index 614233b8977..a05135afca0 100644
--- a/usr.sbin/makefs/ufs/ufs/ufs_bswap.h
+++ b/usr.sbin/makefs/ufs/ufs/ufs_bswap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_bswap.h,v 1.4 2016/10/16 22:23:08 tedu Exp $ */
+/* $OpenBSD: ufs_bswap.h,v 1.5 2016/10/16 22:26:34 tedu Exp $ */
/* $NetBSD: ufs_bswap.h,v 1.21 2016/04/29 03:05:04 christos Exp $ */
/*
@@ -50,9 +50,4 @@ ufs_rw64(uint64_t a, int ns)
return a;
}
-#define ufs_add32(a, b, ns) \
- (a) = ufs_rw32(ufs_rw32((a), (ns)) + (b), (ns))
-#define ufs_add64(a, b, ns) \
- (a) = ufs_rw64(ufs_rw64((a), (ns)) + (b), (ns))
-
#endif /* !_UFS_UFS_BSWAP_H_ */