mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
Use virFileFindResource to locate lock manager plugins
Replace virLockManagerSetPluginDir with virFileFindResource usage. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
c8e22a4c77
commit
d3c7684220
@ -1179,7 +1179,6 @@ int main(int argc, char **argv) {
|
||||
argv[0], driverdir);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
virLockManagerSetPluginDir(driverdir);
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
virDriverModuleInitialize(driverdir);
|
||||
#endif
|
||||
|
@ -840,7 +840,6 @@ virLockManagerPluginRef;
|
||||
virLockManagerPluginUnref;
|
||||
virLockManagerPluginUsesState;
|
||||
virLockManagerRelease;
|
||||
virLockManagerSetPluginDir;
|
||||
|
||||
|
||||
# nodeinfo.h
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "lock_manager.h"
|
||||
#include "lock_driver_nop.h"
|
||||
#include "virerror.h"
|
||||
#include "virfile.h"
|
||||
#include "virlog.h"
|
||||
#include "viralloc.h"
|
||||
#include "viruuid.h"
|
||||
@ -64,18 +65,6 @@ struct _virLockManagerPlugin {
|
||||
int refs;
|
||||
};
|
||||
|
||||
#define DEFAULT_LOCK_MANAGER_PLUGIN_DIR LIBDIR "/libvirt/lock-driver"
|
||||
|
||||
static const char *virLockManagerPluginDir = DEFAULT_LOCK_MANAGER_PLUGIN_DIR;
|
||||
|
||||
void
|
||||
virLockManagerSetPluginDir(const char *dir)
|
||||
{
|
||||
if (dir)
|
||||
virLockManagerPluginDir = dir;
|
||||
}
|
||||
|
||||
|
||||
static void virLockManagerLogParams(size_t nparams,
|
||||
virLockManagerParamPtr params)
|
||||
{
|
||||
@ -137,7 +126,6 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
|
||||
void *handle = NULL;
|
||||
virLockDriverPtr driver;
|
||||
virLockManagerPluginPtr plugin = NULL;
|
||||
const char *moddir = virGetEnvBlockSUID("LIBVIRT_LOCK_MANAGER_PLUGIN_DIR");
|
||||
char *modfile = NULL;
|
||||
char *configFile = NULL;
|
||||
|
||||
@ -151,14 +139,16 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
|
||||
if (STREQ(name, "nop")) {
|
||||
driver = &virLockDriverNop;
|
||||
} else {
|
||||
if (moddir == NULL)
|
||||
moddir = virLockManagerPluginDir;
|
||||
|
||||
VIR_DEBUG("Module load %s from %s", name, moddir);
|
||||
|
||||
if (virAsprintf(&modfile, "%s/%s.so", moddir, name) < 0)
|
||||
if (!(modfile = virFileFindResourceFull(name,
|
||||
NULL,
|
||||
".so",
|
||||
"src/.libs",
|
||||
LIBDIR "/libvirt/lock-driver",
|
||||
"LIBVIRT_LOCK_MANAGER_PLUGIN_DIR")))
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Module load %s from %s", name, modfile);
|
||||
|
||||
if (access(modfile, R_OK) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Plugin %s not accessible"),
|
||||
|
@ -28,7 +28,6 @@
|
||||
typedef struct _virLockManagerPlugin virLockManagerPlugin;
|
||||
typedef virLockManagerPlugin *virLockManagerPluginPtr;
|
||||
|
||||
void virLockManagerSetPluginDir(const char *dir);
|
||||
virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
|
||||
const char *driverName,
|
||||
const char *configDir,
|
||||
|
Loading…
Reference in New Issue
Block a user