summary refs log tree commit diff stats
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-03-11 15:11:04 +0200
committerMichael S. Tsirkin <mst@redhat.com>2013-03-26 21:02:16 +0200
commit15054fce2df8592dec70bba23faf126f0f372f81 (patch)
tree0892b7ef87f322fc7c80d1c7853eb19e5ffa85e5 /hw/qdev.c
parente998fa8df828ef68ea540a12917d10b4d335c1dd (diff)
downloadfocaccia-qemu-15054fce2df8592dec70bba23faf126f0f372f81.tar.gz
focaccia-qemu-15054fce2df8592dec70bba23faf126f0f372f81.zip
qmp: add path to device_deleted event
Add QOM path to device deleted event.  It now becomes useful to report
it for devices which don't have an ID assigned.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 5e8a89c06e..0cdf568df9 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -764,6 +764,7 @@ static void device_unparent(Object *obj)
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
     BusState *bus;
     QObject *event_data;
+    gchar *path = object_get_canonical_path(obj);
 
     while (dev->num_child_bus) {
         bus = QLIST_FIRST(&dev->child_bus);
@@ -784,12 +785,14 @@ static void device_unparent(Object *obj)
     }
 
     if (dev->id) {
-        event_data = qobject_from_jsonf("{ 'device': %s }", dev->id);
+        event_data = qobject_from_jsonf("{ 'device': %s, 'path': %s }",
+                                        dev->id, path);
     } else {
-        event_data = qobject_from_jsonf("{ }");
+        event_data = qobject_from_jsonf("{ 'path': %s }", path);
     }
     monitor_protocol_event(QEVENT_DEVICE_DELETED, event_data);
     qobject_decref(event_data);
+    g_free(path);
 }
 
 static void device_class_init(ObjectClass *class, void *data)