aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-10-23 17:05:15 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-10-23 17:05:15 +0100
commit1430500bb8ba0bf15bad235439d62276c1b6b22f (patch)
tree12e69462ce386b5b2076adcf15a9229516502b92 /monitor.c
parente40830afa1cff3ffdc37bdfdd40d80860074636c (diff)
parente799157c766d96506214059d8b75712a3e615431 (diff)
Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging
QMP patches # gpg: Signature made Thu 23 Oct 2014 16:05:52 BST using RSA key ID E24ED5A7 # gpg: Good signature from "Luiz Capitulino <lcapitulino@gmail.com>" * remotes/qmp-unstable/tags/for-upstream: monitor: delete device_del_bus_completion monitor: add del completion for peripheral device qdev: add qdev_build_hotpluggable_device_list helper MAINTAINERS: add entry for qobject files dump: Turn some functions to void to make code cleaner dump: Propagate errors into qmp_dump_guest_memory() virtio-balloon: Tweak recent fix for integer overflow Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/monitor.c b/monitor.c
index fba4ce2fbe..07fb36e717 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4322,23 +4322,29 @@ void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
g_slist_free(list);
}
-static void device_del_bus_completion(ReadLineState *rs, BusState *bus,
- const char *str, size_t len)
+static void peripheral_device_del_completion(ReadLineState *rs,
+ const char *str, size_t len)
{
- BusChild *kid;
+ Object *peripheral;
+ GSList *list = NULL, *item;
- QTAILQ_FOREACH(kid, &bus->children, sibling) {
- DeviceState *dev = kid->child;
- BusState *dev_child;
+ peripheral = object_resolve_path("/machine/peripheral/", NULL);
+ if (peripheral == NULL) {
+ return;
+ }
+
+ object_child_foreach(peripheral, qdev_build_hotpluggable_device_list,
+ &list);
+
+ for (item = list; item; item = g_slist_next(item)) {
+ DeviceState *dev = item->data;
if (dev->id && !strncmp(str, dev->id, len)) {
readline_add_completion(rs, dev->id);
}
-
- QLIST_FOREACH(dev_child, &dev->child_bus, sibling) {
- device_del_bus_completion(rs, dev_child, str, len);
- }
}
+
+ g_slist_free(list);
}
void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str)
@@ -4413,7 +4419,7 @@ void device_del_completion(ReadLineState *rs, int nb_args, const char *str)
len = strlen(str);
readline_set_completion_index(rs, len);
- device_del_bus_completion(rs, sysbus_get_default(), str, len);
+ peripheral_device_del_completion(rs, str, len);
}
void object_del_completion(ReadLineState *rs, int nb_args, const char *str)