Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
Re: [patch] [ok?] bioctl: properly indicate key disk for RAID 1C in addition to crypto
To:
Alexander Klimov <a@kli.mov>, tech@openbsd.org
Date:
Sun, 13 Apr 2025 19:56:44 +0000

Download raw body.

Thread
28.04.2024 20:31, Alexander Klimov пишет:
> Hello everyone!
> 
> Without the diff below bioctl displays a strange RAID member of 0 size:
> 
> # bioctl softraid0
> Volume      Status               Size Device
> softraid0 0 Online       500107558912 sd5     CRYPTO
>           0 Online       500107558912 0:0.0   noencl <sd0a>
> softraid0 1 Online      2999999705088 sd6     RAID1C
>           0 Online      2999999705088 1:0.0   noencl <sd1a>
>           1 Online      2999999705088 1:1.0   noencl <sd2a>
>           2 Online                  0 1:2.0   noencl <sd7b>
> 
> With the diff it identifies that as the key disk, just like in crypto:
> 
> # bioctl softraid0
> Volume      Status               Size Device
> softraid0 0 Online       500107558912 sd5     CRYPTO
>           0 Online       500107558912 0:0.0   noencl <sd0a>
> softraid0 1 Online      2999999705088 sd6     RAID1C
>           0 Online      2999999705088 1:0.0   noencl <sd1a>
>           1 Online      2999999705088 1:1.0   noencl <sd2a>
>           2 Online           key disk 1:2.0   noencl <sd7b>

This is correct and works for me, thanks.

OK for the style(9) fixed diff below?

> 
> --- /usr/src/sbin/bioctl/bioctl.c
> +++ /usr/src/sbin/bioctl/bioctl.c
> @@ -563,7 +563,8 @@
>                  snprintf(volname, sizeof volname, "    %3u",
>                      bd.bd_diskid);
> 
> -            if (bv.bv_level == 'C' && bd.bd_size == 0)
> +            if ((bv.bv_level == 'C' || bv.bv_level == 0x1C)
> +                    && bd.bd_size == 0)
>                  snprintf(size, sizeof size, "%14s", "key disk");
>              else if (human)
>                  fmt_scaled(bd.bd_size, size);
> 

Index: bioctl.c
===================================================================
RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
diff -u -p -r1.158 bioctl.c
--- bioctl.c	15 Jul 2024 05:36:08 -0000	1.158
+++ bioctl.c	13 Apr 2025 19:50:44 -0000
@@ -562,7 +562,8 @@ bio_inq(char *name)
 				snprintf(volname, sizeof volname, "    %3u",
 				    bd.bd_diskid);
 
-			if (bv.bv_level == 'C' && bd.bd_size == 0)
+			if ((bv.bv_level == 'C' || bv.bv_level == 0x1C) &&
+			    bd.bd_size == 0)
 				snprintf(size, sizeof size, "%14s", "key disk");
 			else if (human)
 				fmt_scaled(bd.bd_size, size);