Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Provide a disklabel specific MD hook MD_DIS...



details:   https://anonhg.NetBSD.org/src/rev/940807bba1c7
branches:  trunk
changeset: 372932:940807bba1c7
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 06 15:05:52 2023 +0000

description:
Provide a disklabel specific MD hook MD_DISKLABEL_PART_INDEX_CHECK
to allow MD code to veto specific disklabel partitions for specific
uses, e.g. to make sure a boot partition does not end up as sd0a.
Most architectures won't need this, as the file system type makes
the generic heuristic do the right thing (e.g. move the ESP to wd0e
for x86) - but for some architectures the boot partition uses FFS
and our heuristic fails.

diffstat:

 usr.sbin/sysinst/README.md_defs |  14 +++++++++++++-
 usr.sbin/sysinst/disklabel.c    |   6 +++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 842323e696df -r 940807bba1c7 usr.sbin/sysinst/README.md_defs
--- a/usr.sbin/sysinst/README.md_defs   Fri Jan 06 10:28:27 2023 +0000
+++ b/usr.sbin/sysinst/README.md_defs   Fri Jan 06 15:05:52 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: README.md_defs,v 1.7 2021/09/11 20:28:06 andvar Exp $ */
+/* $NetBSD: README.md_defs,v 1.8 2023/01/06 15:05:52 martin Exp $ */
 
 The following is trying to document the most important machine dependent
 defines used in the sysinst code.
@@ -117,3 +117,15 @@
 
 NO_DISKLABEL_BOOT              defined if the architecture can NOT boot
                                from a disklabel partitioned disk
+
+MD_DISKLABEL_PART_INDEX_CHECK  usually undefined
+
+                               if defined evaluates to a boolean attribute
+                               which is passed a struct disklabel, an integer
+                               index and a const struct disk_part_info*.
+                               The result qualifies the given new partition
+                               to take the disklabel l_partition entry
+                               with the given index. Used for example
+                               in luna68k to move the FFSv1 boot partition
+                               (which would otherwise end up as partition 'a')
+                               to a partition past RAW_PART (so 'd' on luna68k)
diff -r 842323e696df -r 940807bba1c7 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Fri Jan 06 10:28:27 2023 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Fri Jan 06 15:05:52 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.50 2022/12/11 19:32:57 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.51 2023/01/06 15:05:52 martin Exp $    */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -1130,6 +1130,10 @@
 #endif
                if (parts->l.d_partitions[i].p_size > 0)
                        continue;
+#ifdef MD_DISKLABEL_PART_INDEX_CHECK
+               if (!MD_DISKLABEL_PART_INDEX_CHECK(&parts->l, i, info))
+                       continue;
+#endif
                part = i;
                break;
        }



Home | Main Index | Thread Index | Old Index