Module Name: src
Committed By: martin
Date: Tue Jan 28 07:43:42 UTC 2020
Modified Files:
src/usr.sbin/sysinst: partitions.c
Log Message:
Too much disklabel magic happening in the kernel - to compensate force
MBR first when trying to identify the existing partitioning scheme of
a disk.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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/partitions.c
diff -u src/usr.sbin/sysinst/partitions.c:1.9 src/usr.sbin/sysinst/partitions.c:1.10
--- src/usr.sbin/sysinst/partitions.c:1.9 Mon Jan 27 21:21:22 2020
+++ src/usr.sbin/sysinst/partitions.c Tue Jan 28 07:43:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: partitions.c,v 1.9 2020/01/27 21:21:22 martin Exp $ */
+/* $NetBSD: partitions.c,v 1.10 2020/01/28 07:43:42 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -41,6 +41,8 @@ const struct disk_partitioning_scheme **
*/
size_t num_available_part_schemes;
+extern const struct disk_partitioning_scheme disklabel_parts;
+
/*
* Generic reader - query a disk device and read all partitions from it.
* disk_size is in units of physical sector size, which is passe as
@@ -51,14 +53,23 @@ partitions_read_disk(const char *dev, da
bool no_mbr)
{
const struct disk_partitioning_scheme **ps;
+#ifdef HAVE_MBR
+ bool mbr_done = false, disklabel_done = false;
+#endif
if (!available_part_schemes)
return NULL;
for (ps = available_part_schemes; *ps; ps++) {
#ifdef HAVE_MBR
+ if (!no_mbr && (*ps) == &disklabel_parts && !mbr_done)
+ continue;
if (no_mbr && (*ps)->name == MSG_parttype_mbr)
continue;
+ if ((*ps)->name == MSG_parttype_mbr)
+ mbr_done = true;
+ if ((*ps)->read_from_disk == disklabel_parts.read_from_disk)
+ disklabel_done = true;
#endif
struct disk_partitions *parts =
(*ps)->read_from_disk(dev, 0, disk_size, bytes_per_sec,
@@ -66,6 +77,11 @@ partitions_read_disk(const char *dev, da
if (parts)
return parts;
}
+#ifdef HAVE_MBR
+ if (!disklabel_done)
+ return disklabel_parts.read_from_disk(dev, 0, disk_size,
+ bytes_per_sec, &disklabel_parts);
+#endif
return NULL;
}
@@ -117,7 +133,6 @@ extern const struct disk_partitioning_sc
extern const struct disk_partitioning_scheme mbr_parts;
#endif
-extern const struct disk_partitioning_scheme disklabel_parts;
#if RAW_PART != 2
static struct disk_partitioning_scheme only_disklabel_parts;