Module Name: src Committed By: martin Date: Mon Dec 9 19:16:54 UTC 2019
Modified Files: src/usr.sbin/sysinst: README.md_defs disklabel.c partitions.c partitions.h src/usr.sbin/sysinst/arch/x68k: md.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/README.md_defs cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sysinst/disklabel.c cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/partitions.c cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/partitions.h cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/arch/x68k/md.h 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.1 src/usr.sbin/sysinst/README.md_defs:1.2 --- src/usr.sbin/sysinst/README.md_defs:1.1 Wed Aug 14 12:49:37 2019 +++ src/usr.sbin/sysinst/README.md_defs Mon Dec 9 19:16:53 2019 @@ -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 @@ used like: 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). Index: src/usr.sbin/sysinst/disklabel.c diff -u src/usr.sbin/sysinst/disklabel.c:1.17 src/usr.sbin/sysinst/disklabel.c:1.18 --- src/usr.sbin/sysinst/disklabel.c:1.17 Sat Dec 7 13:33:45 2019 +++ src/usr.sbin/sysinst/disklabel.c Mon Dec 9 19:16:53 2019 @@ -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 @@ disklabel_parts_read(const char *disk, d 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 */ Index: src/usr.sbin/sysinst/partitions.c diff -u src/usr.sbin/sysinst/partitions.c:1.5 src/usr.sbin/sysinst/partitions.c:1.6 --- src/usr.sbin/sysinst/partitions.c:1.5 Tue Nov 12 16:33:14 2019 +++ src/usr.sbin/sysinst/partitions.c Mon Dec 9 19:16:53 2019 @@ -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 @@ static bool have_only_disklabel_boot_sup } #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 */ Index: src/usr.sbin/sysinst/partitions.h diff -u src/usr.sbin/sysinst/partitions.h:1.8 src/usr.sbin/sysinst/partitions.h:1.9 --- src/usr.sbin/sysinst/partitions.h:1.8 Tue Nov 12 16:33:14 2019 +++ src/usr.sbin/sysinst/partitions.h Mon Dec 9 19:16:53 2019 @@ -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 @@ bool generic_adapt_foreign_part_info( */ void partitions_init(void); void partitions_cleanup(void); +bool only_have_disklabel(void); + Index: src/usr.sbin/sysinst/arch/x68k/md.h diff -u src/usr.sbin/sysinst/arch/x68k/md.h:1.3 src/usr.sbin/sysinst/arch/x68k/md.h:1.4 --- src/usr.sbin/sysinst/arch/x68k/md.h:1.3 Wed Oct 2 11:16:04 2019 +++ src/usr.sbin/sysinst/arch/x68k/md.h Mon Dec 9 19:16:53 2019 @@ -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