From: Matthew Dillon Date: Tue, 24 Jul 2007 19:48:44 +0000 (+0000) Subject: Add logic to allow the first hog partition to specify a base offset. This X-Git-Tag: v2.0.1~2540 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/b00e432b0f61bd48806d5d48e0963e5badee3043 Add logic to allow the first hog partition to specify a base offset. This fixes a partition-too-large error when creating a hog partition with a non-zero base offset. --- diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 096405a9c6..1fee8f9d16 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -37,7 +37,7 @@ * @(#)disklabel.c 1.2 (Symmetric) 11/28/85 * @(#)disklabel.c 8.2 (Berkeley) 1/7/94 * $FreeBSD: src/sbin/disklabel/disklabel.c,v 1.28.2.15 2003/01/24 16:18:16 des Exp $ - * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.23 2007/06/19 19:07:41 dillon Exp $ + * $DragonFly: src/sbin/disklabel/disklabel.c,v 1.24 2007/07/24 19:48:43 dillon Exp $ */ #include @@ -1262,10 +1262,15 @@ checklabel(struct disklabel32 *lp) for (i = 0; i < lp->d_npartitions; i++) { pp = &lp->d_partitions[i]; if (part_set[i]) { + if (part_size_type[i] == '*') { if (i == RAW_PART) { pp->p_size = lp->d_secperunit; } else { + if (part_offset_type[i] != '*') { + if (total_size < pp->p_offset) + total_size = pp->p_offset; + } if (hog_part != -1) Warning("Too many '*' partitions (%c and %c)", hog_part + 'a',i + 'a'); diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c index d6a69525cc..c09a7b4ad9 100644 --- a/sbin/disklabel64/disklabel64.c +++ b/sbin/disklabel64/disklabel64.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.2 2007/06/19 06:38:33 dillon Exp $ + * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.3 2007/07/24 19:48:44 dillon Exp $ */ /* * Copyright (c) 1987, 1993 @@ -71,7 +71,7 @@ * @(#)disklabel.c 1.2 (Symmetric) 11/28/85 * @(#)disklabel.c 8.2 (Berkeley) 1/7/94 * $FreeBSD: src/sbin/disklabel/disklabel.c,v 1.28.2.15 2003/01/24 16:18:16 des Exp $ - * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.2 2007/06/19 06:38:33 dillon Exp $ + * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.3 2007/07/24 19:48:44 dillon Exp $ */ #include @@ -1282,11 +1282,16 @@ checklabel(struct disklabel64 *lp) pp = &lp->d_partitions[i]; if (part_set[i]) { if (part_size_type[i] == '*') { - if (hog_part != -1) + if (part_offset_type[i] != '*') { + if (total_size < pp->p_boffset) + total_size = pp->p_boffset; + } + if (hog_part != -1) { Warning("Too many '*' partitions (%c and %c)", hog_part + 'a',i + 'a'); - else + } else { hog_part = i; + } } else { off_t size;