Module Name:    src
Committed By:   martin
Date:           Mon Sep 28 18:40:24 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: README.md_defs disklabel.c partitions.c

Log Message:
PR 55378: do not assume RAW_PART to be either 2 or 3


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/README.md_defs
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/disklabel.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/partitions.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/README.md_defs
diff -u src/usr.sbin/sysinst/README.md_defs:1.4 src/usr.sbin/sysinst/README.md_defs:1.5
--- src/usr.sbin/sysinst/README.md_defs:1.4	Mon Jan 20 21:26:35 2020
+++ src/usr.sbin/sysinst/README.md_defs	Mon Sep 28 18:40:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: README.md_defs,v 1.4 2020/01/20 21:26:35 martin Exp $ */
+/* $NetBSD: README.md_defs,v 1.5 2020/09/28 18:40:23 martin Exp $ */
 
 The following is trying to document the most important machine dependent
 defines used in the sysinst code.
@@ -92,7 +92,7 @@ if something fails.
 
 HAVE_PLAIN_DISKLABEL_BOOT	may be undefined, only used on architectures
 				that have MBR as primary with disklabel as
-				secondary partitioning scheme (RAW_PART != 2)
+				secondary partitioning scheme (RAW_PART == 3)
 
 used like:
 

Index: src/usr.sbin/sysinst/disklabel.c
diff -u src/usr.sbin/sysinst/disklabel.c:1.37 src/usr.sbin/sysinst/disklabel.c:1.38
--- src/usr.sbin/sysinst/disklabel.c:1.37	Wed Feb 19 21:45:09 2020
+++ src/usr.sbin/sysinst/disklabel.c	Mon Sep 28 18:40:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.37 2020/02/19 21:45:09 martin Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.38 2020/09/28 18:40:23 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@ disklabel_parts_new(const char *dev, dad
 
 	strncpy(parts->l.d_packname, "fictious", sizeof parts->l.d_packname);
 
-#if RAW_PART > 2
+#if RAW_PART == 3
 	if (parts->dp.parent != NULL) {
 		parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
 		parts->l.d_partitions[RAW_PART-1].p_offset = start;
@@ -231,7 +231,7 @@ disklabel_parts_read(const char *disk, d
 		close(fd);
 		return NULL;
 	}
-#if RAW_PART > 2
+#if RAW_PART == 3
 	if (parts->l.d_partitions[RAW_PART-1].p_fstype == FS_UNUSED) {
 		daddr_t dlstart = parts->l.d_partitions[RAW_PART-1].p_offset;
 		daddr_t dlend = start +
@@ -467,7 +467,7 @@ disklabel_delete_all(struct disk_partiti
 	memset(&parts->l.d_partitions, 0, sizeof(parts->l.d_partitions));
 	parts->dp.num_part = 0;
 
-#if RAW_PART > 2
+#if RAW_PART == 3
 	if (parts->dp.parent != NULL) {
 		parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
 		parts->l.d_partitions[RAW_PART-1].p_offset =
@@ -501,7 +501,7 @@ disklabel_delete(struct disk_partitions 
 
 		if (ndx == id) {
 			if (part == RAW_PART
-#if RAW_PART > 2
+#if RAW_PART == 3
 				|| (part == RAW_PART-1 &&
 				    parts->dp.parent != NULL)
 #endif
@@ -543,7 +543,7 @@ disklabel_delete_range(struct disk_parti
 		daddr_t start = parts->l.d_partitions[part].p_offset;
 		daddr_t end = start + parts->l.d_partitions[part].p_size;
 
-#if RAW_PART > 2
+#if RAW_PART == 3
 		if (parts->dp.parent != NULL &&
 		    part == RAW_PART - 1 && start == r_start &&
 		    r_start + r_size == end)
@@ -759,7 +759,7 @@ disklabel_get_part_info(const struct dis
 			    parts->l.d_partitions[part].p_fstype == FS_UNUSED)
 				info->flags |=
 				    PTI_PSCHEME_INTERNAL|PTI_RAW_PART;
-#if RAW_PART > 2
+#if RAW_PART == 3
 			if (part == (RAW_PART-1) && parts->dp.parent != NULL &&
 			    parts->l.d_partitions[part].p_fstype == FS_UNUSED)
 				info->flags |=
@@ -906,7 +906,7 @@ disklabel_can_add_partition(const struct
 	for (i = 0; i < parts->l.d_npartitions; i++) {
 		if (i == RAW_PART)
 			continue;
-#if RAW_PART > 2
+#if RAW_PART == 3
 		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif
@@ -1061,7 +1061,7 @@ disklabel_add_partition(struct disk_part
 			continue;
 		if (i == RAW_PART)
 			continue;
-#if RAW_PART > 2
+#if RAW_PART == 3
 		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif
@@ -1124,7 +1124,7 @@ disklabel_add_outer_partition(struct dis
 			continue;
 		if (i == RAW_PART)
 			continue;
-#if RAW_PART > 2
+#if RAW_PART == 3
 		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif

Index: src/usr.sbin/sysinst/partitions.c
diff -u src/usr.sbin/sysinst/partitions.c:1.10 src/usr.sbin/sysinst/partitions.c:1.11
--- src/usr.sbin/sysinst/partitions.c:1.10	Tue Jan 28 07:43:42 2020
+++ src/usr.sbin/sysinst/partitions.c	Mon Sep 28 18:40:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: partitions.c,v 1.10 2020/01/28 07:43:42 martin Exp $	*/
+/*	$NetBSD: partitions.c,v 1.11 2020/09/28 18:40:23 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@ extern const struct disk_partitioning_sc
 extern const struct disk_partitioning_scheme mbr_parts;
 #endif
 
-#if RAW_PART != 2
+#if RAW_PART == 3
 static struct disk_partitioning_scheme only_disklabel_parts;
 
 /*
@@ -163,7 +163,7 @@ partitions_init(void)
 	 * only offer very few entries.
 	 */
 static const struct part_scheme_desc all_descs[] = {
-#if RAW_PART == 2	/* only available as primary on some architectures */
+#if RAW_PART != 3	/* only available as primary on some architectures */
 		{ NULL, &disklabel_parts },
 #endif
 #ifdef HAVE_GPT
@@ -172,7 +172,7 @@ static const struct part_scheme_desc all
 #ifdef HAVE_MBR
 		{ NULL, &mbr_parts },
 #endif
-#if RAW_PART != 2	/* "whole disk NetBSD" disklabel variant */
+#if RAW_PART == 3	/* "whole disk NetBSD" disklabel variant */
 		{ NULL, &only_disklabel_parts },
 #endif
 	};
@@ -184,7 +184,7 @@ static const struct part_scheme_desc all
 
 	check_available_binaries();
 
-#if RAW_PART != 2
+#if RAW_PART == 3
 	/* generate a variant of disklabel w/o parent scheme */
 	only_disklabel_parts = disklabel_parts;
 	only_disklabel_parts.name = MSG_parttype_only_disklabel;

Reply via email to