From e55d5d3716f96764f85c283761adf6d7f778a23f Mon Sep 17 00:00:00 2001 From: bde Date: Wed, 22 Feb 1995 23:21:29 +0000 Subject: Don't clobber d_secperunit in `disklabel -e'. `disklabel -e' replaces all the values that it doesn't print by defaults. This seems wrong. I want to be able to see the total number of sectors more than edit it. The default d_secperunit of (sectors/track * tracks/cylinder * cylinders) is bogus if sectors/track is only an approximation and more bogus if sectors/track and tracks/cylinder are dummy values such as 4096 and 1 to defeat ufs's pessimizations. --- sbin/disklabel/disklabel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sbin/disklabel') diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index efcbbf2..e5ae274 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -663,6 +663,7 @@ display(f, lp) fprintf(f, "tracks/cylinder: %d\n", lp->d_ntracks); fprintf(f, "sectors/cylinder: %d\n", lp->d_secpercyl); fprintf(f, "cylinders: %d\n", lp->d_ncylinders); + fprintf(f, "sectors/unit: %d\n", lp->d_secperunit); fprintf(f, "rpm: %d\n", lp->d_rpm); fprintf(f, "interleave: %d\n", lp->d_interleave); fprintf(f, "trackskew: %d\n", lp->d_trackskew); @@ -989,6 +990,16 @@ getasciilabel(f, lp) lp->d_ncylinders = v; continue; } + if (streq(cp, "sectors/unit")) { + v = atoi(tp); + if (v <= 0) { + fprintf(stderr, "line %d: %s: bad %s\n", + lineno, tp, cp); + errors++; + } else + lp->d_secperunit = v; + continue; + } if (streq(cp, "rpm")) { v = atoi(tp); if (v <= 0) { -- cgit v1.1