Re: [PATCH 1/2] interface: Introduce netcfInterfaceObjIsActive

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

 



On Wed, Dec 11, 2013 at 10:16:37AM +0100, Michal Privoznik wrote:
> This function barely wraps ncf_if_status() and error handling code.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/interface/interface_backend_netcf.c | 57 +++++++++++++++++++--------------
>  1 file changed, 33 insertions(+), 24 deletions(-)
> 
> diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
> index c4e18c4..2e681ec 100644
> --- a/src/interface/interface_backend_netcf.c
> +++ b/src/interface/interface_backend_netcf.c
> @@ -238,6 +238,32 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac
>      return iface;
>  }
>  
> +static int
> +netcfInterfaceObjIsActive(struct netcf_if *iface,
> +                          bool *active)
> +{
> +    int ret = -1;
> +    unsigned int flags = 0;
> +
> +    virObjectRef(driverState);

What's the ref / unref of driverState for ? The code you're
replacing doesn't do that, and AFAICT this shouldn't be
required since we're always calling this from public API
context

> +    if (ncf_if_status(iface, &flags) < 0) {
> +        const char *errmsg, *details;
> +        int errcode = ncf_error(driverState->netcf, &errmsg, &details);
> +        virReportError(netcf_to_vir_err(errcode),
> +                       _("failed to get status of interface %s: %s%s%s"),
> +                       ncf_if_name(iface), errmsg, details ? " - " : "",
> +                       details ? details : "");
> +        goto cleanup;
> +    }
> +
> +    *active = flags & NETCF_IFACE_ACTIVE;
> +    ret = 0;
> +
> +cleanup:
> +    virObjectUnref(driverState);
> +    return ret;
> +}
> +

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]