Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand In-RAID partitions with no name can be c...



details:   https://anonhg.NetBSD.org/src/rev/9835dfe6884f
branches:  trunk
changeset: 1005497:9835dfe6884f
user:      manu <manu%NetBSD.org@localhost>
date:      Tue Dec 10 02:02:47 2019 +0000

description:
In-RAID partitions with no name can be candidate for booting

The code to select boot partition in RAID assumed thet had a name,
which is true when there is a GPT inside the RAID, but not when there
is a disklabel inside the RAID. This caused a regression from behavior
of NetBSD 8.1.

We fix this by allowing nameless partition to be boot candidates.
This fixes misc/54748

While there, let raid device be used in the boot specification, like
raid0a:/netbsd.

diffstat:

 sys/arch/i386/stand/boot/devopen.c    |   4 ++--
 sys/arch/i386/stand/efiboot/devopen.c |  13 +++++++++----
 sys/arch/i386/stand/lib/biosdisk.c    |   8 ++++----
 3 files changed, 15 insertions(+), 10 deletions(-)

diffs (81 lines):

diff -r 699abe1dc68d -r 9835dfe6884f sys/arch/i386/stand/boot/devopen.c
--- a/sys/arch/i386/stand/boot/devopen.c        Mon Dec 09 21:08:56 2019 +0000
+++ b/sys/arch/i386/stand/boot/devopen.c        Tue Dec 10 02:02:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devopen.c,v 1.9 2019/08/18 02:18:24 manu Exp $  */
+/*     $NetBSD: devopen.c,v 1.10 2019/12/10 02:02:47 manu Exp $         */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
        if (strstr(devname, "raid") == devname) {
                f->f_dev = &devsw[0];           /* must be biosdisk */
 
-               return biosdisk_open_name(f, devname);
+               return biosdisk_open_name(f, fname);
        }
 #endif
 
diff -r 699abe1dc68d -r 9835dfe6884f sys/arch/i386/stand/efiboot/devopen.c
--- a/sys/arch/i386/stand/efiboot/devopen.c     Mon Dec 09 21:08:56 2019 +0000
+++ b/sys/arch/i386/stand/efiboot/devopen.c     Tue Dec 10 02:02:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devopen.c,v 1.8 2019/09/26 12:21:03 nonaka Exp $        */
+/*     $NetBSD: devopen.c,v 1.9 2019/12/10 02:02:47 manu Exp $  */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -151,6 +151,7 @@
 devopen(struct open_file *f, const char *fname, char **file)
 {
        char *fsname, *devname;
+       const char *xname = NULL;
        int unit, partition;
        int biosdev;
        int i, error;
@@ -172,8 +173,12 @@
        nfsys = nfsys_disk;
 
        /* Search by GPT label or raidframe name */
-       if ((strstr(devname, "NAME=") == devname) ||
-           (strstr(devname, "raid") == devname)) {
+       if (strstr(devname, "NAME=") == devname)
+               xname = devname;
+       if (strstr(devname, "raid") == devname)
+               xname = fname;
+
+       if (xname != NULL) {
                f->f_dev = &devsw[0];           /* must be biosdisk */
 
                if (!kernel_loaded) {
@@ -181,7 +186,7 @@
                        BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
                }
 
-               error = biosdisk_open_name(f, devname);
+               error = biosdisk_open_name(f, xname);
                return error;
        }
 
diff -r 699abe1dc68d -r 9835dfe6884f sys/arch/i386/stand/lib/biosdisk.c
--- a/sys/arch/i386/stand/lib/biosdisk.c        Mon Dec 09 21:08:56 2019 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.c        Tue Dec 10 02:02:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biosdisk.c,v 1.52 2019/09/13 02:19:46 manu Exp $       */
+/*     $NetBSD: biosdisk.c,v 1.53 2019/12/10 02:02:47 manu Exp $       */
 
 /*
  * Copyright (c) 1996, 1998
@@ -1401,9 +1401,9 @@
                                continue;
                        if (d->part[part].fstype == FS_UNUSED)
                                continue;
-                       if (d->part[part].part_name == NULL)
-                               continue;
-                       if (strcmp(d->part[part].part_name, name) == 0) {
+
+                       if (d->part[part].part_name != NULL &&
+                           strcmp(d->part[part].part_name, name) == 0) {
                                *biosdev = raidframe[i].biosdev;
                                *offset = raidframe[i].offset
                                        + RF_PROTECTED_SECTORS



Home | Main Index | Thread Index | Old Index