summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2016-01-29 17:22:44 +0000
committerkrw <krw@openbsd.org>2016-01-29 17:22:44 +0000
commit8e37d5648d6cdd06bd115dea27d18d242d16375e (patch)
tree7b067de13dbc9fa715eed5477773551e28ea55db
parentuse hid_desc fields since we have them, instead of manual offsets (diff)
downloadwireguard-openbsd-8e37d5648d6cdd06bd115dea27d18d242d16375e.tar.xz
wireguard-openbsd-8e37d5648d6cdd06bd115dea27d18d242d16375e.zip
Tweak printing of partitions. Always show the pblock info in the
'p' command output. And always show the lblock info in the 'P' command. Showing sometimes one and sometimes another with a subtle extra character to indicate which is being shown is error prone.
-rw-r--r--sbin/pdisk/dump.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index 7b24b719381..e1d1db85e01 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.65 2016/01/29 15:06:37 krw Exp $ */
+/* $OpenBSD: dump.c,v 1.66 2016/01/29 17:22:44 krw Exp $ */
/*
* dump.c - dumping partition maps
@@ -111,7 +111,6 @@ dump_partition_entry(struct entry *entry, int type_length,
struct dpme *p;
double bytes;
int j, driver;
- uint32_t size;
map = entry->the_map;
p = entry->dpme;
@@ -119,23 +118,10 @@ dump_partition_entry(struct entry *entry, int type_length,
printf("%2ld: %*.32s", entry->disk_address, type_length, p->dpme_type);
printf("%c%-*.32s ", driver, name_length, p->dpme_name);
- if (p->dpme_lblocks + p->dpme_lblock_start != p->dpme_pblocks) {
- printf("%*u+", digits, p->dpme_lblocks);
- size = p->dpme_lblocks;
- } else if (p->dpme_lblock_start != 0) {
- printf("%*u ", digits, p->dpme_lblocks);
- size = p->dpme_lblocks;
- } else {
- printf("%*u ", digits, p->dpme_pblocks);
- size = p->dpme_pblocks;
- }
- if (p->dpme_lblock_start == 0)
- printf("@ %-*u", digits, p->dpme_pblock_start);
- else
- printf("@~%-*u", digits, p->dpme_pblock_start +
- p->dpme_lblock_start);
+ printf("%*u @ %-*u", digits, p->dpme_pblocks, digits,
+ p->dpme_pblock_start);
- bytes = ((double) size) * map->physical_block;
+ bytes = ((double) p->dpme_pblocks) * map->physical_block;
adjust_value_and_compute_prefix(&bytes, &j);
if (j != ' ' && j != 'K')
printf(" (%#5.1f%c)", bytes, j);
@@ -181,7 +167,7 @@ show_data_structures(struct partition_map *map)
}
printf("\n");
printf(" #: type length base "
- "flags (logical)\n");
+ "flags ( logical )\n");
LIST_FOREACH(entry, &map->disk_order, disk_entry) {
p = entry->dpme;
printf("%2ld: %20.32s ", entry->disk_address, p->dpme_type);
@@ -196,12 +182,8 @@ show_data_structures(struct partition_map *map)
(p->dpme_flags & DPME_OS_PIC_CODE) ? 'P' : '.',
(p->dpme_flags & DPME_OS_SPECIFIC_2) ? '2' : '.',
(p->dpme_flags & DPME_OS_SPECIFIC_1) ? '1' : '.');
- if (p->dpme_lblock_start != 0 || p->dpme_pblocks !=
- p->dpme_lblocks) {
- printf("(%u @ %u)", p->dpme_lblocks,
- p->dpme_lblock_start);
- }
- printf("\n");
+ printf("( %7u @ %-7u )\n", p->dpme_lblocks,
+ p->dpme_lblock_start);
}
printf("\n");
printf(" #: booter bytes load_address "