-/* $OpenBSD: softraid.c,v 1.426 2022/08/29 19:01:52 stsp Exp $ */
+/* $OpenBSD: softraid.c,v 1.427 2022/09/11 19:34:40 miod Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
}
}
- bzero(duid, sizeof(duid));
TAILQ_FOREACH(dk, &disklist, dk_link)
if (!strncmp(dk->dk_name, bb->bb_dev, sizeof(bb->bb_dev)))
break;
if (dk == NULL || dk->dk_label == NULL ||
- (dk->dk_flags & DKF_LABELVALID) == 0 ||
- bcmp(dk->dk_label->d_uid, &duid, sizeof(duid)) == 0) {
+ duid_iszero(dk->dk_label->d_uid)) {
sr_error(sc, "failed to get DUID for softraid volume");
goto done;
}
-/* $OpenBSD: subr_disk.c,v 1.261 2022/09/11 11:47:55 krw Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.262 2022/09/11 19:34:40 miod Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
/* Read disklabel. */
if (disk_readlabel(&dl, dk->dk_devno, errbuf, sizeof(errbuf)) == NULL) {
enqueue_randomness(dl.d_checksum);
- dk->dk_flags |= DKF_LABELVALID;
}
done:
TAILQ_FOREACH(dk, &disklist, dk_link)
if (dk->dk_device == bootdv)
break;
- if (dk && (dk->dk_flags & DKF_LABELVALID))
+ if (dk)
bcopy(dk->dk_label->d_uid, bootduid, sizeof(bootduid));
} else if (bootdv == NULL) {
/* Locate boot disk based on the provided DUID. */
TAILQ_FOREACH(dk, &disklist, dk_link)
if (duid_equal(dk->dk_label->d_uid, bootduid))
break;
- if (dk && (dk->dk_flags & DKF_LABELVALID))
+ if (dk)
bootdv = dk->dk_device;
}
bcopy(bootduid, rootduid, sizeof(rootduid));
if (bootdv->dv_class == DV_DISK) {
if (!duid_iszero(rootduid)) {
TAILQ_FOREACH(dk, &disklist, dk_link)
- if ((dk->dk_flags & DKF_LABELVALID) &&
- dk->dk_label && duid_equal(
+ if (dk->dk_label && duid_equal(
dk->dk_label->d_uid, rootduid))
break;
if (dk == NULL)
mdk = NULL;
TAILQ_FOREACH(dk, &disklist, dk_link) {
- if ((dk->dk_flags & DKF_LABELVALID) && dk->dk_label &&
+ if (dk->dk_label &&
+ !duid_iszero(dk->dk_label->d_uid) &&
memcmp(dk->dk_label->d_uid, uid,
sizeof(dk->dk_label->d_uid)) == 0) {
/* Fail if there are duplicate UIDs! */
-/* $OpenBSD: disk.h,v 1.36 2017/05/04 22:47:27 deraadt Exp $ */
+/* $OpenBSD: disk.h,v 1.37 2022/09/11 19:34:40 miod Exp $ */
/* $NetBSD: disk.h,v 1.11 1996/04/28 20:22:50 thorpej Exp $ */
/*
#define DKF_CONSTRUCTED 0x0001
#define DKF_OPENED 0x0002
#define DKF_NOLABELREAD 0x0004
-#define DKF_LABELVALID 0x0008
/*
* Metrics data; note that some metrics may have no meaning