qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v3 09/34] qdev: expose DeviceState.hotplugged field


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH v3 09/34] qdev: expose DeviceState.hotplugged field as a property
Date: Tue, 27 May 2014 15:01:06 +0200

so that management could detect via QOM interface if device was
hotplugged

Signed-off-by: Igor Mammedov <address@hidden>
---
v2:
 - fix typo in commit message (afaerber)
---
 hw/core/qdev.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index b4585f2..8f2d227 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -826,6 +826,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);
@@ -844,6 +858,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 {
-- 
1.7.1




reply via email to

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