Message ID | 1396518889-21681-8-git-send-email-cyliu@suse.com |
---|---|
State | New |
Headers | show |
On Thu, Apr 03, 2014 at 05:54:25PM +0800, Chunyan Liu wrote: > print_option_help takes QEMUOptionParameter as parameter, add > qemu_opts_print_help to take QemuOptsList as parameter for later > replace work. > > Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> > Signed-off-by: Chunyan Liu <cyliu@suse.com> Reviewed-by: Leandro Dorileo <l@dorileo.org> > --- > Changes: > * check non-empty list > > include/qemu/option.h | 1 + > util/qemu-option.c | 13 +++++++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/include/qemu/option.h b/include/qemu/option.h > index 6653e43..fbf5dc2 100644 > --- a/include/qemu/option.h > +++ b/include/qemu/option.h > @@ -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 > diff --git a/util/qemu-option.c b/util/qemu-option.c > index 786c687..26710d6 100644 > --- a/util/qemu-option.c > +++ b/util/qemu-option.c > @@ -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) > -- > 1.7.12.4 >
diff --git a/include/qemu/option.h b/include/qemu/option.h index 6653e43..fbf5dc2 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -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 diff --git a/util/qemu-option.c b/util/qemu-option.c index 786c687..26710d6 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -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)