summaryrefslogtreecommitdiff
path: root/sbin/pdisk/dump.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-01-28 19:07:46 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-01-28 19:07:46 +0000
commit7f35e5497224f904db6196be8e0e00b9703c29cd (patch)
treec90ca4ca86fb875aea57f9b2390e6eb36fad46e6 /sbin/pdisk/dump.c
parente85fea07abb15946d3a606180900ae1e10e0e04b (diff)
Hand rolled lists suck. First, replace disk_order with an LIST.
Diffstat (limited to 'sbin/pdisk/dump.c')
-rw-r--r--sbin/pdisk/dump.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index f0dc022b175..5d0246f679d 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.61 2016/01/28 13:09:21 krw Exp $ */
+/* $OpenBSD: dump.c,v 1.62 2016/01/28 19:07:45 krw Exp $ */
/*
* dump.c - dumping partition maps
@@ -27,6 +27,8 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/queue.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -93,8 +95,7 @@ dump_partition_map(struct partition_map_header *map)
printf(" #: %*s %-*s %*s %-*s ( size )\n", max_type_length, "type",
max_name_length, "name", digits, "length", digits, "base");
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
dump_partition_entry(entry, max_type_length,
max_name_length, digits);
}
@@ -181,8 +182,7 @@ show_data_structures(struct partition_map_header *map)
printf("\n");
printf(" #: type length base "
"flags (logical)\n");
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
p = entry->dpme;
printf("%2ld: %20.32s ", entry->disk_address, p->dpme_type);
printf("%7u @ %-7u ", p->dpme_pblocks, p->dpme_pblock_start);
@@ -206,8 +206,7 @@ show_data_structures(struct partition_map_header *map)
printf("\n");
printf(" #: booter bytes load_address "
"goto_address checksum processor\n");
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
p = entry->dpme;
printf("%2ld: ", entry->disk_address);
printf("%7u ", p->dpme_boot_block);
@@ -363,8 +362,7 @@ get_max_type_string_length(struct partition_map_header *map)
max = 0;
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
length = strnlen(entry->dpme->dpme_type, DPISTRLEN);
if (length > max)
max = length;
@@ -381,8 +379,7 @@ get_max_name_string_length(struct partition_map_header *map)
max = 0;
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
length = strnlen(entry->dpme->dpme_name, DPISTRLEN);
if (length > max)
max = length;
@@ -399,8 +396,7 @@ get_max_base_or_length(struct partition_map_header *map)
max = 0;
- for (entry = map->disk_order; entry != NULL;
- entry = entry->next_on_disk) {
+ LIST_FOREACH(entry, &map->disk_order, disk_entry) {
if (entry->dpme->dpme_pblock_start > max)
max = entry->dpme->dpme_pblock_start;
if (entry->dpme->dpme_pblocks > max)