From: miod Date: Fri, 16 Jan 2015 20:17:05 +0000 (+0000) Subject: disklabel_sun_to_bsd() will nicely set the disk size if it is zero, but it is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=af4e92ef158e8b3985680801d7c817543d8f43c7;p=openbsd 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@ --- 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;