From patchwork Tue Feb 26 15:35:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1048414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4482xD4pRzz9s70 for ; Wed, 27 Feb 2019 02:37:03 +1100 (AEDT) Received: from localhost ([127.0.0.1]:57315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyemx-0006Z3-OR for incoming@patchwork.ozlabs.org; Tue, 26 Feb 2019 10:36:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyem8-0006Qw-JH for qemu-devel@nongnu.org; Tue, 26 Feb 2019 10:36:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyem7-0002EP-MA for qemu-devel@nongnu.org; Tue, 26 Feb 2019 10:36:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50874) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyem7-0002Dh-Do for qemu-devel@nongnu.org; Tue, 26 Feb 2019 10:36:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 282A53067DCC; Tue, 26 Feb 2019 15:36:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-70.ams2.redhat.com [10.36.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAB8960BF4; Tue, 26 Feb 2019 15:35:53 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Date: Tue, 26 Feb 2019 15:35:11 +0000 Message-Id: <20190226153520.29821-3-berrange@redhat.com> In-Reply-To: <20190226153520.29821-1-berrange@redhat.com> References: <20190226153520.29821-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 26 Feb 2019 15:36:06 +0000 (UTC) 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] [PULL v2 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: Michael Roth , Markus Armbruster , Gerd Hoffmann , =?utf-8?q?Mar?= =?utf-8?q?c-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Andreas_F=C3=A4rber?= , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When an object is in turn owned by another user object, it is not desirable to expose this in the QOM object hierarchy. It is just an internal implementation detail, we should be free to change without exposure to apps managing QEMU. Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé --- 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 b8c732063b..05a8567041 100644 --- a/qom/object.c +++ b/qom/object.c @@ -646,16 +646,20 @@ Object *object_new_with_propv(const char *typename, goto error; } - object_property_add_child(parent, id, obj, &local_err); - if (local_err) { - goto error; + if (id != NULL) { + object_property_add_child(parent, id, obj, &local_err); + if (local_err) { + goto error; + } } uc = (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); if (uc) { user_creatable_complete(uc, &local_err); if (local_err) { - object_unparent(obj); + if (id != NULL) { + object_unparent(obj); + } goto error; } } diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index db85d1eb75..cb5809934a 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -75,16 +75,20 @@ Object *user_creatable_add_type(const char *type, const char *id, goto out; } - object_property_add_child(object_get_objects_root(), - id, obj, &local_err); - if (local_err) { - goto out; + if (id != NULL) { + object_property_add_child(object_get_objects_root(), + id, obj, &local_err); + if (local_err) { + goto out; + } } user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { - object_property_del(object_get_objects_root(), - id, &error_abort); + if (id != NULL) { + object_property_del(object_get_objects_root(), + id, &error_abort); + } goto out; } out: