qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend r


From: Hu Tao
Subject: Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields
Date: Wed, 26 Feb 2014 13:00:03 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote:
> Il 25/02/2014 11:20, Hu Tao ha scritto:
> >There is a problem that user_creatable_complete() is called before
> >adding object to "/objects" (see object_create()), which triggers a
> >assert failure when calling object_get_canonical_path() in
> >ram_backend_memory_init(). Any ideas?
> 
> You can call object_property_add_child before calling
> user_creatable_complete, and then call object_unparent (in addition
> to object_unref) if creation fails.
> 
> Paolo

Something like this?

>From 59c999c840e4305bb2b95389bbea32e07c1c14c0 Mon Sep 17 00:00:00 2001
From: Hu Tao <address@hidden>
Date: Wed, 26 Feb 2014 12:54:34 +0800
Subject: [PATCH] call user_creatable_complete() after adding object to
 "/objects"

This makes it possible to get the path of object by calling
object_get_canonical_path() in the complete callback if
someone wants it.

Signed-off-by: Hu Tao <address@hidden>
---
 vl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index 1d27b34..30b4297 100644
--- a/vl.c
+++ b/vl.c
@@ -2770,14 +2770,15 @@ static int object_create(QemuOpts *opts, void *opaque)
         goto out;
     }
 
+    object_property_add_child(container_get(object_get_root(), "/objects"),
+                              id, obj, &local_err);
+
     user_creatable_complete(obj, &local_err);
     if (local_err) {
+        object_unparent(obj);
         goto out;
     }
 
-    object_property_add_child(container_get(object_get_root(), "/objects"),
-                              id, obj, &local_err);
-
 out:
     object_unref(obj);
     if (local_err) {
-- 
1.8.5.2.229.g4448466




reply via email to

[Prev in Thread] Current Thread [Next in Thread]