diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-21 15:33:22 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-21 15:33:22 +0000 |
commit | a0eba21cbc07314778bd6858995705f95b6b1c4e (patch) | |
tree | afc3d2e18828d1a8b5d6cb0b8c1caa87aca86000 /sbin/pdisk/dump.c | |
parent | 77e6310e00ab597c99ff48c7b868dfb82c4e9dc2 (diff) |
Hoist all file opening and ioctl calls into main(), passing a pointer to
a valid map to edit(). Should enable pledging a la fdisk at some point.
Since edit() always gets a valid map (and maintains its validity even when
'I'nitializing a new one) many checks for (map == NULL) are junked.
Remove some dances around block sizes by using DEV_BSIZE everywhere
since we don't support non-DEV_BSIZE (a.k.a. 512-byte) sectors.
Remove many superfluous #include statements.
Diffstat (limited to 'sbin/pdisk/dump.c')
-rw-r--r-- | sbin/pdisk/dump.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c index 51eee0825a0..c9da308d2c2 100644 --- a/sbin/pdisk/dump.c +++ b/sbin/pdisk/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.39 2016/01/21 02:52:52 krw Exp $ */ +/* $OpenBSD: dump.c,v 1.40 2016/01/21 15:33:21 krw Exp $ */ /* * dump.c - dumping partition maps @@ -29,13 +29,9 @@ #include <sys/param.h> /* DEV_BSIZE */ -#include <err.h> - #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <fcntl.h> -#include <errno.h> #include "file_media.h" #include "dump.h" @@ -100,10 +96,6 @@ dump_partition_map(struct partition_map_header * map, int disk_order) struct partition_map *entry; int digits, max_type_length, max_name_length; - if (map == NULL) { - bad_input("No partition map exists"); - return; - } printf("\nPartition map (with %d byte blocks) on '%s'\n", map->logical_block, map->name); @@ -198,10 +190,6 @@ show_data_structures(struct partition_map_header * map) struct dpme *p; int i; - if (map == NULL) { - printf("No partition map exists\n"); - return; - } printf("Header:\n"); printf("map %d blocks out of %d, media %lu blocks (%d byte blocks)\n", map->blocks_in_map, map->maximum_in_map, @@ -405,10 +393,6 @@ full_dump_block_zero(struct partition_map_header * map) struct ddmap *m; int i; - if (map == NULL) { - printf("No partition map exists\n"); - return; - } if (map->misc == NULL) { printf("No block zero\n"); return; @@ -442,9 +426,6 @@ get_max_type_string_length(struct partition_map_header * map) struct partition_map *entry; int max, length; - if (map == NULL) { - return 0; - } max = 0; for (entry = map->disk_order; entry != NULL; entry = entry->next_on_disk) { @@ -463,9 +444,6 @@ get_max_name_string_length(struct partition_map_header * map) struct partition_map *entry; int max, length; - if (map == NULL) { - return 0; - } max = 0; for (entry = map->disk_order; entry != NULL; entry = @@ -485,9 +463,6 @@ get_max_base_or_length(struct partition_map_header * map) struct partition_map *entry; int max; - if (map == NULL) { - return 0; - } max = 0; for (entry = map->disk_order; entry != NULL; |