From nobody Tue Nov 11 17:37:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1564417795; cv=none; d=zoho.com; s=zohoarc; b=DaiGKxjT99OWDtwSFVyqKjBKMdn5Wgwv//pVihhY06N/01kIdSzFkPd9mh0P822rPmDnDYYLhdwUbSLUNuKqav7qI5C5sEOm8aTmS/DjuXTx8tx0XRMVXb4LjZPwegCXeWK+5EpVAdj6jw5gRgF0gSdW8/8r1BOBPuQLoGA50PQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564417795; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=CcRcdU+0ZStbBOjv0CoRZUHGa7ggtf7u1HT1/C5rIhU=; b=B7Ng/AnzLIQ+S4dJ3V2+ifgACK6km/L/pLZxHbVH1H7FV1bLgYF98YhNkhoNddJ9xPnL9hKEqFIdBeB64yBo/29XpAjAk++gvp2fGacgpRqPCpA1j5TH0DepH1P5e9Yx+qa8PvFNpkEiJJy87IgubjTLlQcff7b61st4/xgRbEo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564417795739616.1338017422285; Mon, 29 Jul 2019 09:29:55 -0700 (PDT) Received: from localhost ([::1]:55006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs8Wz-0003Ut-OS for importer@patchew.org; Mon, 29 Jul 2019 12:29:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59229) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs8WO-0002bM-AJ for qemu-devel@nongnu.org; Mon, 29 Jul 2019 12:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hs8WN-0005Nj-E6 for qemu-devel@nongnu.org; Mon, 29 Jul 2019 12:29:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47958) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hs8WN-0005NL-9I for qemu-devel@nongnu.org; Mon, 29 Jul 2019 12:29:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A363A3064FAF for ; Mon, 29 Jul 2019 16:29:10 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-222.ams2.redhat.com [10.36.117.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E3F360856; Mon, 29 Jul 2019 16:29:09 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, berrange@redhat.com, cohuck@redhat.com, mst@redhat.com Date: Mon, 29 Jul 2019 17:29:02 +0100 Message-Id: <20190729162903.4489-2-dgilbert@redhat.com> In-Reply-To: <20190729162903.4489-1-dgilbert@redhat.com> References: <20190729162903.4489-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 29 Jul 2019 16:29:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/2] Revert "Revert "globals: Allow global properties to be optional"" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" This reverts commit 8fa70dbd8bb478d9483c1da3e9976a2d86b3f9a0. Because we're about to revert it's neighbour and thus uses an optional again. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Cornelia Huck Reviewed-by: Daniel P. Berrang=C3=A9 --- include/hw/qdev-core.h | 3 +++ qom/object.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e157fc4acd..136df7774c 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -252,6 +252,8 @@ struct PropertyInfo { /** * GlobalProperty: * @used: Set to true if property was used when initializing a device. + * @optional: If set to true, GlobalProperty will be skipped without errors + * if the property doesn't exist. * * An error is fatal for non-hotplugged devices, when the global is applie= d. */ @@ -260,6 +262,7 @@ typedef struct GlobalProperty { const char *property; const char *value; bool used; + bool optional; } GlobalProperty; =20 static inline void diff --git a/qom/object.c b/qom/object.c index 3966a3d461..1555547727 100644 --- a/qom/object.c +++ b/qom/object.c @@ -386,6 +386,9 @@ void object_apply_global_props(Object *obj, const GPtrA= rray *props, Error **errp if (object_dynamic_cast(obj, p->driver) =3D=3D NULL) { continue; } + if (p->optional && !object_property_find(obj, p->property, NULL)) { + continue; + } p->used =3D true; object_property_parse(obj, p->value, p->property, &err); if (err !=3D NULL) { --=20 2.21.0