diff options
author | Bruce Evans <bde@FreeBSD.org> | 1996-11-04 17:40:43 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1996-11-04 17:40:43 +0000 |
commit | fd25850c96c9c7ab6a188808a24059201985c5c0 (patch) | |
tree | 138165b6e9c251bb3a08c526b9aa4999e423a674 /sys/kern/subr_diskmbr.c | |
parent | 2ceaae21e92b7ab5138c14907e6f1ee8e647b558 (diff) | |
download | src-fd25850c96c9c7ab6a188808a24059201985c5c0.tar.gz src-fd25850c96c9c7ab6a188808a24059201985c5c0.zip |
Don't clobber max_ncyls, ending up guessing thetotal number of cylinders as
the number in the 4th slot.
Fixes PR 1893.
Should be in 2.1.5 and 2.2.
Notes
Notes:
svn path=/head/; revision=19396
Diffstat (limited to 'sys/kern/subr_diskmbr.c')
-rw-r--r-- | sys/kern/subr_diskmbr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index 595898c11e14..509b05aac0a0 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.20 1996/04/07 17:32:09 bde Exp $ + * $Id: diskslice_machdep.c,v 1.21 1996/09/20 17:39:11 bde Exp $ */ #include <stddef.h> @@ -246,12 +246,13 @@ reread_mbr: max_nsectors = 0; max_ntracks = 0; for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) { + int ncyls; int nsectors; int ntracks; - max_ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect); - if (max_ncyls < max_ncyls) - max_ncyls = max_ncyls; + ncyls = DPCYL(dp->dp_ecyl, dp->dp_esect) + 1; + if (max_ncyls < ncyls) + max_ncyls = ncyls; nsectors = DPSECT(dp->dp_esect); if (max_nsectors < nsectors) max_nsectors = nsectors; @@ -260,7 +261,10 @@ reread_mbr: max_ntracks = ntracks; } - /* Check the geometry. */ + /* + * Check that we have guessed the geometry right by checking the + * partition entries. + */ /* * TODO: * As above. @@ -268,7 +272,6 @@ reread_mbr: * Check against d_secperunit if the latter is reliable. */ error = 0; - secpercyl = (u_long)max_nsectors * max_ntracks; for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++) { if (dp->dp_scyl == 0 && dp->dp_shd == 0 && dp->dp_ssect == 0 && dp->dp_start == 0 && dp->dp_size == 0) @@ -294,6 +297,7 @@ reread_mbr: * First adjust the label (we have been careful not to change it * before we can guarantee success). */ + secpercyl = (u_long)max_nsectors * max_ntracks; if (secpercyl != 0) { u_long secperunit; |