With this move the monitor.c/monitor-system.c split is complete. Signed-off-by: Benoit Canet <ben...@irqsave.net> --- monitor-system.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ monitor.c | 49 ------------------------------------------------- 2 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/monitor-system.c b/monitor-system.c index f8e4a10..d5abf73 100644 --- a/monitor-system.c +++ b/monitor-system.c @@ -2464,3 +2464,52 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, return monitor_read_bdrv_key_start(mon, bs, completion_cb, opaque); } + +void set_link_completion(ReadLineState *rs, int nb_args, const char *str) +{ + size_t len; + + len = strlen(str); + readline_set_completion_index(rs, len); + if (nb_args == 2) { + NetClientState *ncs[255]; + int count, i; + count = qemu_find_net_clients_except(NULL, ncs, + NET_CLIENT_OPTIONS_KIND_NONE, 255); + for (i = 0; i < count; i++) { + const char *name = ncs[i]->name; + if (!strncmp(str, name, len)) { + readline_add_completion(rs, name); + } + } + } else if (nb_args == 3) { + add_completion_option(rs, str, "on"); + add_completion_option(rs, str, "off"); + } +} + +void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) +{ + int len, count, i; + NetClientState *ncs[255]; + + if (nb_args != 2) { + return; + } + + len = strlen(str); + readline_set_completion_index(rs, len); + count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, + 255); + for (i = 0; i < count; i++) { + QemuOpts *opts; + const char *name = ncs[i]->name; + if (strncmp(str, name, len)) { + continue; + } + opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name); + if (opts) { + readline_add_completion(rs, name); + } + } +} diff --git a/monitor.c b/monitor.c index 79b54e1..3133f62 100644 --- a/monitor.c +++ b/monitor.c @@ -2096,55 +2096,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str) } } -void set_link_completion(ReadLineState *rs, int nb_args, const char *str) -{ - size_t len; - - len = strlen(str); - readline_set_completion_index(rs, len); - if (nb_args == 2) { - NetClientState *ncs[255]; - int count, i; - count = qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_OPTIONS_KIND_NONE, 255); - for (i = 0; i < count; i++) { - const char *name = ncs[i]->name; - if (!strncmp(str, name, len)) { - readline_add_completion(rs, name); - } - } - } else if (nb_args == 3) { - add_completion_option(rs, str, "on"); - add_completion_option(rs, str, "off"); - } -} - -void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) -{ - int len, count, i; - NetClientState *ncs[255]; - - if (nb_args != 2) { - return; - } - - len = strlen(str); - readline_set_completion_index(rs, len); - count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC, - 255); - for (i = 0; i < count; i++) { - QemuOpts *opts; - const char *name = ncs[i]->name; - if (strncmp(str, name, len)) { - continue; - } - opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name); - if (opts) { - readline_add_completion(rs, name); - } - } -} - void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str) { if (nb_args != 2) { -- 2.0.1