From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rtaan-0001zw-5o for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rtaad-0005GF-41 for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:24 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:54242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rtaab-0005ED-Lv for qemu-devel@nongnu.org; Sat, 04 Feb 2012 03:03:18 -0500 Received: by wibhi20 with SMTP id hi20so3684797wib.4 for ; Sat, 04 Feb 2012 00:03:12 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sat, 4 Feb 2012 09:02:41 +0100 Message-Id: <1328342577-25732-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> References: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 11/27] qom: fix canonical paths vs. interfaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Paolo Bonzini --- qom/object.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/qom/object.c b/qom/object.c index 75be582..e8418bc 100644 --- a/qom/object.c +++ b/qom/object.c @@ -819,6 +819,12 @@ void object_property_add_child(Object *obj, const char *name, { gchar *type; + /* Registering an interface object in the composition tree will mightily + * confuse object_get_canonical_path (which, on the other hand, knows how + * to get the canonical path of an interface object). + */ + assert(!object_is_type(obj, type_interface)); + type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child))); object_property_add(obj, name, type, object_get_child_property, @@ -912,6 +918,10 @@ gchar *object_get_canonical_path(Object *obj) Object *root = object_get_root(); char *newpath = NULL, *path = NULL; + if (object_is_type(obj, type_interface)) { + obj = INTERFACE(obj)->obj; + } + while (obj != root) { ObjectProperty *prop = NULL; -- 1.7.7.6