summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-01-16 20:17:07 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-01-16 20:17:07 +0000
commit428a0180af65897e44fa714af4f8cad08b6fff18 (patch)
tree050e194c1b76c2b27f9a8f4cf28bfa6436b9cd82 /sys/arch
parent86abdf609155429284902baf57e4fb5f0dec7f45 (diff)
disklabel_sun_to_bsd() will nicely set the disk size if it is zero, but it is
usually invoked after initdisklabel() which proactively changes a zero disk size to MAXDISKSIZE, causing this test to fail. Allow for MAXDISKSIZE too in that test. This makes spoofed disklabels of SMD disks have a proper `c' slice size. luna88k disklabel_om_to_bsd() is modified accordingly, to keep diffability, even though luna88k can't - to the best of my knowledge - sport SMD disk controllers. ok deraadt@ krw@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/luna88k/luna88k/disksubr.c5
-rw-r--r--sys/arch/sparc/sparc/disksubr.c5
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c
index ed83d8a753f..8a733e5a189 100644
--- a/sys/arch/luna88k/luna88k/disksubr.c
+++ b/sys/arch/luna88k/luna88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.56 2013/10/20 10:11:16 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.57 2015/01/16 20:17:05 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */
/*
@@ -274,7 +274,8 @@ disklabel_om_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
secpercyl = sl->sl_nsectors * sl->sl_ntracks;
lp->d_secpercyl = secpercyl;
- if (DL_GETDSIZE(lp) == 0)
+ /* If unset or initialized as full disk, permit refinement */
+ if (DL_GETDSIZE(lp) == 0 || DL_GETDSIZE(lp) == MAXDISKSIZE)
DL_SETDSIZE(lp, (u_int64_t)secpercyl * sl->sl_ncylinders);
lp->d_version = 1;
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 05f1cea89fe..0b83451fbb3 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.92 2013/10/20 10:11:16 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.93 2015/01/16 20:17:05 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -262,7 +262,8 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
secpercyl = sl->sl_nsectors * sl->sl_ntracks;
lp->d_secpercyl = secpercyl;
- if (DL_GETDSIZE(lp) == 0)
+ /* If unset or initialized as full disk, permit refinement */
+ if (DL_GETDSIZE(lp) == 0 || DL_GETDSIZE(lp) == MAXDISKSIZE)
DL_SETDSIZE(lp, (u_int64_t)secpercyl * sl->sl_ncylinders);
lp->d_version = 1;
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index 47828bd497f..23398a022db 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.68 2013/10/20 10:11:17 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.69 2015/01/16 20:17:06 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -252,7 +252,8 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
secpercyl = sl->sl_nsectors * sl->sl_ntracks;
lp->d_secpercyl = secpercyl;
- if (DL_GETDSIZE(lp) == 0)
+ /* If unset or initialized as full disk, permit refinement */
+ if (DL_GETDSIZE(lp) == 0 || DL_GETDSIZE(lp) == MAXDISKSIZE)
DL_SETDSIZE(lp, (u_int64_t)secpercyl * sl->sl_ncylinders);
lp->d_version = 1;