QemuOpts: add qemu_opts_print_help to replace print_option_help
authorChunyan Liu <cyliu@suse.com>
Thu, 5 Jun 2014 09:20:47 +0000 (17:20 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 16 Jun 2014 09:23:20 +0000 (17:23 +0800)
print_option_help takes QEMUOptionParameter as parameter, add
qemu_opts_print_help to take QemuOptsList as parameter for later
replace work.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Leandro Dorileo <l@dorileo.org>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/qemu/option.h
util/qemu-option.c

index 6653e43..fbf5dc2 100644 (file)
@@ -166,5 +166,6 @@ typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque);
 void qemu_opts_print(QemuOpts *opts);
 int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque,
                       int abort_on_failure);
+void qemu_opts_print_help(QemuOptsList *list);
 
 #endif
index a7330c6..cd03eb4 100644 (file)
@@ -553,6 +553,19 @@ void print_option_help(QEMUOptionParameter *list)
     }
 }
 
+void qemu_opts_print_help(QemuOptsList *list)
+{
+    QemuOptDesc *desc;
+
+    assert(list);
+    desc = list->desc;
+    printf("Supported options:\n");
+    while (desc && desc->name) {
+        printf("%-16s %s\n", desc->name,
+               desc->help ? desc->help : "No description available");
+        desc++;
+    }
+}
 /* ------------------------------------------------------------------ */
 
 static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)