qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 15/16] convert net_init_bridge() to NetClientOpt


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 15/16] convert net_init_bridge() to NetClientOptions
Date: Tue, 05 Jun 2012 23:05:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Il 22/05/2012 12:45, Laszlo Ersek ha scritto:
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
>  net/tap.c |   23 ++++++++++++-----------
>  1 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/net/tap.c b/net/tap.c
> index 7501eba..fdaab2b 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -512,21 +512,22 @@ static int net_bridge_run_helper(const char *helper, 
> const char *bridge)
>      return -1;
>  }
>  
> -int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts,
> +int net_init_bridge(QemuOpts *old_opts, const NetClientOptions *opts,
>                      const char *name, VLANState *vlan)
>  {
> +    const NetdevBridgeOptions *bridge;
> +    const char *helper, *br;
> +
>      TAPState *s;
>      int fd, vnet_hdr;
>  
> -    if (!qemu_opt_get(opts, "br")) {
> -        qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE);
> -    }
> -    if (!qemu_opt_get(opts, "helper")) {
> -        qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER);
> -    }
> +    assert(opts->kind == NET_CLIENT_OPTIONS_KIND_BRIDGE);
> +    bridge = opts->bridge;
> +
> +    helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER;
> +    br     = bridge->has_br     ? bridge->br     : DEFAULT_BRIDGE_INTERFACE;

Don't hate me for this, but why not do the same for strdup calls?

    foo = bar->has_foo ? g_strdup(bar->foo) : NULL;

earlier in the series?

Reviewed-by: Paolo Bonzini <address@hidden>

Paolo



reply via email to

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