]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
monitor: Add netdev_add type argument completion.
authorHani Benhabiles <kroosec@gmail.com>
Wed, 7 May 2014 22:41:31 +0000 (23:41 +0100)
committerLuiz Capitulino <lcapitulino@redhat.com>
Thu, 15 May 2014 19:16:02 +0000 (15:16 -0400)
Also update the command's documentation.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
hmp-commands.hx
hmp.h
monitor.c

index 3e7b29c99ddd13c7298dea7a342433977b4b5e74..a7f9b2fd892117e1af57ed1c04cc48794ddc6ca5 100644 (file)
@@ -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 91c9c8539a065f9061955c814b237c777d6f2962..bcecd0da160aa3e7390e42338a7b2b3641fcea43 100644 (file)
--- 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
index fd50c2dd1f1539721ed6f2a20167c341305c1448..a3dd3614fcef679e74488f27536650840bba795a 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4303,6 +4303,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;