summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-06-02 15:25:04 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 16:41:47 +0300
commitd012ffc189197962c8ac179611396f6af92c1860 (patch)
tree0f76f5bdb3dab18559a1e4e83072347193d7c3e7 /hw
parentb74545481187945965cf9f4df70b71d2f6cded4a (diff)
downloadqemu-d012ffc189197962c8ac179611396f6af92c1860.tar.gz
qdev: expose DeviceState.hotplugged field as a property
so that management could detect via QOM interface if device was hotplugged Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/qdev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fded64575d..3226a71d30 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -878,6 +878,20 @@ static bool device_get_hotpluggable(Object *obj, Error **errp)
dev->parent_bus->allow_hotplug);
}
+static bool device_get_hotplugged(Object *obj, Error **err)
+{
+ DeviceState *dev = DEVICE(obj);
+
+ return dev->hotplugged;
+}
+
+static void device_set_hotplugged(Object *obj, bool value, Error **err)
+{
+ DeviceState *dev = DEVICE(obj);
+
+ dev->hotplugged = value;
+}
+
static void device_initfn(Object *obj)
{
DeviceState *dev = DEVICE(obj);
@@ -896,6 +910,9 @@ static void device_initfn(Object *obj)
device_get_realized, device_set_realized, NULL);
object_property_add_bool(obj, "hotpluggable",
device_get_hotpluggable, NULL, NULL);
+ object_property_add_bool(obj, "hotplugged",
+ device_get_hotplugged, device_set_hotplugged,
+ &error_abort);
class = object_get_class(OBJECT(dev));
do {