Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst PR install/54582: allow MD code to disable ...
details: https://anonhg.NetBSD.org/src/rev/d2a65c5a02e7
branches: trunk
changeset: 466045:d2a65c5a02e7
user: martin <martin%NetBSD.org@localhost>
date: Mon Dec 09 19:16:53 2019 +0000
description:
PR install/54582: allow MD code to disable on-disk presence verification
of "real" disklabels. Auto-enable this (at run time) when there is no other
partitioning scheme but disklabel configured.
Hard-coded enable this for x68k to allow using kernel based translations
for native Human68k partitions.
diffstat:
usr.sbin/sysinst/README.md_defs | 9 ++++++++-
usr.sbin/sysinst/arch/x68k/md.h | 9 ++++++++-
usr.sbin/sysinst/disklabel.c | 16 ++++++++++++----
usr.sbin/sysinst/partitions.c | 16 +++++++++++++++-
usr.sbin/sysinst/partitions.h | 4 +++-
5 files changed, 46 insertions(+), 8 deletions(-)
diffs (115 lines):
diff -r e634e96d72f9 -r d2a65c5a02e7 usr.sbin/sysinst/README.md_defs
--- a/usr.sbin/sysinst/README.md_defs Mon Dec 09 16:19:11 2019 +0000
+++ b/usr.sbin/sysinst/README.md_defs Mon Dec 09 19:16:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: README.md_defs,v 1.1 2019/08/14 12:49:37 martin Exp $ */
+/* $NetBSD: README.md_defs,v 1.2 2019/12/09 19:16:53 martin Exp $ */
The following is trying to document the most important machine dependent
defines used in the sysinst code.
@@ -83,3 +83,10 @@
returns true if the disk could be made bootable with only a disklabel
(and no MBR).
+
+DISKLABEL_NO_ONDISK_VERIFY usually undefined
+
+If defined, do not verify the presence of on-disk disklabels before
+offering the disklabel partitioning scheme. This allows ports to use
+kernel translation for the disklabel ioctls (e.g. x86k uses Human68k
+partitions this way).
diff -r e634e96d72f9 -r d2a65c5a02e7 usr.sbin/sysinst/arch/x68k/md.h
--- a/usr.sbin/sysinst/arch/x68k/md.h Mon Dec 09 16:19:11 2019 +0000
+++ b/usr.sbin/sysinst/arch/x68k/md.h Mon Dec 09 19:16:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.h,v 1.3 2019/10/02 11:16:04 maya Exp $ */
+/* $NetBSD: md.h,v 1.4 2019/12/09 19:16:53 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -89,3 +89,10 @@
* On x68k, do what the 1.2 install scripts did.
*/
#define DISKLABEL_CMD "disklabel -w"
+
+/*
+ * We rely on kernel support to translate Human68k partitions
+ * to in-core disklabels, so we can not check for existance of "real"
+ * disklabels on-disk before offering disklabel partitions.
+ */
+#define DISKLABEL_NO_ONDISK_VERIFY 1
diff -r e634e96d72f9 -r d2a65c5a02e7 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c Mon Dec 09 16:19:11 2019 +0000
+++ b/usr.sbin/sysinst/disklabel.c Mon Dec 09 19:16:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.17 2019/12/07 13:33:45 martin Exp $ */
+/* $NetBSD: disklabel.c,v 1.18 2019/12/09 19:16:53 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -171,9 +171,17 @@
char diskpath[MAXPATHLEN];
uint flags;
- if (run_program(RUN_SILENT | RUN_ERROR_OK,
- "disklabel -r %s", disk) != 0)
- return NULL;
+#ifndef DISKLABEL_NO_ONDISK_VERIFY
+ if (!only_have_disklabel()) {
+ /*
+ * If there are alternative partitioning schemes,
+ * verify we really have a disklabel.
+ */
+ if (run_program(RUN_SILENT | RUN_ERROR_OK,
+ "disklabel -r %s", disk) != 0)
+ return NULL;
+ }
+#endif
/* read partitions */
diff -r e634e96d72f9 -r d2a65c5a02e7 usr.sbin/sysinst/partitions.c
--- a/usr.sbin/sysinst/partitions.c Mon Dec 09 16:19:11 2019 +0000
+++ b/usr.sbin/sysinst/partitions.c Mon Dec 09 19:16:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partitions.c,v 1.5 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: partitions.c,v 1.6 2019/12/09 19:16:53 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -129,6 +129,20 @@
}
#endif
+bool
+only_have_disklabel(void)
+{
+
+ if (num_available_part_schemes > 1)
+ return false;
+
+#if RAW_PART != 2
+ if (available_part_schemes[0] == &only_disklabel_parts)
+ return true;
+#endif
+ return available_part_schemes[0] == &disklabel_parts;
+}
+
/*
* One time initialization
*/
diff -r e634e96d72f9 -r d2a65c5a02e7 usr.sbin/sysinst/partitions.h
--- a/usr.sbin/sysinst/partitions.h Mon Dec 09 16:19:11 2019 +0000
+++ b/usr.sbin/sysinst/partitions.h Mon Dec 09 19:16:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partitions.h,v 1.8 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: partitions.h,v 1.9 2019/12/09 19:16:53 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -579,3 +579,5 @@
*/
void partitions_init(void);
void partitions_cleanup(void);
+bool only_have_disklabel(void);
+
Home |
Main Index |
Thread Index |
Old Index