summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-01-22 01:25:57 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-01-22 01:25:57 +0000
commitd6842e396167ba7995bcb6aaeac8ace7b4bf6cca (patch)
treedae9d570873e2c79a984db64805e9f154f971a86 /sbin
parentd32d6f51ac0a01d6d56a0a9a105f7a61ab76ba76 (diff)
In the "why use two variables when one would do" category, eliminate
the 'written' field and just use the 'changed' field to mediate when it is appropriate to ask whether changes should be discarded.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pdisk/dump.c5
-rw-r--r--sbin/pdisk/partition_map.c3
-rw-r--r--sbin/pdisk/partition_map.h3
-rw-r--r--sbin/pdisk/pdisk.c5
4 files changed, 6 insertions, 10 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index 767932a0c25..d50ce937999 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.41 2016/01/22 00:38:53 krw Exp $ */
+/* $OpenBSD: dump.c,v 1.42 2016/01/22 01:25:56 krw Exp $ */
/*
* dump.c - dumping partition maps
@@ -186,8 +186,7 @@ show_data_structures(struct partition_map_header * map)
map->blocks_in_map, map->maximum_in_map,
map->media_size, map->logical_block);
printf("Map is%s writable", rflag ? kStringNot : kStringEmpty);
- printf(", but%s changed", (map->changed) ? kStringEmpty : kStringNot);
- printf(" and has%s been written\n", (map->written) ? kStringEmpty :
+ printf(" and has%s been changed\n", (map->changed) ? kStringEmpty :
kStringNot);
printf("\n");
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c
index 6c7cca370f4..6de6dba1c25 100644
--- a/sbin/pdisk/partition_map.c
+++ b/sbin/pdisk/partition_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.c,v 1.44 2016/01/22 00:38:53 krw Exp $ */
+/* $OpenBSD: partition_map.c,v 1.45 2016/01/22 01:25:56 krw Exp $ */
/*
* partition_map.c - partition map routines
@@ -90,7 +90,6 @@ open_partition_map(int fd, char *name)
map->name = name;
map->changed = 0;
- map->written = 0;
map->disk_order = NULL;
map->base_order = NULL;
map->physical_block = DEV_BSIZE;
diff --git a/sbin/pdisk/partition_map.h b/sbin/pdisk/partition_map.h
index ade319e9c7c..a166eaad342 100644
--- a/sbin/pdisk/partition_map.h
+++ b/sbin/pdisk/partition_map.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.h,v 1.21 2016/01/21 15:33:21 krw Exp $ */
+/* $OpenBSD: partition_map.h,v 1.22 2016/01/22 01:25:56 krw Exp $ */
/*
* partition_map.h - partition map routines
@@ -40,7 +40,6 @@ struct partition_map_header {
struct block0 *misc;
int fd;
int changed;
- int written;
int physical_block; /* must be == sbBlockSize */
int logical_block; /* must be <= physical_block */
int blocks_in_map;
diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c
index dfedc99c25c..b670b898a6c 100644
--- a/sbin/pdisk/pdisk.c
+++ b/sbin/pdisk/pdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdisk.c,v 1.57 2016/01/22 00:38:53 krw Exp $ */
+/* $OpenBSD: pdisk.c,v 1.58 2016/01/22 01:25:56 krw Exp $ */
/*
* pdisk - an editor for Apple format partition tables
@@ -476,7 +476,7 @@ do_write_partition_map(struct partition_map_header * map)
bad_input("No partition map exists");
return;
}
- if (map->changed == 0 && map->written == 0) {
+ if (map->changed == 0) {
bad_input("The map has not been changed.");
return;
}
@@ -491,7 +491,6 @@ do_write_partition_map(struct partition_map_header * map)
write_partition_map(map);
map->changed = 0;
- map->written = 1;
}