mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
Search for gpfs functions in both libgpfs_gpl.so an libgpfs.so
As of GPFS 3.2.1 PTF8 libgpfs will be available as GPL, so we don't need the special libgpfs_gpl lib anymore. For backwards compatibility with pre-PTF8 GPFS installations, still look there.
This commit is contained in:
parent
26461a72da
commit
51b840a07e
@ -24,7 +24,6 @@
|
|||||||
#include "gpfs_gpl.h"
|
#include "gpfs_gpl.h"
|
||||||
#include "vfs_gpfs.h"
|
#include "vfs_gpfs.h"
|
||||||
|
|
||||||
static void *libgpfs_handle = NULL;
|
|
||||||
static bool gpfs_share_modes;
|
static bool gpfs_share_modes;
|
||||||
static bool gpfs_leases;
|
static bool gpfs_leases;
|
||||||
|
|
||||||
@ -135,65 +134,64 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
|
|||||||
return gpfs_putacl_fn(pathname, flags, acl);
|
return gpfs_putacl_fn(pathname, flags, acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool init_gpfs_function_lib(void *plibhandle_pointer,
|
||||||
|
const char *libname,
|
||||||
|
void *pfn_pointer, const char *fn_name)
|
||||||
|
{
|
||||||
|
bool did_open_here = false;
|
||||||
|
void **libhandle_pointer = (void **)plibhandle_pointer;
|
||||||
|
void **fn_pointer = (void **)pfn_pointer;
|
||||||
|
|
||||||
|
if (*libhandle_pointer == NULL) {
|
||||||
|
*libhandle_pointer = dlopen(libname, RTLD_LAZY);
|
||||||
|
did_open_here = true;
|
||||||
|
}
|
||||||
|
if (*libhandle_pointer == NULL) {
|
||||||
|
DEBUG(10, ("Could not open lib %s\n", libname));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*fn_pointer = dlsym(*libhandle_pointer, fn_name);
|
||||||
|
if (*fn_pointer == NULL) {
|
||||||
|
DEBUG(10, ("Did not find symbol %s in lib %s\n",
|
||||||
|
fn_name, libname));
|
||||||
|
if (did_open_here) {
|
||||||
|
dlclose(*libhandle_pointer);
|
||||||
|
*libhandle_pointer = NULL;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool init_gpfs_function(void *fn_pointer, const char *fn_name)
|
||||||
|
{
|
||||||
|
static void *libgpfs_handle = NULL;
|
||||||
|
static void *libgpfs_gpl_handle = NULL;
|
||||||
|
|
||||||
|
if (init_gpfs_function_lib(&libgpfs_handle, "libgpfs.so",
|
||||||
|
fn_pointer, fn_name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (init_gpfs_function_lib(&libgpfs_gpl_handle, "libgpfs_gpl.so",
|
||||||
|
fn_pointer, fn_name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void init_gpfs(void)
|
void init_gpfs(void)
|
||||||
{
|
{
|
||||||
if (libgpfs_handle != NULL) {
|
init_gpfs_function(&gpfs_set_share_fn, "gpfs_set_share");
|
||||||
return;
|
init_gpfs_function(&gpfs_set_lease_fn, "gpfs_set_lease");
|
||||||
}
|
init_gpfs_function(&gpfs_getacl_fn, "gpfs_getacl");
|
||||||
|
init_gpfs_function(&gpfs_putacl_fn, "gpfs_putacl");
|
||||||
libgpfs_handle = dlopen("libgpfs_gpl.so", RTLD_LAZY);
|
|
||||||
|
|
||||||
if (libgpfs_handle == NULL) {
|
|
||||||
DEBUG(10, ("dlopen for libgpfs_gpl failed: %s\n",
|
|
||||||
strerror(errno)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG(10, ("libgpfs_gpl.so loaded\n"));
|
|
||||||
|
|
||||||
gpfs_set_share_fn = dlsym(libgpfs_handle, "gpfs_set_share");
|
|
||||||
if (gpfs_set_share_fn == NULL) {
|
|
||||||
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
|
|
||||||
"'gpfs_set_share'\n"));
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpfs_set_lease_fn = dlsym(libgpfs_handle, "gpfs_set_lease");
|
|
||||||
if (gpfs_set_lease_fn == NULL) {
|
|
||||||
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
|
|
||||||
"'gpfs_set_lease'\n"));
|
|
||||||
dlclose(libgpfs_handle);
|
|
||||||
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpfs_getacl_fn = dlsym(libgpfs_handle, "gpfs_getacl");
|
|
||||||
if (gpfs_getacl_fn == NULL) {
|
|
||||||
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
|
|
||||||
"'gpfs_getacl'\n"));
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpfs_putacl_fn = dlsym(libgpfs_handle, "gpfs_putacl");
|
|
||||||
if (gpfs_putacl_fn == NULL) {
|
|
||||||
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
|
|
||||||
"'gpfs_putacl'\n"));
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
|
gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
|
||||||
gpfs_leases = lp_parm_bool(-1, "gpfs", "leases", True);
|
gpfs_leases = lp_parm_bool(-1, "gpfs", "leases", True);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
failed:
|
|
||||||
dlclose(libgpfs_handle);
|
|
||||||
/* leave libgpfs_handle != NULL around, no point
|
|
||||||
in trying twice */
|
|
||||||
gpfs_set_share_fn = NULL;
|
|
||||||
gpfs_set_lease_fn = NULL;
|
|
||||||
gpfs_getacl_fn = NULL;
|
|
||||||
gpfs_putacl_fn = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user