diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-04-23 15:25:22 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-04-23 15:25:22 +0000 |
commit | 38fc778c9782dbaa70fa6da92cfd8daaaa43d6fe (patch) | |
tree | ae3cdf39a2c58715ddd572c6ba0e0e6d72ea4ce2 /sbin/disklabel | |
parent | ed069888a3c009f9af5ecffb1dd73b037a5b95c2 (diff) |
Recycle unused disklabel fields in order to create a disklabel unique
identifier, allowing the disk to be identified without relying on the
device name.
ok deraadt@ krw@ beck@ marco@ todd@
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/disklabel.c | 28 | ||||
-rw-r--r-- | sbin/disklabel/editor.c | 38 |
2 files changed, 4 insertions, 62 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index aa0418e044d..139f56a4581 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.160 2009/10/27 23:59:32 deraadt Exp $ */ +/* $OpenBSD: disklabel.c,v 1.161 2010/04/23 15:25:21 jsing Exp $ */ /* * Copyright (c) 1987, 1993 @@ -616,14 +616,6 @@ makedisktab(FILE *f, struct disklabel *lp) (void)fprintf(f, "sc#%u:", lp->d_secpercyl); (void)fprintf(f, "su#%llu:", DL_GETDSIZE(lp)); - if (lp->d_rpm != 3600) { - (void)fprintf(f, "%srm#%hu:", did, lp->d_rpm); - did = ""; - } - if (lp->d_interleave != 1) { - (void)fprintf(f, "%sil#%hu:", did, lp->d_interleave); - did = ""; - } /* * XXX We do not print have disktab information yet for * XXX DL_GETBSTART DL_GETBEND @@ -798,8 +790,6 @@ display(FILE *f, struct disklabel *lp, char unit, int all) d, unit); fprintf(f, "\n"); - fprintf(f, "rpm: %hu\n", lp->d_rpm); - fprintf(f, "interleave: %hu\n", lp->d_interleave); fprintf(f, "boundstart: %llu\n", DL_GETBSTART(lp)); fprintf(f, "boundend: %llu\n", DL_GETBEND(lp)); fprintf(f, "drivedata: "); @@ -1134,21 +1124,11 @@ getasciilabel(FILE *f, struct disklabel *lp) continue; } if (!strcmp(cp, "rpm")) { - v = GETNUM(lp->d_rpm, tp, 1, &errstr); - if (errstr) { - warnx("line %d: bad %s: %s", lineno, cp, tp); - errors++; - } else - lp->d_rpm = v; + /* ignore */ continue; } if (!strcmp(cp, "interleave")) { - v = GETNUM(lp->d_interleave, tp, 1, &errstr); - if (errstr) { - warnx("line %d: bad %s: %s", lineno, cp, tp); - errors++; - } else - lp->d_interleave = v; + /* ignore */ continue; } if (!strcmp(cp, "trackskew")) { @@ -1299,8 +1279,6 @@ checklabel(struct disklabel *lp) warnx("cylinders/unit %d", lp->d_ncylinders); errors++; } - if (lp->d_rpm == 0) - warnx("warning, revolutions/minute %d", lp->d_rpm); if (lp->d_secpercyl == 0) lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; if (DL_GETDSIZE(lp) == 0) diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index f95feeed54c..85362641e2a 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.234 2010/04/21 03:35:41 lum Exp $ */ +/* $OpenBSD: editor.c,v 1.235 2010/04/23 15:25:21 jsing Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -212,10 +212,6 @@ editor(struct disklabel *lp, int f) if (label.d_sbsize == 0) label.d_sbsize = SBSIZE; - /* Interleave must be >= 1 */ - if (label.d_interleave == 0) - label.d_interleave = 1; - /* Save the (U|u)ndo labels and mountpoints. */ mpcopy(origmountpoints, mountpoints); origlabel = label; @@ -1457,38 +1453,6 @@ edit_parms(struct disklabel *lp) if (ending_sector > ui) ending_sector = ui; DL_SETDSIZE(lp, ui); - - /* rpm */ - for (;;) { - ui = getuint(lp, "rpm", - "The rotational speed of the disk in revolutions per minute.", - lp->d_rpm, lp->d_rpm, 0, 0); - if (ui == ULLONG_MAX - 1) { - fputs("Command aborted\n", stderr); - *lp = oldlabel; /* undo damage */ - return; - } else if (ui == ULLONG_MAX) - fputs("Invalid entry\n", stderr); - else - break; - } - lp->d_rpm = ui; - - /* interleave */ - for (;;) { - ui = getuint(lp, "interleave", - "The physical sector interleave, set when formatting. Almost always 1.", - lp->d_interleave, lp->d_interleave, 0, 0); - if (ui == ULLONG_MAX - 1) { - fputs("Command aborted\n", stderr); - *lp = oldlabel; /* undo damage */ - return; - } else if (ui == ULLONG_MAX || ui == 0) - fputs("Invalid entry\n", stderr); - else - break; - } - lp->d_interleave = ui; } struct partition ** |