Module Name:    src
Committed By:   martin
Date:           Tue Jul  9 16:14:46 UTC 2019

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

Log Message:
When editing outer partitions:
 - when there are no outer partitions to edit, just report success and go
   on, instead of failing an assertion.
 - use the partitions passed as argument and avoid refering (the hopefully
   same set) via the global pm device pointer.

When checking for pre-exisiting partitions, skip non-user partitions
(like the raw partition in disklabel, or extended partitions in MBR).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/part_edit.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/part_edit.c
diff -u src/usr.sbin/sysinst/part_edit.c:1.5 src/usr.sbin/sysinst/part_edit.c:1.6
--- src/usr.sbin/sysinst/part_edit.c:1.5	Sat Jun 22 20:46:07 2019
+++ src/usr.sbin/sysinst/part_edit.c	Tue Jul  9 16:14:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: part_edit.c,v 1.5 2019/06/22 20:46:07 christos Exp $ */
+/*	$NetBSD: part_edit.c,v 1.6 2019/07/09 16:14:46 martin Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -1085,24 +1085,25 @@ edit_outer_parts(struct disk_partitions 
 	if (pm && (pm->no_part || pm->no_mbr))
 		return true;
 
-	/* Make sure pm has been properly initialized */
-	assert(pm->parts && pm->parts->pscheme);
+	/* Make sure parts has been properly initialized */
+	assert(parts && parts->pscheme);
 
-	if (partman_go)
+	if (parts->pscheme->secondary_scheme == NULL)
+		return true;	/* no outer parts */
+
+	if (partman_go) {
 		layout = LY_SETSIZES;
-	else {
+	} else {
 		/* Ask full/part */
 		const struct disk_partitioning_scheme *sec =
-		    pm->parts->pscheme->secondary_scheme;
-
-		assert(sec != NULL);
+		    parts->pscheme->secondary_scheme;
 
 		uint64_t m_size =
 		    DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB;
 		char min_size[5], build_size[5];
 		const char
-		    *prim_name = msg_string(pm->parts->pscheme->name),
-		    *prim_short = msg_string(pm->parts->pscheme->short_name),
+		    *prim_name = msg_string(parts->pscheme->name),
+		    *prim_short = msg_string(parts->pscheme->short_name),
 		    *sec_name = msg_string(sec->name),
 		    *sec_short = msg_string(sec->short_name);
 
@@ -1120,7 +1121,7 @@ edit_outer_parts(struct disk_partitions 
 		    min_size, build_size);
 		msg_display_add("\n\n");
 
-		layout = ask_fullpart(pm->parts);
+		layout = ask_fullpart(parts);
 	}
 
 	if (layout == LY_USEFULL) {
@@ -1133,6 +1134,8 @@ edit_outer_parts(struct disk_partitions 
 				continue;
 			if (info.size == 0)
 				continue;
+			if (info.flags & (PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
+				continue;
 			if (info.nat_type != NULL
 			    && info.nat_type->generic_ptype != PT_root
 			    && info.nat_type->generic_ptype != PT_swap)

Reply via email to