[PATCH v2] util: use host module suffix when loading drivers

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

 



Driver module loaders current hardcode ".so" as the file
extension.  On MacOS, meson uses ".dylib" as a module file extension.
This patch adds VIR_FILE_MODULE_EXT to virfile.h defined as the
hosts module extension, and updates driver module loaders to make
use of it.

Signed-off-by: Scott Shambarger <scott-libvirt@xxxxxxxxxxxxxx>
---
 src/driver.c                     | 2 +-
 src/locking/lock_manager.c       | 2 +-
 src/storage/storage_backend.c    | 2 +-
 src/util/virfile.h               | 6 ++++++
 src/util/virstoragefilebackend.c | 2 +-
 5 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/driver.c b/src/driver.c
index 37bf9de392..1cacec24ff 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -55,7 +55,7 @@ virDriverLoadModule(const char *name,
 
     if (!(modfile = virFileFindResourceFull(name,
                                             "libvirt_driver_",
-                                            ".so",
+                                            VIR_FILE_MODULE_EXT,
                                             abs_top_builddir "/src",
                                             DEFAULT_DRIVER_DIR,
                                             "LIBVIRT_DRIVER_DIR")))
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index 39e482f11c..ada950e03e 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -138,7 +138,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
     } else {
         if (!(modfile = virFileFindResourceFull(name,
                                                 NULL,
-                                                ".so",
+                                                VIR_FILE_MODULE_EXT,
                                                 abs_top_builddir "/src",
                                                 LIBDIR "/libvirt/lock-driver",
                                                 "LIBVIRT_LOCK_MANAGER_PLUGIN_DIR")))
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 1f83236f2f..2bce445575 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -91,7 +91,7 @@ virStorageDriverLoadBackendModule(const char *name,
 
     if (!(modfile = virFileFindResourceFull(name,
                                             "libvirt_storage_backend_",
-                                            ".so",
+                                            VIR_FILE_MODULE_EXT,
                                             abs_top_builddir "/src",
                                             STORAGE_BACKEND_MODULE_DIR,
                                             "LIBVIRT_STORAGE_BACKEND_DIR")))
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 2eec89598f..09488398c5 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -36,6 +36,12 @@ typedef enum {
     VIR_FILE_CLOSE_DONT_LOG = 1 << 2,
 } virFileCloseFlags;
 
+#ifdef __APPLE__
+# define VIR_FILE_MODULE_EXT ".dylib"
+#else
+# define VIR_FILE_MODULE_EXT ".so"
+#endif
+
 ssize_t saferead(int fd, void *buf, size_t count) G_GNUC_WARN_UNUSED_RESULT;
 ssize_t safewrite(int fd, const void *buf, size_t count)
     G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/util/virstoragefilebackend.c b/src/util/virstoragefilebackend.c
index bf452a1dc5..2779b5c307 100644
--- a/src/util/virstoragefilebackend.c
+++ b/src/util/virstoragefilebackend.c
@@ -56,7 +56,7 @@ virStorageFileLoadBackendModule(const char *name,
 
     if (!(modfile = virFileFindResourceFull(name,
                                             "libvirt_storage_file_",
-                                            ".so",
+                                            VIR_FILE_MODULE_EXT,
                                             abs_top_builddir "/src",
                                             STORAGE_FILE_MODULE_DIR,
                                             "LIBVIRT_STORAGE_FILE_DIR")))
-- 
2.24.3 (Apple Git-128)





[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