Patchwork [V5,17/28] qapi event: convert DEVICE_DELETED

login
register
mail settings
Submitter Wenchao Xia
Date May 1, 2014, 4:26 a.m.
Message ID <1398918422-3019-18-git-send-email-wenchaoqemu@gmail.com>
Download mbox | patch
Permalink /patch/344413/
State New
Headers show

Comments

Wenchao Xia - May 1, 2014, 4:26 a.m.
Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
---
 hw/core/qdev.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

Patch

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 60f9df1..ac85eaf 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -32,8 +32,8 @@ 
 #include "qapi/qmp/qerror.h"
 #include "qapi/visitor.h"
 #include "qapi/qmp/qjson.h"
-#include "monitor/monitor.h"
 #include "hw/hotplug.h"
+#include "qapi-event.h"
 
 int qdev_hotplug = 0;
 static bool qdev_hot_added = false;
@@ -874,7 +874,6 @@  static void device_unparent(Object *obj)
 {
     DeviceState *dev = DEVICE(obj);
     BusState *bus;
-    QObject *event_data;
     bool have_realized = dev->realized;
 
     if (dev->realized) {
@@ -894,14 +893,7 @@  static void device_unparent(Object *obj)
     if (have_realized) {
         gchar *path = object_get_canonical_path(OBJECT(dev));
 
-        if (dev->id) {
-            event_data = qobject_from_jsonf("{ 'device': %s, 'path': %s }",
-                                            dev->id, path);
-        } else {
-            event_data = qobject_from_jsonf("{ 'path': %s }", path);
-        }
-        monitor_protocol_event(QEVENT_DEVICE_DELETED, event_data);
-        qobject_decref(event_data);
+        qapi_event_send_device_deleted(!!dev->id, dev->id, path, NULL);
         g_free(path);
     }
 }