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

Laine Stump laine at redhat.com
Wed Sep 30 23:14:42 UTC 2020


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 at 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




More information about the libvir-list mailing list