[PATCH 7/9] util: fix Linux build when libnl-devel isn't available

Laine Stump posted 9 patches 4 years, 1 month ago
[PATCH 7/9] util: fix Linux build when libnl-devel isn't available
Posted by Laine Stump 4 years, 1 month ago
There was one stray bit of code in virnetdev.c that required libnl to
build, but wasn't qualified by defined(WITH_LIBNL). Adding that, plus
putting a similar check around a static function only used by that
aforementioned code, makes libvirt build properly without libnl-devel
installed.

How useful it is in that state is a separate issue :-)

Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/util/virnetdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 737081a12b..5221bada7b 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1058,6 +1058,9 @@ virNetDevSysfsDeviceFile(char **pf_sysfs_device_link, const char *ifname,
     return 0;
 }
 
+
+# if defined(WITH_LIBNL)
+
 /**
  * Determine if the device path specified in devpath is a PCI Device
  * by resolving the 'subsystem'-link in devpath and looking for
@@ -1091,6 +1094,7 @@ virNetDevIsPCIDevice(const char *devpath)
     return STRPREFIX(subsys, "pci");
 }
 
+
 static virPCIDevicePtr
 virNetDevGetPCIDevice(const char *devName)
 {
@@ -1110,6 +1114,7 @@ virNetDevGetPCIDevice(const char *devName)
     return virPCIDeviceNew(vfPCIAddr->domain, vfPCIAddr->bus,
                            vfPCIAddr->slot, vfPCIAddr->function);
 }
+# endif
 
 
 /**
@@ -2958,7 +2963,7 @@ virNetDevGetEthtoolFeatures(const char *ifname,
 }
 
 
-# if WITH_DECL_DEVLINK_CMD_ESWITCH_GET
+# if defined(WITH_LIBNL) && WITH_DECL_DEVLINK_CMD_ESWITCH_GET
 
 /**
  * virNetDevGetFamilyId:
-- 
2.26.2