diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-23 03:46:19 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-23 03:46:19 +0000 |
commit | c7f4c3f7eedf62e1288b7eed0b5c722ce31c28ee (patch) | |
tree | c7f21739e9f1c430658d1675b8c20c4cf34a38ae /sbin/pdisk/partition_map.c | |
parent | ae30166f3f7b911b7df9f39319ab97b233f66846 (diff) |
Flip read_block() and write_block() back to taking sector addresses
instead of off_t values. Do the DEV_BSIZE multiplication in these two
functions.
Easier to read code and kills two #include <sys/param.h>.
Kill unused label.
Diffstat (limited to 'sbin/pdisk/partition_map.c')
-rw-r--r-- | sbin/pdisk/partition_map.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c index 73219dedc64..b5f3b7ef8f7 100644 --- a/sbin/pdisk/partition_map.c +++ b/sbin/pdisk/partition_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: partition_map.c,v 1.54 2016/01/23 01:43:13 krw Exp $ */ +/* $OpenBSD: partition_map.c,v 1.55 2016/01/23 03:46:18 krw Exp $ */ /* * partition_map.c - partition map routines @@ -156,7 +156,7 @@ read_partition_map(struct partition_map_header * map) warn("can't allocate memory for disk buffers"); return -1; } - if (read_block(map->fd, DEV_BSIZE, dpme) == 0) { + if (read_block(map->fd, 1, dpme) == 0) { warnx("Can't read block 1 from '%s'", map->name); free(dpme); return -1; @@ -165,7 +165,7 @@ read_partition_map(struct partition_map_header * map) old_logical = map->logical_block; map->logical_block = 512; while (map->logical_block <= map->physical_block) { - if (read_block(map->fd, DEV_BSIZE, dpme) == 0) { + if (read_block(map->fd, 1, dpme) == 0) { warnx("Can't read block 1 from '%s'", map->name); free(dpme); @@ -203,7 +203,7 @@ read_partition_map(struct partition_map_header * map) warn("can't allocate memory for disk buffers"); return -1; } - if (read_block(map->fd, ix * DEV_BSIZE, dpme) == 0) { + if (read_block(map->fd, ix, dpme) == 0) { warnx("Can't read block %u from '%s'", ix, map->name); free(dpme); return -1; @@ -234,8 +234,7 @@ write_partition_map(struct partition_map_header * map) for (entry = map->disk_order; entry != NULL; entry = entry->next_on_disk) { convert_dpme(entry->dpme, 0); - result = write_block(map->fd, entry->disk_address * DEV_BSIZE, - entry->dpme); + result = write_block(map->fd, entry->disk_address, entry->dpme); if (result == 0) warn("Unable to write block %ld", entry->disk_address); convert_dpme(entry->dpme, 1); |