Module Name: src Committed By: martin Date: Fri Jan 6 15:05:52 UTC 2023
Modified Files: src/usr.sbin/sysinst: README.md_defs disklabel.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/README.md_defs cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/sysinst/disklabel.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.7 src/usr.sbin/sysinst/README.md_defs:1.8 --- src/usr.sbin/sysinst/README.md_defs:1.7 Sat Sep 11 20:28:06 2021 +++ src/usr.sbin/sysinst/README.md_defs Fri Jan 6 15:05:52 2023 @@ -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 @@ HAVE_EFI_BOOT defined if the architect 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) Index: src/usr.sbin/sysinst/disklabel.c diff -u src/usr.sbin/sysinst/disklabel.c:1.50 src/usr.sbin/sysinst/disklabel.c:1.51 --- src/usr.sbin/sysinst/disklabel.c:1.50 Sun Dec 11 19:32:57 2022 +++ src/usr.sbin/sysinst/disklabel.c Fri Jan 6 15:05:52 2023 @@ -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 @@ disklabel_add_partition(struct disk_part #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; }