diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-07-13 15:03:35 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-07-13 15:03:35 +0000 |
commit | ef61b58b95956f29bdb74e3b7a32b799b61f8470 (patch) | |
tree | a787cd20abdef3a1aa48d146e94c409517bf995c /sbin/fdisk/disk.c | |
parent | b826392db2bc35d7bc8ad0a9223102542284b155 (diff) |
Disk sector addresses are normally stored/provided in uint64_t
variables/parameters, not off_t.
Adjust various parameters and variables accordingly. A few missed const's
and verbiage tweaks in passing.
No functional change.
Diffstat (limited to 'sbin/fdisk/disk.c')
-rw-r--r-- | sbin/fdisk/disk.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 00952c1b108..880aa0be2ba 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.62 2021/07/12 22:18:54 krw Exp $ */ +/* $OpenBSD: disk.c,v 1.63 2021/07/13 15:03:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -113,16 +113,16 @@ DISK_printgeometry(const char *units) * The caller must free() the memory it gets. */ char * -DISK_readsector(off_t where) +DISK_readsector(const uint64_t sector) { char *secbuf; ssize_t len; - off_t off; + off_t off, where; int secsize; secsize = dl.d_secsize; - where *= secsize; + where = sector * secsize; off = lseek(disk.dk_fd, where, SEEK_SET); if (off != where) return NULL; @@ -146,16 +146,16 @@ DISK_readsector(off_t where) * errno if the write fails. */ int -DISK_writesector(const char *secbuf, off_t where) +DISK_writesector(const char *secbuf, const uint64_t sector) { int secsize; ssize_t len; - off_t off; + off_t off, where; len = -1; secsize = dl.d_secsize; - where *= secsize; + where = secsize * sector; off = lseek(disk.dk_fd, where, SEEK_SET); if (off == where) len = write(disk.dk_fd, secbuf, secsize); |