aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-04-26 14:51:58 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-04-26 14:51:58 +0000
commit768f89e0788ab1ab7ea5df9d57082f53567007ec (patch)
tree07ce8a4419c47fd4788bda5302443efe21db7ed0 /sys
parent96edd3f3eed053770433b515d6e8c1e839f3233e (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/boot/common/part.c11
-rw-r--r--sys/boot/powerpc/ps3/main.c2
-rw-r--r--sys/boot/sparc64/boot1/boot1.c2
3 files changed, 8 insertions, 7 deletions
diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c
index 7761de370bec..33da7bc7f3ba 100644
--- a/sys/boot/common/part.c
+++ b/sys/boot/common/part.c
@@ -257,8 +257,9 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
table->sectorsize);
if (phdr != NULL) {
/* Read the primary GPT table. */
- size = MIN(MAXTBLSZ, (phdr->hdr_entries * phdr->hdr_entsz +
- table->sectorsize - 1) / table->sectorsize);
+ size = MIN(MAXTBLSZ,
+ howmany(phdr->hdr_entries * phdr->hdr_entsz,
+ table->sectorsize));
if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 &&
gpt_checktbl(phdr, tbl, size * table->sectorsize,
table->sectors - 1) == 0) {
@@ -290,9 +291,9 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
hdr.hdr_entsz != phdr->hdr_entsz ||
hdr.hdr_crc_table != phdr->hdr_crc_table) {
/* Read the backup GPT table. */
- size = MIN(MAXTBLSZ, (phdr->hdr_entries *
- phdr->hdr_entsz + table->sectorsize - 1) /
- table->sectorsize);
+ size = MIN(MAXTBLSZ,
+ howmany(phdr->hdr_entries * phdr->hdr_entsz,
+ table->sectorsize));
if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 &&
gpt_checktbl(phdr, tbl, size * table->sectorsize,
table->sectors - 1) == 0) {
diff --git a/sys/boot/powerpc/ps3/main.c b/sys/boot/powerpc/ps3/main.c
index 86ce62ebfac5..bb1fd84c4b70 100644
--- a/sys/boot/powerpc/ps3/main.c
+++ b/sys/boot/powerpc/ps3/main.c
@@ -174,7 +174,7 @@ delay(int usecs)
uint64_t tb,ttb;
tb = mftb();
- ttb = tb + (usecs * 1000 + ns_per_tick - 1) / ns_per_tick;
+ ttb = tb + howmany(usecs * 1000, ns_per_tick);
while (tb < ttb)
tb = mftb();
}
diff --git a/sys/boot/sparc64/boot1/boot1.c b/sys/boot/sparc64/boot1/boot1.c
index d0b738039b0f..4724ca165fd4 100644
--- a/sys/boot/sparc64/boot1/boot1.c
+++ b/sys/boot/sparc64/boot1/boot1.c
@@ -390,7 +390,7 @@ zbread(char *buf, off_t off, size_t bytes)
p = buf;
soff = VDEV_BOOT_OFFSET + off;
- lb = (soff + bytes + DEV_BSIZE - 1) / DEV_BSIZE;
+ lb = howmany(soff + bytes, DEV_BSIZE);
poff = soff;
while (poff < soff + bytes) {
nb = lb - poff / DEV_BSIZE;