qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/9] QemuOpts: Drop qemu_opts_foreach() paramete


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 4/9] QemuOpts: Drop qemu_opts_foreach() parameter abort_on_failure
Date: Thu, 28 May 2015 09:10:07 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 05/28/2015 06:21 AM, Markus Armbruster wrote:
> When the argument is non-zero, qemus_opt_foreach() stops on callback

s/qemus_opt/qemu_opts/

> returning non-zero, and returns that value.
> 
> When the argument is zero, it doesn't stop, and returns the bit-wise
> inclusive or of all the return values.  Funky :)
> 
> The callers that pass zero could just as well pass one, because their
> callbacks can't return anything but zero:
> 
> * qemu_add_globals()'s callback qdev_add_one_global()
> 
> * qemu_config_write()'s callback config_write_opts()
> 
> * main()'s callbacks default_driver_check(), drive_enable_snapshot(),
>   vnc_init_func()
> 
> Drop the parameter, and always stop.

I had a hunch you might be getting to this point, just from reading the
earlier patches :)

> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  block/blkdebug.c                 |  4 ++--
>  hw/core/qdev-properties-system.c |  2 +-
>  include/qemu/option.h            |  4 ++--
>  net/net.c                        |  5 +++--
>  net/vhost-user.c                 |  2 +-
>  numa.c                           |  3 +--
>  tpm.c                            |  3 +--
>  util/qemu-config.c               |  2 +-
>  util/qemu-option.c               | 21 ++++++++++++++-------
>  vl.c                             | 35 ++++++++++++++++++-----------------
>  10 files changed, 44 insertions(+), 37 deletions(-)
> 

> +++ b/net/vhost-user.c
> @@ -240,7 +240,7 @@ int net_init_vhost_user(const NetClientOptions *opts, 
> const char *name,
>  
>      /* verify net frontend */
>      if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net,
> -                          (char *)name, true) == -1) {
> +                          (char *)name)) {

Also evidence that we weren't clear on 'int' vs. 'bool' on the
parameter's usage, so getting rid of it is indeed an improvement.

Reviewed-by: Eric Blake <address@hidden>

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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