]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: use host module suffix when loading drivers
authorScott Shambarger <scott-libvirt@shambarger.net>
Tue, 25 Aug 2020 23:47:07 +0000 (16:47 -0700)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 26 Aug 2020 08:30:18 +0000 (10:30 +0200)
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@shambarger.net>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/driver.c
src/locking/lock_manager.c
src/storage/storage_backend.c
src/util/virfile.h
src/util/virstoragefilebackend.c

index 37bf9de3921200778a79e448d2062314684ef05d..1cacec24ff873c5922dcad30338cb0d856ef000d 100644 (file)
@@ -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")))
index 39e482f11cd1c6433b3c1bc54b053f1fb76b03fa..ada950e03e75a528028081ba0bee91e9f5448f01 100644 (file)
@@ -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")))
index 1f83236f2fc68afab18d6dbd5b04e4d7c8888f53..2bce44557593f80055a1be9a9c8088cd6734320c 100644 (file)
@@ -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")))
index 2eec89598f6bfe2d1c8597cecc34cc54c1bd3e92..09488398c53dd2eae92fe57e3b824976ab0ad6bd 100644 (file)
@@ -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;
index bf452a1dc5dc315322bb98ffd9b8d4ef007e88bb..2779b5c30791feb4b2688c614ed82ec07fdd2745 100644 (file)
@@ -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")))