[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/6] monitor: Add netdev_add type argument completio
From: |
Hani Benhabiles |
Subject: |
[Qemu-devel] [PATCH 5/6] monitor: Add netdev_add type argument completion. |
Date: |
Wed, 7 May 2014 23:41:31 +0100 |
Also update the command's documentation.
Signed-off-by: Hani Benhabiles <address@hidden>
---
hmp-commands.hx | 3 ++-
hmp.h | 1 +
monitor.c | 15 +++++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 3e7b29c..a7f9b2f 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1234,9 +1234,10 @@ ETEXI
{
.name = "netdev_add",
.args_type = "netdev:O",
- .params =
"[user|tap|socket|hubport|netmap],id=str[,prop=value][,...]",
+ .params =
"[user|tap|socket|vde|bridge|hubport|netmap],id=str[,prop=value][,...]",
.help = "add host network device",
.mhandler.cmd = hmp_netdev_add,
+ .command_completion = netdev_add_completion,
},
STEXI
diff --git a/hmp.h b/hmp.h
index 91c9c85..bcecd0d 100644
--- a/hmp.h
+++ b/hmp.h
@@ -101,5 +101,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args,
const char *str);
void chardev_remove_completion(ReadLineState *rs, int nb_args, const char
*str);
void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str);
void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
+void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
#endif
diff --git a/monitor.c b/monitor.c
index 5ead568..a4c429c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4286,6 +4286,21 @@ void chardev_add_completion(ReadLineState *rs, int
nb_args, const char *str)
qapi_free_ChardevBackendInfoList(start);
}
+void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
+{
+ size_t len;
+ int i;
+
+ if (nb_args != 2) {
+ return;
+ }
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ for (i = 0; NetClientOptionsKind_lookup[i]; i++) {
+ add_completion_option(rs, str, NetClientOptionsKind_lookup[i]);
+ }
+}
+
void device_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
GSList *list, *elt;
--
1.8.3.2
- [Qemu-devel] [PATCH 0/6] Miscellaneous command completion patches, Hani Benhabiles, 2014/05/07
- [Qemu-devel] [PATCH 1/6] monitor: Convert sendkey to use command_completion., Hani Benhabiles, 2014/05/07
- [Qemu-devel] [PATCH 2/6] monitor: Add chardev-remove command completion., Hani Benhabiles, 2014/05/07
- [Qemu-devel] [PATCH 4/6] monitor: Add set_link arguments completion., Hani Benhabiles, 2014/05/07
- [Qemu-devel] [PATCH 3/6] monitor: Add chardev-add backend argument completion., Hani Benhabiles, 2014/05/07
- [Qemu-devel] [PATCH 5/6] monitor: Add netdev_add type argument completion.,
Hani Benhabiles <=
- [Qemu-devel] [PATCH 6/6] monitor: Add netdev_del id argument completion., Hani Benhabiles, 2014/05/07
- Re: [Qemu-devel] [PATCH 0/6] Miscellaneous command completion patches, Gerd Hoffmann, 2014/05/08
- Re: [Qemu-devel] [PATCH 0/6] Miscellaneous command completion patches, Luiz Capitulino, 2014/05/15
- Re: [Qemu-devel] [PATCH 0/6] Miscellaneous command completion patches, Hani Benhabiles, 2014/05/15