summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-01 02:24:05 +0000
committerpfg <pfg@FreeBSD.org>2016-05-01 02:24:05 +0000
commit99c72370d143d76721d8a3da55177b362925bac6 (patch)
tree40e161dbc2a5b51098c923f7ba5378838673b0f2
parent212ce360b69cebcd06dfe2e5569bd3bbd96fb734 (diff)
downloadFreeBSD-src-99c72370d143d76721d8a3da55177b362925bac6.zip
FreeBSD-src-99c72370d143d76721d8a3da55177b362925bac6.tar.gz
sbin: ake use of our rounddown() macro when sys/param.h is available.
No functional change.
-rw-r--r--sbin/dump/main.c2
-rw-r--r--sbin/fsck_ffs/inode.c2
-rw-r--r--sbin/fsck_ffs/suj.c2
-rw-r--r--sbin/geom/class/virstor/geom_virstor.c2
-rw-r--r--sbin/recoverdisk/recoverdisk.c4
5 files changed, 6 insertions, 6 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index ee18f82..ee02728 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -267,7 +267,7 @@ main(int argc, char *argv[])
}
if (blocksperfile)
- blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
+ blocksperfile = rounddown(blocksperfile, ntrec);
else if (!unlimited) {
/*
* Determine how to default tape size and density
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index e938178..bb68d5b 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -293,7 +293,7 @@ ginode(ino_t inumber)
if (pbp != NULL)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
- startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
+ startinum = rounddown(inumber, INOPB(&sblock));
}
if (sblock.fs_magic == FS_UFS1_MAGIC)
return ((union dinode *)
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index 58949c9..b265dfc 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -911,7 +911,7 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
* certain we hit a valid record and not some junk in the middle
* of a file name. Stop when we reach or pass the expected offset.
*/
- dpoff = (doff / DIRBLKSIZ) * DIRBLKSIZ;
+ dpoff = rounddown(doff, DIRBLKSIZ);
do {
dp = (struct direct *)&block[dpoff];
if (dpoff == doff)
diff --git a/sbin/geom/class/virstor/geom_virstor.c b/sbin/geom/class/virstor/geom_virstor.c
index 15a5676..7b83852 100644
--- a/sbin/geom/class/virstor/geom_virstor.c
+++ b/sbin/geom/class/virstor/geom_virstor.c
@@ -255,7 +255,7 @@ virstor_label(struct gctl_req *req)
if (md.md_chunk_size % MAXPHYS != 0) {
/* XXX: This is not strictly needed, but it's convenient to
* impose some limitations on it, so why not MAXPHYS. */
- size_t new_size = (md.md_chunk_size / MAXPHYS) * MAXPHYS;
+ size_t new_size = rounddown(md.md_chunk_size, MAXPHYS);
if (new_size < md.md_chunk_size)
new_size += MAXPHYS;
fprintf(stderr, "Resizing chunk size to be a multiple of "
diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c
index af0d88e..ac2788a 100644
--- a/sbin/recoverdisk/recoverdisk.c
+++ b/sbin/recoverdisk/recoverdisk.c
@@ -207,7 +207,7 @@ main(int argc, char * const argv[])
sectorsize = stripesize;
minsize = sectorsize;
- bigsize = (bigsize / sectorsize) * sectorsize;
+ bigsize = rounddown(bigsize, sectorsize);
error = ioctl(fdr, DIOCGMEDIASIZE, &t);
if (error < 0)
@@ -222,7 +222,7 @@ main(int argc, char * const argv[])
for (ch = 0; (bigsize >> ch) > minsize; ch++)
continue;
medsize = bigsize >> (ch / 2);
- medsize = (medsize / minsize) * minsize;
+ medsize = rounddown(medsize, minsize);
fprintf(stderr, "Bigsize = %zu, medsize = %zu, minsize = %zu\n",
bigsize, medsize, minsize);
OpenPOWER on IntegriCloud