Module Name:    src
Committed By:   martin
Date:           Mon Oct 12 12:17:29 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
Previously we abused pm->ptstart / pm->ptsize to pass the bounds of the
NetBSD outer partition to the inner partition editor - but now this is
not a valid assumption any more, so explicitly fix the bounds if an
outer partition exists.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/bsddisklabel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.50 src/usr.sbin/sysinst/bsddisklabel.c:1.51
--- src/usr.sbin/sysinst/bsddisklabel.c:1.50	Fri Oct  9 18:33:00 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c	Mon Oct 12 12:17:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.50 2020/10/09 18:33:00 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.51 2020/10/12 12:17:29 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1701,6 +1701,7 @@ make_bsd_partitions(struct install_parti
 	struct disk_partitions *parts = pm->parts;
 	const struct disk_partitioning_scheme *pscheme;
 	struct partition_usage_set wanted;
+	daddr_t p_start, p_size;
 	enum layout_type layoutkind = LY_SETSIZES;
 	bool have_existing;
 
@@ -1777,11 +1778,20 @@ make_bsd_partitions(struct install_parti
 		layoutkind = ask_layout(parts, have_existing);
 	}
 
+	if (layoutkind == LY_USEDEFAULT || layoutkind == LY_SETSIZES) {
+		/* calc available disk area for the NetBSD partitions */
+		p_start = pm->ptstart;
+		p_size = pm->ptsize;
+		if (parts->parent != NULL && 
+		    parts->parent->pscheme->guess_install_target != NULL)
+			parts->parent->pscheme->guess_install_target(
+			    parts->parent, &p_start, &p_size);
+	}
 	if (layoutkind == LY_USEDEFAULT) {
-		replace_by_default(parts, pm->ptstart, pm->ptsize,
+		replace_by_default(parts, p_start, p_size,
 		    &wanted);
 	} else if (layoutkind == LY_SETSIZES) {
-		if (!edit_with_defaults(parts, pm->ptstart, pm->ptsize,
+		if (!edit_with_defaults(parts, p_start, p_size,
 		    &wanted)) {
 			free_usage_set(&wanted);
 			return false;

Reply via email to