[libvirt] [PATCH 1/2] virnetdev: move virNetDevSysfsFile() upwards

Michal Privoznik mprivozn at redhat.com
Tue Apr 14 17:04:02 UTC 2015


On 14.04.2015 18:21, Lubomir Rintel wrote:
> ...and provide a bogus implementation for non-Linux. No functional change.
> We'd like to use it from within virNetDevSetNamespace() to determine if we need
> to move a 802.11 PHY to a namespace when moving the interface.
> ---
>  src/util/virnetdev.c | 34 ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> index 9a6d4e7..ee60f09 100644
> --- a/src/util/virnetdev.c
> +++ b/src/util/virnetdev.c
> @@ -114,6 +114,28 @@ struct _virNetDevMcastList {
>      virNetDevMcastEntryPtr *entries;
>  };
>  
> +#ifdef __linux__
> +# define NET_SYSFS "/sys/class/net/"
> +
> +static int
> +virNetDevSysfsFile(char **pf_sysfs_device_link, const char *ifname,
> +               const char *file)
> +{
> +
> +    if (virAsprintf(pf_sysfs_device_link, NET_SYSFS "%s/%s", ifname, file) < 0)
> +        return -1;
> +    return 0;
> +}
> +#else
> +static int
> +virNetDevSysfsFile(char **pf_sysfs_device_link, const char *ifname,
> +               const char *file)

Not that I reviewed the whole patch set (maybe tomorrow), but these
arguments are missing ATTRIBUTE_UNUSED. Just a small nit that can be
fixed before pushing. No need for v2.

ACK

Michal




More information about the libvir-list mailing list