From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxJ6-0002TP-TD for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxIz-0002jJ-Mr for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxIz-0002j6-EJ for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:21 -0400 Date: Tue, 17 Jun 2014 20:36:44 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-9-git-send-email-mst@redhat.com> References: <1403021756-15960-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403021756-15960-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 008/103] qdev: expose DeviceState.hotplugged field as a property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Anthony Liguori , Peter Crosthwaite , Paolo Bonzini , =?us-ascii?B?PT9VVEYtOD9xP0FuZHJlYXM9MjBGPUMzPUE0cmJlcj89?= From: Igor Mammedov so that management could detect via QOM interface if device was hotplugged Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/core/qdev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index fded645..3226a71 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 { -- MST