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>
if (!(modfile = virFileFindResourceFull(name,
"libvirt_driver_",
- ".so",
+ VIR_FILE_MODULE_EXT,
abs_top_builddir "/src",
DEFAULT_DRIVER_DIR,
"LIBVIRT_DRIVER_DIR")))
} else {
if (!(modfile = virFileFindResourceFull(name,
NULL,
- ".so",
+ VIR_FILE_MODULE_EXT,
abs_top_builddir "/src",
LIBDIR "/libvirt/lock-driver",
"LIBVIRT_LOCK_MANAGER_PLUGIN_DIR")))
if (!(modfile = virFileFindResourceFull(name,
"libvirt_storage_backend_",
- ".so",
+ VIR_FILE_MODULE_EXT,
abs_top_builddir "/src",
STORAGE_BACKEND_MODULE_DIR,
"LIBVIRT_STORAGE_BACKEND_DIR")))
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;
if (!(modfile = virFileFindResourceFull(name,
"libvirt_storage_file_",
- ".so",
+ VIR_FILE_MODULE_EXT,
abs_top_builddir "/src",
STORAGE_FILE_MODULE_DIR,
"LIBVIRT_STORAGE_FILE_DIR")))