Include the total number of sectors in the text representation of

the label; calculating based on the disk geometry is not always
accurate (notably, for SCSI disks).  Also be a bit more careful
about printing out fixed-width types.
This commit is contained in:
ghudson 1996-03-14 19:49:24 +00:00
parent 9a07d9dec9
commit 6f4ec6284f
1 changed files with 25 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel.c,v 1.29 1995/06/26 23:17:26 jtc Exp $ */
/* $NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $ */
/*
* Copyright (c) 1987, 1993
@ -47,7 +47,7 @@ static char copyright[] =
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 1/7/94";
#else
static char rcsid[] = "$NetBSD: disklabel.c,v 1.29 1995/06/26 23:17:26 jtc Exp $";
static char rcsid[] = "$NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $";
#endif
#endif /* not lint */
@ -775,17 +775,20 @@ display(f, lp)
if (lp->d_flags & D_BADSECT)
fprintf(f, " badsect");
fprintf(f, "\n");
fprintf(f, "bytes/sector: %d\n", lp->d_secsize);
fprintf(f, "sectors/track: %d\n", lp->d_nsectors);
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, "rpm: %d\n", lp->d_rpm);
fprintf(f, "interleave: %d\n", lp->d_interleave);
fprintf(f, "trackskew: %d\n", lp->d_trackskew);
fprintf(f, "cylinderskew: %d\n", lp->d_cylskew);
fprintf(f, "headswitch: %d\t\t# milliseconds\n", lp->d_headswitch);
fprintf(f, "track-to-track seek: %d\t# milliseconds\n", lp->d_trkseek);
fprintf(f, "bytes/sector: %ld\n", (long) lp->d_secsize);
fprintf(f, "sectors/track: %ld\n", (long) lp->d_nsectors);
fprintf(f, "tracks/cylinder: %ld\n", (long) lp->d_ntracks);
fprintf(f, "sectors/cylinder: %ld\n", (long) lp->d_secpercyl);
fprintf(f, "cylinders: %ld\n", (long) lp->d_ncylinders);
fprintf(f, "total sectors: %ld\n", (long) lp->d_secperunit);
fprintf(f, "rpm: %ld\n", (long) lp->d_rpm);
fprintf(f, "interleave: %ld\n", (long) lp->d_interleave);
fprintf(f, "trackskew: %ld\n", (long) lp->d_trackskew);
fprintf(f, "cylinderskew: %ld\n", (long) lp->d_cylskew);
fprintf(f, "headswitch: %ld\t\t# milliseconds\n",
(long) lp->d_headswitch);
fprintf(f, "track-to-track seek: %ld\t# milliseconds\n",
(long) lp->d_trkseek);
fprintf(f, "drivedata: ");
for (i = NDDATA - 1; i >= 0; i--)
if (lp->d_drivedata[i])
@ -1092,6 +1095,15 @@ getasciilabel(f, lp)
lp->d_ncylinders = v;
continue;
}
if (!strcmp(cp, "total sectors")) {
v = atoi(tp);
if (v <= 0) {
warnx("line %d: bad %s: %s", lineno, cp, tp);
errors++;
} else
lp->d_secperunit = v;
continue;
}
if (!strcmp(cp, "rpm")) {
v = atoi(tp);
if (v <= 0) {