aboutsummaryrefslogtreecommitdiff
path: root/monitor/misc.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:17 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:12 +0100
commit915901599554b57e386ee4110efcd3c79b87a2cb (patch)
treebc499b0b2cb872cf2f1a0adb6a01b0de65da57a9 /monitor/misc.c
parent94d912d1928cabbad20fd6abab0b679682c75058 (diff)
downloadqemu-915901599554b57e386ee4110efcd3c79b87a2cb.zip
qemu-915901599554b57e386ee4110efcd3c79b87a2cb.tar.gz
qemu-915901599554b57e386ee4110efcd3c79b87a2cb.tar.bz2
qdev: move helper function to monitor/misc
Move the one-user function to the place it is being used. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200110153039.1379601-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'monitor/misc.c')
-rw-r--r--monitor/misc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index de1ca4d..4752150 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1959,6 +1959,32 @@ void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
g_slist_free(list);
}
+static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
+{
+ GSList **list = opaque;
+ DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+ TYPE_DEVICE);
+
+ if (dev == NULL) {
+ return 0;
+ }
+
+ if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
+ *list = g_slist_append(*list, dev);
+ }
+
+ return 0;
+}
+
+static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
+{
+ GSList *list = NULL;
+
+ object_child_foreach(peripheral, qdev_add_hotpluggable_device, &list);
+
+ return list;
+}
+
static void peripheral_device_del_completion(ReadLineState *rs,
const char *str, size_t len)
{