qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace p


From: Chunyan Liu
Subject: Re: [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace print_option_help
Date: Wed, 26 Mar 2014 10:58:13 +0800




2014-03-26 4:43 GMT+08:00 Eric Blake <address@hidden>:
On 03/21/2014 04:12 AM, 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 <address@hidden>
> Signed-off-by: Chunyan Liu <address@hidden>
> ---
>  include/qemu/option.h |  1 +
>  util/qemu-option.c    | 11 +++++++++++
>  2 files changed, 12 insertions(+)
>

> +void qemu_opts_print_help(QemuOptsList *list)
> +{
> +    int i;
> +
> +    printf("Supported options:\n");
> +    for (i = 0; list && list->desc[i].name; i++) {

Similar to print_option_help(), this prints "Supported options:\n" on a
line by itself if list is NULL.  But do any of the drivers/protocols
actually lack options?

Yes, vvfat has no .create_options. Will update.
 
 Is it worth guaranteeing that this is only used
on non-empty lists?  What would happen if you wrote this as:

assert(list);
for (i = 0; list->desc[i].name; i++) { ...

or even

QemuOptDesc *desc;
assert(list);
desc = list->desc;
while (desc->name) {
    ...
    desc++;
}

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]