The current check implies one could use, e.g. SWAP or MSDOS partitions
as softraid(4) chunks, but sys/dev/softraid.c always expects FS_RAID,
thus using chunks with different partition types is not possible:

        # vmctl create -s100M disk.img
        # vnd=`vnconfig disk.img`
        # echo 'swap *' | disklabel -wAT- vnd0

        # disklabel $vnd | grep swap
          a:           204800                0    swap
        # bioctl -c c -l ${vnd}a softraid0
        softraid0: invalid metadata format

Correct the check.
I don't expect this to break anything.
amd64 biosboot boots off standard RAID 'a' as before.

Feedback? Objection? OK?

Index: arch/amd64/stand/efiboot/dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/dev_i386.c,v
retrieving revision 1.1
diff -u -p -r1.1 dev_i386.c
--- arch/amd64/stand/efiboot/dev_i386.c 10 May 2019 21:20:42 -0000      1.1
+++ arch/amd64/stand/efiboot/dev_i386.c 16 Oct 2023 00:33:14 -0000
@@ -149,7 +149,7 @@ devboot(dev_t bootdev, char *p)
        }
 #endif
 
-       if (sr_boot_vol != -1 && part_type != FS_BSDFFS) {
+       if (sr_boot_vol != -1 && part_type == FS_RAID) {
                *p++ = 's';
                *p++ = 'r';
                *p++ = '0' + sr_boot_vol;
Index: arch/amd64/stand/libsa/dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/dev_i386.c,v
retrieving revision 1.23
diff -u -p -r1.23 dev_i386.c
--- arch/amd64/stand/libsa/dev_i386.c   10 May 2019 21:20:43 -0000      1.23
+++ arch/amd64/stand/libsa/dev_i386.c   16 Oct 2023 00:31:35 -0000
@@ -132,7 +132,7 @@ devboot(dev_t bootdev, char *p)
        }
 #endif
 
-       if (sr_boot_vol != -1 && part_type != FS_BSDFFS) {
+       if (sr_boot_vol != -1 && part_type == FS_RAID) {
                *p++ = 's';
                *p++ = 'r';
                *p++ = '0' + sr_boot_vol;
Index: arch/arm64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/stand/efiboot/efiboot.c,v
retrieving revision 1.48
diff -u -p -r1.48 efiboot.c
--- arch/arm64/stand/efiboot/efiboot.c  12 May 2023 16:43:00 -0000      1.48
+++ arch/arm64/stand/efiboot/efiboot.c  16 Oct 2023 00:34:17 -0000
@@ -864,7 +864,7 @@ devboot(dev_t dev, char *p)
                        break;
        }
 
-       if (sr_boot_vol != -1 && part_type != FS_BSDFFS) {
+       if (sr_boot_vol != -1 && part_type == FS_RAID) {
                strlcpy(p, "sr0a", 5);
                p[2] = '0' + sr_boot_vol;
                return;
Index: arch/i386/stand/libsa/dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/dev_i386.c,v
retrieving revision 1.43
diff -u -p -r1.43 dev_i386.c
--- arch/i386/stand/libsa/dev_i386.c    11 Sep 2016 17:52:47 -0000      1.43
+++ arch/i386/stand/libsa/dev_i386.c    16 Oct 2023 00:34:45 -0000
@@ -132,7 +132,7 @@ devboot(dev_t bootdev, char *p)
        }
 #endif
 
-       if (sr_boot_vol != -1 && part_type != FS_BSDFFS) {
+       if (sr_boot_vol != -1 && part_type == FS_RAID) {
                *p++ = 's';
                *p++ = 'r';
                *p++ = '0' + sr_boot_vol;
Index: arch/riscv64/stand/efiboot/efiboot.c
===================================================================
RCS file: /cvs/src/sys/arch/riscv64/stand/efiboot/efiboot.c,v
retrieving revision 1.6
diff -u -p -r1.6 efiboot.c
--- arch/riscv64/stand/efiboot/efiboot.c        5 Jul 2023 09:25:55 -0000       
1.6
+++ arch/riscv64/stand/efiboot/efiboot.c        16 Oct 2023 00:35:14 -0000
@@ -742,7 +742,7 @@ devboot(dev_t dev, char *p)
                        break;
        }
 
-       if (sr_boot_vol != -1 && part_type != FS_BSDFFS) {
+       if (sr_boot_vol != -1 && part_type == FS_RAID) {
                strlcpy(p, "sr0a", 5);
                p[2] = '0' + sr_boot_vol;
                return;

Reply via email to