From nobody Sat Feb 7 07:25:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539090433538524.1303712917804; Tue, 9 Oct 2018 06:07:13 -0700 (PDT) Received: from localhost ([::1]:51385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9rjC-0000Sf-Ah for importer@patchew.org; Tue, 09 Oct 2018 09:07:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9rh9-0007ZK-Fx for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:05:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9rh8-0003i5-FW for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:05:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9rh8-0003hQ-94 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 09:05:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94D723082E02; Tue, 9 Oct 2018 13:05:01 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD42D780EA; Tue, 9 Oct 2018 13:04:55 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 14:04:33 +0100 Message-Id: <20181009130442.26296-3-berrange@redhat.com> In-Reply-To: <20181009130442.26296-1-berrange@redhat.com> References: <20181009130442.26296-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 09 Oct 2018 13:05:01 +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 v5 02/11] qom: don't require user creatable objects to be registered X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , =?UTF-8?q?Andreas=20F=C3=A4rber?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When an object is in turn owned by another user object, it is not desirable to expose this in the QOM object hierarchy, as it is just an internal implementation detail, we should be free to change without exposure. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- qom/object.c | 12 ++++++++---- qom/object_interfaces.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/qom/object.c b/qom/object.c index 547dcf97c3..f20f0c45a7 100644 --- a/qom/object.c +++ b/qom/object.c @@ -607,15 +607,19 @@ Object *object_new_with_propv(const char *typename, goto error; } =20 - object_property_add_child(parent, id, obj, &local_err); - if (local_err) { - goto error; + if (id !=3D NULL) { + object_property_add_child(parent, id, obj, &local_err); + if (local_err) { + goto error; + } } =20 if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { user_creatable_complete(obj, &local_err); if (local_err) { - object_unparent(obj); + if (id !=3D NULL) { + object_unparent(obj); + } goto error; } } diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 941fd63afd..94d5f91d69 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -83,16 +83,20 @@ Object *user_creatable_add_type(const char *type, const= char *id, goto out; } =20 - object_property_add_child(object_get_objects_root(), - id, obj, &local_err); - if (local_err) { - goto out; + if (id !=3D NULL) { + object_property_add_child(object_get_objects_root(), + id, obj, &local_err); + if (local_err) { + goto out; + } } =20 user_creatable_complete(obj, &local_err); if (local_err) { - object_property_del(object_get_objects_root(), - id, &error_abort); + if (id !=3D NULL) { + object_property_del(object_get_objects_root(), + id, &error_abort); + } goto out; } out: --=20 2.17.1