...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) +{ + return -1; +} +#endif + + #if defined(HAVE_STRUCT_IFREQ) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, @@ -1612,18 +1634,6 @@ int virNetDevValidateConfig(const char *ifname ATTRIBUTE_UNUSED, #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; -} - static int virNetDevSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname, const char *file) -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list