diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-08-03 00:19:43 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-08-03 00:19:43 +0000 |
commit | 1cff5c2207ba8e29a5394401c702b28e0eaba9cf (patch) | |
tree | 7f3f51d4987d871df9d734495c0510a2730cc223 /sbin/disklabel | |
parent | 611cd11b9b0b71643ab376833c2d19baf6608987 (diff) |
Group string comparisons and supply more helpful comments. Add
"total sectors" to "boundstart" and "boundend" in the list of fields
that are left alone during a RESTORE operation.
ok deraadt@
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/disklabel.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 7047ad7840d..acc149d61f0 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.168 2010/08/03 00:08:30 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.169 2010/08/03 00:19:42 krw Exp $ */ /* * Copyright (c) 1987, 1993 @@ -1175,38 +1175,22 @@ getasciilabel(FILE *f, struct disklabel *lp) } continue; } - if (!strcmp(cp, "rpm")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "interleave")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "trackskew")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "cylinderskew")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "headswitch")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "track-to-track seek")) { - /* ignore */ - continue; - } - if (!strcmp(cp, "boundstart")) { - /* ignore */ + + /* Ignore fields that are no longer in the disklabel. */ + if (!strcmp(cp, "rpm") || + !strcmp(cp, "interleave") || + !strcmp(cp, "trackskew") || + !strcmp(cp, "cylinderskew") || + !strcmp(cp, "headswitch") || + !strcmp(cp, "track-to-track seek")) continue; - } - if (!strcmp(cp, "boundend")) { - /* ignore */ + + /* Ignore fields that are forcibly set when label is read. */ + if (!strcmp(cp, "total sectors") || + !strcmp(cp, "boundstart") || + !strcmp(cp, "boundend")) continue; - } + if ('a' <= *cp && *cp <= 'z' && cp[1] == '\0') { unsigned int part = *cp - 'a'; |