Use MIN/MAX macros from sys/param.h.
MFC after: 2 weeks.
This commit is contained in:
parent
0193043c46
commit
1120faab41
@ -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
|
||||
|
@ -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++)
|
||||
|
@ -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++)
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user