diff options
-rw-r--r-- | sbin/fsck_ffs/fsutil.c | 8 | ||||
-rw-r--r-- | sbin/fsck_ffs/inode.c | 2 | ||||
-rw-r--r-- | sbin/fsck_ffs/pass2.c | 4 | ||||
-rw-r--r-- | sbin/fsck_ffs/setup.c | 3 |
4 files changed, 6 insertions, 11 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 713c9d4..52a982f 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -365,8 +365,7 @@ flush(int fd, struct bufarea *bp) for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { blwrite(fswritefd, (char *)sblock.fs_csp + i, fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag), - sblock.fs_cssize - i < sblock.fs_bsize ? - sblock.fs_cssize - i : sblock.fs_bsize); + MIN(sblock.fs_cssize - i, sblock.fs_bsize)); } } @@ -673,7 +672,7 @@ blzero(int fd, ufs2_daddr_t blk, long size) if (lseek(fd, offset, 0) < 0) rwerror("SEEK BLK", blk); while (size > 0) { - len = size > ZEROBUFSIZE ? ZEROBUFSIZE : size; + len = MIN(ZEROBUFSIZE, size); if (write(fd, zero, len) != len) rwerror("WRITE BLK", blk); blk += len / dev_bsize; @@ -718,8 +717,7 @@ check_cgmagic(int cg, struct bufarea *cgbp) cgp->cg_magic = CG_MAGIC; cgp->cg_cgx = cg; cgp->cg_niblk = sblock.fs_ipg; - cgp->cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ? - sblock.fs_ipg : 2 * INOPB(&sblock); + cgp->cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock)); if (cgbase(&sblock, cg) + sblock.fs_fpg < sblock.fs_size) cgp->cg_ndblk = sblock.fs_fpg; else diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index bb68d5b..0d78814 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -465,7 +465,7 @@ cacheino(union dinode *dp, ino_t inumber) inp->i_number = inumber; inp->i_isize = DIP(dp, di_size); inp->i_numblks = blks; - for (i = 0; i < (blks < NDADDR ? blks : NDADDR); i++) + for (i = 0; i < MIN(blks, NDADDR); i++) inp->i_blks[i] = DIP(dp, di_db[i]); if (blks > NDADDR) for (i = 0; i < NIADDR; i++) diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index 82c3b94..36a41ac 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -182,9 +182,7 @@ pass2(void) memset(dp, 0, sizeof(struct ufs2_dinode)); DIP_SET(dp, di_mode, IFDIR); DIP_SET(dp, di_size, inp->i_isize); - for (i = 0; - i < (inp->i_numblks<NDADDR ? inp->i_numblks : NDADDR); - i++) + for (i = 0; i < MIN(inp->i_numblks, NDADDR); i++) DIP_SET(dp, di_db[i], inp->i_blks[i]); if (inp->i_numblks > NDADDR) for (i = 0; i < NIADDR; i++) diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 494e503..ff7e9ef 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -245,8 +245,7 @@ setup(char *dev) goto badsb; } for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { - size = sblock.fs_cssize - i < sblock.fs_bsize ? - sblock.fs_cssize - i : sblock.fs_bsize; + size = MIN(sblock.fs_cssize - i, sblock.fs_bsize); readcnt[sblk.b_type]++; if (blread(fsreadfd, (char *)sblock.fs_csp + i, fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag), |