Module Name: src
Committed By: martin
Date: Tue Dec 17 12:19:49 UTC 2019
Modified Files:
src/sys/arch/i386/stand/boot [netbsd-8]: devopen.c
src/sys/arch/i386/stand/efiboot [netbsd-8]: devopen.c
src/sys/arch/i386/stand/lib [netbsd-8]: biosdisk.c
Log Message:
Pull up following revision(s) (requested by manu in ticket #1473):
sys/arch/i386/stand/lib/biosdisk.c: revision 1.53
sys/arch/i386/stand/efiboot/devopen.c: revision 1.9
sys/arch/i386/stand/boot/devopen.c: revision 1.10
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 PR misc/54748
While there, let raid device be used in the boot specification, like
raid0a:/netbsd.
To generate a diff of this commit:
cvs rdiff -u -r1.8.52.1 -r1.8.52.2 src/sys/arch/i386/stand/boot/devopen.c
cvs rdiff -u -r1.1.12.6 -r1.1.12.7 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.46.6.5 -r1.46.6.6 src/sys/arch/i386/stand/lib/biosdisk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/i386/stand/boot/devopen.c
diff -u src/sys/arch/i386/stand/boot/devopen.c:1.8.52.1 src/sys/arch/i386/stand/boot/devopen.c:1.8.52.2
--- src/sys/arch/i386/stand/boot/devopen.c:1.8.52.1 Tue Sep 17 18:26:53 2019
+++ src/sys/arch/i386/stand/boot/devopen.c Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.8.52.1 2019/09/17 18:26:53 martin Exp $ */
+/* $NetBSD: devopen.c,v 1.8.52.2 2019/12/17 12:19:49 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@ devopen(struct open_file *f, const char
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
Index: src/sys/arch/i386/stand/efiboot/devopen.c
diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.6 src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.7
--- src/sys/arch/i386/stand/efiboot/devopen.c:1.1.12.6 Fri Sep 27 09:40:08 2019
+++ src/sys/arch/i386/stand/efiboot/devopen.c Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.1.12.6 2019/09/27 09:40:08 martin Exp $ */
+/* $NetBSD: devopen.c,v 1.1.12.7 2019/12/17 12:19:49 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -151,6 +151,7 @@ int
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 @@ devopen(struct open_file *f, const char
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 @@ devopen(struct open_file *f, const char
BI_ADD(&bibp, BTINFO_BOOTPATH, sizeof(bibp));
}
- error = biosdisk_open_name(f, devname);
+ error = biosdisk_open_name(f, xname);
return error;
}
Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.5 src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.6
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.46.6.5 Wed Sep 18 17:30:05 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c Tue Dec 17 12:19:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.46.6.5 2019/09/18 17:30:05 martin Exp $ */
+/* $NetBSD: biosdisk.c,v 1.46.6.6 2019/12/17 12:19:49 martin Exp $ */
/*
* Copyright (c) 1996, 1998
@@ -1401,9 +1401,9 @@ next_disk:
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