From: krw Date: Tue, 3 Aug 2010 00:19:42 +0000 (+0000) Subject: Group string comparisons and supply more helpful comments. Add X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ecc042652190c87185e567e2f3099cfc45951bea;p=openbsd 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@ --- 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';