From: kn Date: Tue, 8 Nov 2022 14:05:41 +0000 (+0000) Subject: Skip softraid(4) keydisks silently X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e1bd498ee59b5111006ff5d31744de3e8e8b40c8;p=openbsd Skip softraid(4) keydisks silently Logging the presence of a keydisk the same way offline data chunks are logged seems unjustified: Offline data chunks mean the softraid volume is degraded and installboot(8) should be rerun when they're online. Offline keydisks just means the user unplugged their USB key or so and installboot must never touch them anyway, so the absence of keydisks is meaningless to installboot -- it should never touch them. So a) drop the "is keydisk - skipping" message and b) hoist the keydisk check before the offline check so as to avoid "not online - skipping" messages for offline keydisks. --- diff --git a/usr.sbin/installboot/softraid.c b/usr.sbin/installboot/softraid.c index 8e95e756d12..54780a70e58 100644 --- a/usr.sbin/installboot/softraid.c +++ b/usr.sbin/installboot/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.7 2022/11/08 12:08:53 kn Exp $ */ +/* $OpenBSD: softraid.c,v 1.8 2022/11/08 14:05:41 kn Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -161,6 +161,10 @@ sr_open_chunk(int devfd, int vol, int disk, struct bioc_disk *bd, if (ioctl(devfd, BIOCDISK, bd) == -1) err(1, "BIOCDISK"); + /* Keydisks always have a size of zero. */ + if (bd->bd_size == 0) + return -1; + /* Check disk status. */ if (bd->bd_status != BIOC_SDONLINE && bd->bd_status != BIOC_SDREBUILD) { @@ -169,13 +173,6 @@ sr_open_chunk(int devfd, int vol, int disk, struct bioc_disk *bd, return -1; } - /* Keydisks always have a size of zero. */ - if (bd->bd_size == 0) { - fprintf(stderr, "softraid chunk %u is keydisk - skipping...\n", - disk); - return -1; - } - if (strlen(bd->bd_vendor) < 1) errx(1, "invalid disk name"); *part = bd->bd_vendor[strlen(bd->bd_vendor) - 1];