diff options
author | Markus Armbruster <armbru@redhat.com> | 2023-01-24 13:19:39 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2023-02-04 07:56:54 +0100 |
commit | 9c9c5ce7f7d63e654d21a61c58366a7306bcab9f (patch) | |
tree | 909951e3309a96cbc03308413656896b135a92f4 /monitor | |
parent | 5bd26d78d9629a9d3f4780a162f09272978eae3d (diff) | |
download | qemu-9c9c5ce7f7d63e654d21a61c58366a7306bcab9f.zip qemu-9c9c5ce7f7d63e654d21a61c58366a7306bcab9f.tar.gz qemu-9c9c5ce7f7d63e654d21a61c58366a7306bcab9f.tar.bz2 |
qdev: Move HMP command completion from monitor to softmmu/
This moves the completion code from MAINTAINERS sections "Human
Monitor (HMP)" and "QMP" to section "QOM".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230124121946.1139465-26-armbru@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/misc.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/monitor/misc.c b/monitor/misc.c index a2584df..c76d583 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -1206,88 +1206,6 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name) return ret; } -void device_add_completion(ReadLineState *rs, int nb_args, const char *str) -{ - GSList *list, *elt; - size_t len; - - if (nb_args != 2) { - return; - } - - len = strlen(str); - readline_set_completion_index(rs, len); - list = elt = object_class_get_list(TYPE_DEVICE, false); - while (elt) { - DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data, - TYPE_DEVICE); - - if (dc->user_creatable) { - readline_add_completion_of(rs, str, - object_class_get_name(OBJECT_CLASS(dc))); - } - elt = elt->next; - } - g_slist_free(list); -} - -static int qdev_add_hotpluggable_device(Object *obj, void *opaque) -{ - GSList **list = opaque; - DeviceState *dev = (DeviceState *)object_dynamic_cast(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) -{ - Object *peripheral = container_get(qdev_get_machine(), "/peripheral"); - GSList *list, *item; - - list = qdev_build_hotpluggable_device_list(peripheral); - if (!list) { - return; - } - - for (item = list; item; item = g_slist_next(item)) { - DeviceState *dev = item->data; - - if (dev->id) { - readline_add_completion_of(rs, str, dev->id); - } - } - - g_slist_free(list); -} - -void device_del_completion(ReadLineState *rs, int nb_args, const char *str) -{ - if (nb_args != 2) { - return; - } - - readline_set_completion_index(rs, strlen(str)); - peripheral_device_del_completion(rs, str); -} - static int compare_mon_cmd(const void *a, const void *b) { |