diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-06 22:14:33 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-06 22:14:33 +0000 |
commit | 848c41bdfbd7fce5fd07bdaf8ac5e7ba5ac60aee (patch) | |
tree | b573977d7e07266977ccb7241ea66a343cc63c9f | |
parent | aec7c452bd9ea15493327c9356a66a1ba19cc99c (diff) |
clamp the disklabel d_secperunit to what the disk actually says it has,
not to what some bogus disklabel from the past may say (some of which
may have been caused by older openbsd disklabel programs). resolves
issues seen by myself and Markus Lude on sparc/sparc64 machines
-rw-r--r-- | sys/arch/luna88k/luna88k/disksubr.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/disksubr.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c index 298c516f1dd..0558c80e0f2 100644 --- a/sys/arch/luna88k/luna88k/disksubr.c +++ b/sys/arch/luna88k/luna88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.17 2007/06/06 16:42:06 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.18 2007/06/06 22:14:29 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */ /* @@ -406,7 +406,8 @@ disklabel_om_to_bsd(char *cp, struct disklabel *lp) secpercyl = sl->sl_nsectors * sl->sl_ntracks; lp->d_secpercyl = secpercyl; - DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); + if (DL_GETDSIZE(lp) == 0) + DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); lp->d_sparespercyl = 0; /* no way to know */ lp->d_acylinders = sl->sl_acylinders; diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 23d2aade52c..9b7e8c15f3e 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.51 2007/06/06 16:42:06 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.52 2007/06/06 22:14:31 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -402,7 +402,8 @@ disklabel_sun_to_bsd(char *cp, struct disklabel *lp) secpercyl = sl->sl_nsectors * sl->sl_ntracks; lp->d_secpercyl = secpercyl; - DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); + if (DL_GETDSIZE(lp) == 0) + DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); lp->d_version = 1; /* 48 bit addressing */ lp->d_sparespercyl = sl->sl_sparespercyl; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index bffd4adbc90..c12b448aa80 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.30 2007/06/06 16:42:06 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.31 2007/06/06 22:14:32 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -401,7 +401,8 @@ disklabel_sun_to_bsd(char *cp, struct disklabel *lp) secpercyl = sl->sl_nsectors * sl->sl_ntracks; lp->d_secpercyl = secpercyl; - DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); + if (DL_GETDSIZE(lp) == 0) + DL_SETDSIZE(lp, (daddr64_t)secpercyl * sl->sl_ncylinders); lp->d_version = 1; /* 48 bit addressing */ lp->d_sparespercyl = sl->sl_sparespercyl; |