Module Name: src Committed By: msaitoh Date: Mon Oct 28 02:53:17 UTC 2019
Modified Files: src/usr.sbin/sysinst [netbsd-9]: bsddisklabel.c disks.c part_edit.c partitions.c partitions.h Log Message: Pull up following revision(s) (requested by martin in ticket #382): usr.sbin/sysinst/part_edit.c: revision 1.10 usr.sbin/sysinst/part_edit.c: revision 1.9 usr.sbin/sysinst/partitions.c: revision 1.3 usr.sbin/sysinst/partitions.c: revision 1.4 usr.sbin/sysinst/partitions.h: revision 1.7 usr.sbin/sysinst/bsddisklabel.c: revision 1.29 usr.sbin/sysinst/disks.c: revision 1.54 Honor the "no_mbr" flag (used especially for raid and xbd devices) On device where we do not want a MBR (raid, xbd) skip the MBR partitioning scheme when trying to read partitions from disk. The generic reader will fall back to disklabel then. In non-MBR specific files, #ifdef all tests for MBR for architectures that do not even compile in MBR support. To generate a diff of this commit: cvs rdiff -u -r1.23.2.4 -r1.23.2.5 src/usr.sbin/sysinst/bsddisklabel.c cvs rdiff -u -r1.44.2.9 -r1.44.2.10 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/usr.sbin/sysinst/part_edit.c cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/sysinst/partitions.c cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/usr.sbin/sysinst/partitions.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/bsddisklabel.c diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.4 src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.5 --- src/usr.sbin/sysinst/bsddisklabel.c:1.23.2.4 Wed Oct 23 06:04:44 2019 +++ src/usr.sbin/sysinst/bsddisklabel.c Mon Oct 28 02:53:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.23.2.4 2019/10/23 06:04:44 msaitoh Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.23.2.5 2019/10/28 02:53:17 msaitoh Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1341,7 +1341,7 @@ make_bsd_partitions(struct install_parti return true; if (parts == NULL) { - pscheme = select_part_scheme(pm, NULL, true, NULL); + pscheme = select_part_scheme(pm, NULL, !pm->no_mbr, NULL); if (pscheme == NULL) return false; parts = pscheme->create_new_for_disk(pm->diskdev, Index: src/usr.sbin/sysinst/disks.c diff -u src/usr.sbin/sysinst/disks.c:1.44.2.9 src/usr.sbin/sysinst/disks.c:1.44.2.10 --- src/usr.sbin/sysinst/disks.c:1.44.2.9 Wed Oct 23 06:30:16 2019 +++ src/usr.sbin/sysinst/disks.c Mon Oct 28 02:53:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.44.2.9 2019/10/23 06:30:16 msaitoh Exp $ */ +/* $NetBSD: disks.c,v 1.44.2.10 2019/10/28 02:53:17 msaitoh Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -901,7 +901,8 @@ find_disks(const char *doingwhat, bool a pm_i->parts = partitions_read_disk( pm_i->diskdev, - disk->dd_totsec); + disk->dd_totsec, + disk->dd_no_mbr); } } continue; @@ -929,7 +930,8 @@ find_disks(const char *doingwhat, bool a pm->dlsize = disk->dd_cyl * disk->dd_head * disk->dd_sec; - pm->parts = partitions_read_disk(pm->diskdev, disk->dd_totsec); + pm->parts = partitions_read_disk(pm->diskdev, + disk->dd_totsec, disk->dd_no_mbr); again: @@ -1443,7 +1445,7 @@ find_part_by_name(const char *name, stru if (strcmp(disks[n].dd_name, pm->diskdev) == 0) continue; ps = partitions_read_disk(disks[n].dd_name, - disks[n].dd_totsec); + disks[n].dd_totsec, disks[n].dd_no_mbr); if (ps == NULL) continue; if (ps->pscheme->find_by_name == NULL) Index: src/usr.sbin/sysinst/part_edit.c diff -u src/usr.sbin/sysinst/part_edit.c:1.7.2.1 src/usr.sbin/sysinst/part_edit.c:1.7.2.2 --- src/usr.sbin/sysinst/part_edit.c:1.7.2.1 Mon Oct 28 02:49:12 2019 +++ src/usr.sbin/sysinst/part_edit.c Mon Oct 28 02:53:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: part_edit.c,v 1.7.2.1 2019/10/28 02:49:12 msaitoh Exp $ */ +/* $NetBSD: part_edit.c,v 1.7.2.2 2019/10/28 02:53:17 msaitoh Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -1218,6 +1218,10 @@ select_part_scheme( if (bootable && p->have_boot_support != NULL && !p->have_boot_support(dev->diskdev)) continue; +#ifdef HAVE_MBR + if (dev->no_mbr && p->name == MSG_parttype_mbr) + continue; +#endif if (p->size_limit && dev->dlsize > p->size_limit) { char buf[255], hum_lim[5]; Index: src/usr.sbin/sysinst/partitions.c diff -u src/usr.sbin/sysinst/partitions.c:1.1.2.1 src/usr.sbin/sysinst/partitions.c:1.1.2.2 --- src/usr.sbin/sysinst/partitions.c:1.1.2.1 Sun Aug 18 13:21:40 2019 +++ src/usr.sbin/sysinst/partitions.c Mon Oct 28 02:53:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: partitions.c,v 1.1.2.1 2019/08/18 13:21:40 msaitoh Exp $ */ +/* $NetBSD: partitions.c,v 1.1.2.2 2019/10/28 02:53:17 msaitoh Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ size_t num_available_part_schemes; * Generic reader - query a disk device and read all partitions from it */ struct disk_partitions * -partitions_read_disk(const char *dev, daddr_t disk_size) +partitions_read_disk(const char *dev, daddr_t disk_size, bool no_mbr) { const struct disk_partitioning_scheme **ps; @@ -53,6 +53,10 @@ partitions_read_disk(const char *dev, da return NULL; for (ps = available_part_schemes; *ps; ps++) { +#ifdef HAVE_MBR + if (no_mbr && (*ps)->name == MSG_parttype_mbr) + continue; +#endif struct disk_partitions *parts = (*ps)->read_from_disk(dev, 0, disk_size, *ps); if (parts) Index: src/usr.sbin/sysinst/partitions.h diff -u src/usr.sbin/sysinst/partitions.h:1.4.2.2 src/usr.sbin/sysinst/partitions.h:1.4.2.3 --- src/usr.sbin/sysinst/partitions.h:1.4.2.2 Sun Aug 18 13:21:40 2019 +++ src/usr.sbin/sysinst/partitions.h Mon Oct 28 02:53:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: partitions.h,v 1.4.2.2 2019/08/18 13:21:40 msaitoh Exp $ */ +/* $NetBSD: partitions.h,v 1.4.2.3 2019/10/28 02:53:17 msaitoh Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -549,7 +549,7 @@ extern size_t num_available_part_schemes * Generic reader - query a disk device and read all partitions from it */ struct disk_partitions * -partitions_read_disk(const char *, daddr_t disk_size); +partitions_read_disk(const char *, daddr_t disk_size, bool no_mbr); /* * One time initialization