From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFpki-0000Dw-5p for qemu-devel@nongnu.org; Wed, 13 Mar 2013 13:46:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFpkb-000491-Gb for qemu-devel@nongnu.org; Wed, 13 Mar 2013 13:46:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFpkb-00048k-8h for qemu-devel@nongnu.org; Wed, 13 Mar 2013 13:46:05 -0400 Date: Wed, 13 Mar 2013 19:46:24 +0200 From: "Michael S. Tsirkin" Message-ID: <3c5866736dc124947670a4166541cf71b3f3e21f.1363196546.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH v6 3/3] qmp: add path to device_deleted event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , Markus Armbruster Cc: Kevin Wolf , Eduardo Habkost , libvir-list@redhat.com, Stefan Hajnoczi , qemu-devel@nongnu.org, Luiz Capitulino , Gerd Hoffmann , Paolo Bonzini , Andreas =?us-ascii?Q?=3D=3Fus-ascii=3FB=3FPT91dGYtOD9RP0Y9QzM9QTRyYmVy?= =?us-ascii?B?UHowPT89?= Add QOM path to device deleted event. Signed-off-by: Michael S. Tsirkin --- QMP/qmp-events.txt | 4 +++- hw/qdev.c | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt index 24cf3e8..dcc826d 100644 --- a/QMP/qmp-events.txt +++ b/QMP/qmp-events.txt @@ -147,9 +147,11 @@ Device removal can be initiated by the guest or by HMP/QMP commands. Data: - "device": device name (json-string, optional) +- "path": device path (json-string) { "event": "DEVICE_DELETED", - "data": { "device": "virtio-net-pci-0" }, + "data": { "device": "virtio-net-pci-0", + "path": "/machine/peripheral/virtio-net-pci-0" }, "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } DEVICE_TRAY_MOVED diff --git a/hw/qdev.c b/hw/qdev.c index 50bf2e6..2c861c1 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -782,14 +782,13 @@ static void device_unparent(Object *obj, const char *path) } 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 = NULL; + event_data = qobject_from_jsonf("{ 'path': %s }", path); } monitor_protocol_event(QEVENT_DEVICE_DELETED, event_data); - if (event_data) { - qobject_decref(event_data); - } + qobject_decref(event_data); } static void device_class_init(ObjectClass *class, void *data) -- MST