Index | Thread | Search

From:
Alexander Klimov <a@kli.mov>
Subject:
[patch] [ok?] bioctl: properly indicate key disk for RAID 1C in addition to crypto
To:
tech@openbsd.org
Date:
Sun, 28 Apr 2024 19:31:12 +0200

Download raw body.

Thread
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>

Ok?

--- /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);