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

Re: [libvirt] [PATCH v4 1/3] Make virNetDevSetupControl() public.



On 13.06.2013 08:26, Roman Bogorodskiy wrote:
> This method is useful not only in virnetdev.c.
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virnetdev.c     | 15 +++++++++++++--
>  src/util/virnetdev.h     | 14 +++++++++++++-
>  3 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 042081f..f26b8aa 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1530,6 +1530,7 @@ virNetDevSetMTUFromDevice;
>  virNetDevSetName;
>  virNetDevSetNamespace;
>  virNetDevSetOnline;
> +virNetDevSetupControl;
>  virNetDevValidateConfig;
>  
>  
> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> index 1a22126..f6b7e12 100644
> --- a/src/util/virnetdev.c
> +++ b/src/util/virnetdev.c
> @@ -88,11 +88,22 @@ static int virNetDevSetupControlFull(const char *ifname,
>  }
>  
>  
> -static int virNetDevSetupControl(const char *ifname,
> -                                 struct ifreq *ifr)
> +int
> +virNetDevSetupControl(const char *ifname,
> +                      struct ifreq *ifr)
>  {
>      return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM);
>  }
> +#else
> +int
> +virNetDevSetupControl(const char *ifname ATTRIBUTE_UNUSED,
> +                      void *ifr ATTRIBUTE_UNUSED)
> +{
> +    virReportSystemError(ENOSYS,

s/$/ "%s"/

> +                         _("Network device configuration is not supported "
> +                           "on this platform"));
> +    return -1;
> +}
>  #endif
>  
>  
> diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
> index bc0777c..86c1f18 100644
> --- a/src/util/virnetdev.h
> +++ b/src/util/virnetdev.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2007-2012 Red Hat, Inc.
> + * Copyright (C) 2007-2013 Red Hat, Inc.
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -23,11 +23,23 @@
>  #ifndef __VIR_NETDEV_H__
>  # define __VIR_NETDEV_H__
>  
> +# include <net/if.h>
> +

Since virnetdev.c already includes <linux/if.h> this chunk makes the
compilation fail. It's, however, sufficient, to apply 3/3 prior to this
patch.


>  # include "virsocketaddr.h"
>  # include "virnetlink.h"
>  # include "virmacaddr.h"
>  # include "virpci.h"
>  
> +# ifdef HAVE_STRUCT_IFREQ
> +typedef struct ifreq virIfreq;
> +# else
> +typedef struct {} virIfreq;

s/struct {}/void/

> +# endif
> +
> +int virNetDevSetupControl(const char *ifname,
> +                          virIfreq *ifr)
> +    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> +
>  int virNetDevExists(const char *brname)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
>  
> 

Michal


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