Module Name:    src
Committed By:   martin
Date:           Fri Jan  6 18:19:27 UTC 2023

Modified Files:
        src/usr.sbin/sysinst: bsddisklabel.c label.c partitions.h

Log Message:
When matching real partitions to "wanted" install descriptions, skip
all types of special partitions (like raw disk, or the MBR container
partition for the NetBSD part of the disk).
The start of the partition is no unique identifier if we include these
in the matching (e.g. boot partition and raw partition may both start
at sector 0).


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/sysinst/partitions.h

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.71 src/usr.sbin/sysinst/bsddisklabel.c:1.72
--- src/usr.sbin/sysinst/bsddisklabel.c:1.71	Tue Dec 27 13:12:10 2022
+++ src/usr.sbin/sysinst/bsddisklabel.c	Fri Jan  6 18:19:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.71 2022/12/27 13:12:10 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.72 2023/01/06 18:19:27 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1703,6 +1703,8 @@ apply_settings_to_partitions(struct disk
 
 		if (!parts->pscheme->get_part_info(parts, pno, &t))
 			continue;
+		if (t.flags & PTI_SPECIAL_PARTS)
+			continue;
 
 		for (i = 0; i < wanted->num; i++) {
 			if (wanted->infos[i].cur_part_id != NO_PART)

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.47 src/usr.sbin/sysinst/label.c:1.48
--- src/usr.sbin/sysinst/label.c:1.47	Fri Jan  6 15:07:22 2023
+++ src/usr.sbin/sysinst/label.c	Fri Jan  6 18:19:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.47 2023/01/06 15:07:22 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.48 2023/01/06 18:19:27 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.47 2023/01/06 15:07:22 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.48 2023/01/06 18:19:27 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -74,9 +74,7 @@ boringpart(const struct disk_part_info *
 
 	if (info->size == 0)
 		return true;
-	if (info->flags &
-	     (PTI_PSCHEME_INTERNAL|PTI_WHOLE_DISK|PTI_SEC_CONTAINER|
-	     PTI_RAW_PART))
+	if (info->flags & PTI_SPECIAL_PARTS)
 		return true;
 
 	return false;
@@ -513,6 +511,9 @@ renumber_partitions(struct partition_usa
 				continue;
 			if (pset->infos[i].cur_flags != info.flags)
 				continue;
+			if ((info.flags & PTI_SPECIAL_PARTS) !=
+			    (pset->infos[i].flags & PTI_SPECIAL_PARTS))
+				continue;
 			if ((info.fs_type != FS_UNUSED &&
 			    info.fs_type == pset->infos[i].fs_type) ||
 			    (pset->infos[i].type ==

Index: src/usr.sbin/sysinst/partitions.h
diff -u src/usr.sbin/sysinst/partitions.h:1.28 src/usr.sbin/sysinst/partitions.h:1.29
--- src/usr.sbin/sysinst/partitions.h:1.28	Thu Jun  9 18:26:06 2022
+++ src/usr.sbin/sysinst/partitions.h	Fri Jan  6 18:19:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: partitions.h,v 1.28 2022/06/09 18:26:06 martin Exp $	*/
+/*	$NetBSD: partitions.h,v 1.29 2023/01/06 18:19:27 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -132,6 +132,9 @@ struct part_type_desc {
 						 * persistent; may only be
 						 * set for a single partition!
 						 */
+#define	PTI_SPECIAL_PARTS	\
+	(PTI_PSCHEME_INTERNAL|PTI_WHOLE_DISK|PTI_SEC_CONTAINER|PTI_RAW_PART)
+
 
 /* A single partition */
 struct disk_part_info {

Reply via email to