[PATCH 2/5] node_device: Enable previously disabled code paths for FreeBSD

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

 



The code was under #ifdef __linux__ because of sysfs usage.
It is now using libpciaccess, which makes it available for, at least,
FreeBSD.

Signed-off-by: Alexander Shursha <kekek2@xxxxx>
---
 src/conf/node_device_conf.c          | 2 +-
 src/node_device/node_device_driver.c | 2 +-
 src/node_device/node_device_udev.c   | 2 ++
 src/util/virmdev.c                   | 2 +-
 src/util/virpci.c                    | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 9c7982c680..ec5d980978 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -3107,7 +3107,7 @@ virNodeDeviceSyncMdevActiveConfig(virNodeDeviceDef *def)
     }
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 
 int
 virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 123b16a292..592f72fe52 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -111,7 +111,7 @@ int nodeConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED)
     return 1;
 }
 
-#if defined (__linux__) && defined(WITH_UDEV)
+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(WITH_UDEV)
 /* NB: It was previously believed that changes in driver name were
  * relayed to libvirt as "change" events by udev, and the udev event
  * notification is setup to recognize such events and effectively
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 30c2ddf568..40c8ab14b1 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -431,6 +431,7 @@ udevProcessPCI(virNodeDeviceDriverState *driver_state,
     int ret = -1;
     char *p;
 
+#ifndef __FreeBSD__
     linkpath = g_strdup_printf("%s/config", udev_device_get_syspath(device));
     if (virFileWaitForExists(linkpath, 10, 100) < 0) {
         virReportSystemError(errno,
@@ -438,6 +439,7 @@ udevProcessPCI(virNodeDeviceDriverState *driver_state,
                              linkpath);
         goto cleanup;
     }
+#endif
 
     pci_dev->klass = -1;
     if (udevGetIntProperty(device, "PCI_CLASS", &pci_dev->klass, 16) < 0)
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index 6ecdbdf0ab..3a07ba75f2 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -565,7 +565,7 @@ virMediatedDeviceParentGetAddress(const char *sysfspath,
     return -1;
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 
 ssize_t
 virMediatedDeviceGetMdevTypes(const char *sysfspath,
diff --git a/src/util/virpci.c b/src/util/virpci.c
index b5bbe73ece..12af206f13 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2483,7 +2483,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
 }
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 
 virPCIDeviceAddress *
 virPCIGetDeviceAddressFromSysfsLink(const char *device_link)
-- 
2.46.1



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux