[SCM] Samba Shared Repository - branch master updated
Christof Schmitt
cs at samba.org
Mon Mar 2 17:02:04 MST 2015
The branch, master has been updated
via 3c2cf5e gpfs: Add include guard to gpfswrap.h
via a11fed1 gpfs: Rename library wrapper to gpfswrap
via b765b17 gpfs: Update file headers
via 5e022bc gpfs: Remove unncessary includes from gpfs.c
via d93767f gpfs: Move DBGC_CLASS definition below includes
via b69957d gpfs: Include gpfs_fcntl.h only from vfs_gpfs header file
via f508f27 gpfs: Move definition of GPFS_GETACL_NATIVE to vfs_gpfs.c
via 38a89f2 gpfs: Move smbd_gpfs_set_times_path to vfs_gpfs.c
via a5ca63b gpfs: Move get_gpfs_fset_id to vfs_gpfs.c
via a36c46d gpfs: Move get_gpfs_quota to vfs_gpfs.c
via 9948163 gpfs: Move set_gpfs_lease to vfs_gpfs.c
via f9629ae gpfs: Move set_gpfs_sharemode to vfs_gpfs.c
via 2699106 gpfs: Introduce wrapper for gpfs_getfilesetid
via e30d501 gpfs: Introduce wrapper for gpfs_fcntl
via c4f1f3b gpfs: Introduce wrapper for gpfs_quotactl
via 1907a88 gpfs: Introduce wrapper for gpfs_set_times_path
via db01831 gpfs: Rename wrapper for gpfs_lib_init
via eefb916 gpfs: Rename wrapper for gpfs_ftruncate
via 15c2b3a gpfs: Rename wrapper for gpfs_prealloc
via 4d57c20 gpfs: Rename wrapper for gpfs_get_winattrs
via 2cecf08 gpfs: Rename wrapper for gpfs_get_winattrs_path
via e9e87d4 gpfs: Rename wrapper for gpfs_set_winattrs_path
via fdd6078 gpfs: Rename wrapper for gpfs_get_realfilename_path
via 5fa1ee8 gpfs: Rename wrapper for gpfs_putacl
via d266ad1 gpfs: Rename wrapper for gpfs_getacl
via 193b5dd gpfs: Introduce wrapper for gpfs_set_lease
via 5fb2568 gpfs: Introduce wrapper for gpfs_set_share
via ca69d43 gpfs: Simplify initialization for gpfs library wrapper
via 4a89e84 gpfs: Remove search for libgpfs_gpl.so
via f826c86 gpfs: Look for gpfs header files also in /usr/lpp/mmfs/include/
via 1264a4e gpfs: Always use gpfs_fcntl.h headerfile
from f5a0ccc selftest: re-enable nsswrapper integration testing for dc and member environments.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3c2cf5e0d637186f9b2855efc518f4a1cf4997a2
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:29:45 2015 -0700
gpfs: Add include guard to gpfswrap.h
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Tue Mar 3 01:01:25 CET 2015 on sn-devel-104
commit a11fed1671a3f00506438b180d3b6c009093a04f
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 16:05:16 2014 -0700
gpfs: Rename library wrapper to gpfswrap
The code in gpfs.c and vfs_gpfs.h now only wraps the gpfs library.
Rename the files to gpfswrap to make it clear that this is the only
purpose of that file.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit b765b17feaa2e002c87353b720158e7e39ffef7d
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:25:02 2015 -0700
gpfs: Update file headers
Update file headers to reflect the new code organization and reformat
for consistency.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 5e022bc339c9ed665eb98a9b9a5e024d58d5cea4
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:24:56 2015 -0700
gpfs: Remove unncessary includes from gpfs.c
replace.h provides everything that is required (errno and ENOSYS).
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit d93767fe8f4edd3a2d68f4886df362a6729511c5
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:24:50 2015 -0700
gpfs: Move DBGC_CLASS definition below includes
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit b69957d65d6dd2fdb76b404b886a7c224e714dda
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:24:44 2015 -0700
gpfs: Include gpfs_fcntl.h only from vfs_gpfs header file
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit f508f273b24d90809dffd7dabf22a96dbeeeaf86
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 15:24:35 2015 -0700
gpfs: Move definition of GPFS_GETACL_NATIVE to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 38a89f23f1ac5e317266c66d6c08c31213afeb54
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:56:30 2014 -0700
gpfs: Move smbd_gpfs_set_times_path to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit a5ca63b266bd11c2523463bcd20a1a638afea845
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:55:19 2014 -0700
gpfs: Move get_gpfs_fset_id to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit a36c46d9db70ab3633fd074e88e1e832c63fe8ee
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:51:17 2014 -0700
gpfs: Move get_gpfs_quota to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 9948163a64a564de6f423a915dc3dcaae44e3675
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:50:14 2014 -0700
gpfs: Move set_gpfs_lease to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit f9629aee81084d4af39858c83eaf966e72e9e0f0
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:49:25 2014 -0700
gpfs: Move set_gpfs_sharemode to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 26991065f24e5beedfe4d60b98d5c24127be6ec5
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:47:46 2014 -0700
gpfs: Introduce wrapper for gpfs_getfilesetid
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit e30d5012170cd99cbd71ffac4392e7e799e43a9c
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:46:07 2014 -0700
gpfs: Introduce wrapper for gpfs_fcntl
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit c4f1f3b2534c3a99202772e5dad783e0c52fbd08
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:42:32 2014 -0700
gpfs: Introduce wrapper for gpfs_quotactl
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 1907a88a6d4f6fa62a4332cb6e15ff1e6874fc03
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:40:16 2014 -0700
gpfs: Introduce wrapper for gpfs_set_times_path
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit db01831082f3120649d742b21aaff9c90fd3cdf0
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:34:59 2014 -0700
gpfs: Rename wrapper for gpfs_lib_init
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit eefb916192d7e58c21bee35ef3420a4b3f0a3ae0
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:33:23 2014 -0700
gpfs: Rename wrapper for gpfs_ftruncate
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 15c2b3a825b2f24629d1bc22d2bdcfec494cde13
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:31:42 2014 -0700
gpfs: Rename wrapper for gpfs_prealloc
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 4d57c20ba8450b3eb4fdf0bbd9c922ae5d02312b
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:29:19 2014 -0700
gpfs: Rename wrapper for gpfs_get_winattrs
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 2cecf08298cb0e14b1520a15be89365b6e32d492
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:27:05 2014 -0700
gpfs: Rename wrapper for gpfs_get_winattrs_path
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit e9e87d456aeb9acd36d352378b615769444809d3
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:22:27 2014 -0700
gpfs: Rename wrapper for gpfs_set_winattrs_path
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit fdd6078ddda15e4cc6eae4ce35774dbe94da0950
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:15:53 2014 -0700
gpfs: Rename wrapper for gpfs_get_realfilename_path
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 5fa1ee8b7b089c67fd2fb80dd312a9a7d19c8d29
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:11:18 2014 -0700
gpfs: Rename wrapper for gpfs_putacl
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit d266ad1e4bcbd7d255aac8d798f332bf56be294d
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:09:07 2014 -0700
gpfs: Rename wrapper for gpfs_getacl
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 193b5dd143da3a1c4e22aa115935b437500c952c
Author: Christof Schmitt <cs at samba.org>
Date: Wed Dec 10 15:06:02 2014 -0700
gpfs: Introduce wrapper for gpfs_set_lease
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 5fb2568d5b723fcd77861f14d4ba7de1978876a9
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 14:22:55 2015 -0700
gpfs: Introduce wrapper for gpfs_set_share
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit ca69d43dfd13ddc4d501d3e36944f56e13e75c0f
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 10:14:22 2015 -0700
gpfs: Simplify initialization for gpfs library wrapper
Merge the code for initializing the function pointers in one function.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 4a89e8452ecbcb09d3e14ffb324bcfbed6328c7d
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 10:13:55 2015 -0700
gpfs: Remove search for libgpfs_gpl.so
Similar to the header files, libgpfs_gpl.so no longer exists. The
library is now always called libgpfs.so.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit f826c86bf1dcaf47a2c4f42eb4647ca6e1ad75aa
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 10:13:33 2015 -0700
gpfs: Look for gpfs header files also in /usr/lpp/mmfs/include/
That is the default directory for the gpfs header files.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
commit 1264a4efd9a407869bf34c13b3883c544b6ff948
Author: Christof Schmitt <cs at samba.org>
Date: Wed Feb 18 10:12:43 2015 -0700
gpfs: Always use gpfs_fcntl.h headerfile
gpfs_gpl.h no longer exists, everything from that header file has been
merged to gpfs.h. gpfs_fcntl.h implicitly includes gpfs.h. Simplify the
code by only looking for gpfs_fcntl.h and including that file.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Ralph Böhme <slow at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/gpfs.c | 406 ------------------------------------------
source3/modules/gpfswrap.c | 226 +++++++++++++++++++++++
source3/modules/gpfswrap.h | 48 +++++
source3/modules/vfs_gpfs.c | 282 +++++++++++++++++++++++------
source3/modules/vfs_gpfs.h | 48 -----
source3/modules/wscript_build | 5 +-
source3/wscript | 3 +-
7 files changed, 511 insertions(+), 507 deletions(-)
delete mode 100644 source3/modules/gpfs.c
create mode 100644 source3/modules/gpfswrap.c
create mode 100644 source3/modules/gpfswrap.h
delete mode 100644 source3/modules/vfs_gpfs.h
Changeset truncated at 500 lines:
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
deleted file mode 100644
index 284e65b..0000000
--- a/source3/modules/gpfs.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * Provide a connection to GPFS specific features
- * Copyright (C) Volker Lendecke 2005
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "system/filesys.h"
-#include "smbd/smbd.h"
-
-#include <fcntl.h>
-#include "libcli/security/security.h"
-#include "gpfs_fcntl.h"
-#include "gpfs_gpl.h"
-#include "vfs_gpfs.h"
-
-static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
-static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
-static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl);
-static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl);
-static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep,
- int *buflen);
-static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, struct gpfs_winattr *attrs);
-static int (*gpfs_get_winattrs_path_fn)(char *pathname, struct gpfs_winattr *attrs);
-static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
-static int (*gpfs_prealloc_fn)(int fd, gpfs_off64_t startOffset, gpfs_off64_t bytesToPrealloc);
-static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
-static int (*gpfs_lib_init_fn)(int flags);
-static int (*gpfs_set_times_path_fn)(char *pathname, int flags,
- gpfs_timestruc_t times[4]);
-static int (*gpfs_quotactl_fn)(char *pathname, int cmd, int id, void *bufferP);
-static int (*gpfs_fcntl_fn)(gpfs_file_t fileDesc, void *fcntlArgP);
-static int (*gpfs_getfilesetid_fn)(char *pathname, char *name, int *idP);
-
-bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
- uint32 share_access)
-{
- unsigned int allow = GPFS_SHARE_NONE;
- unsigned int deny = GPFS_DENY_NONE;
- int result;
-
- if (gpfs_set_share_fn == NULL) {
- return False;
- }
-
- if ((fsp == NULL) || (fsp->fh == NULL) || (fsp->fh->fd < 0)) {
- /* No real file, don't disturb */
- return True;
- }
-
- allow |= (access_mask & (FILE_WRITE_DATA|FILE_APPEND_DATA|
- DELETE_ACCESS)) ? GPFS_SHARE_WRITE : 0;
- allow |= (access_mask & (FILE_READ_DATA|FILE_EXECUTE)) ?
- GPFS_SHARE_READ : 0;
-
- if (allow == GPFS_SHARE_NONE) {
- DEBUG(10, ("special case am=no_access:%x\n",access_mask));
- }
- else {
- deny |= (share_access & FILE_SHARE_WRITE) ?
- 0 : GPFS_DENY_WRITE;
- deny |= (share_access & (FILE_SHARE_READ)) ?
- 0 : GPFS_DENY_READ;
- }
- DEBUG(10, ("am=%x, allow=%d, sa=%x, deny=%d\n",
- access_mask, allow, share_access, deny));
-
- result = gpfs_set_share_fn(fsp->fh->fd, allow, deny);
- if (result != 0) {
- if (errno == ENOSYS) {
- DEBUG(5, ("VFS module vfs_gpfs loaded, but no gpfs "
- "support has been compiled into Samba. Allowing access\n"));
- return True;
- } else {
- DEBUG(10, ("gpfs_set_share failed: %s\n",
- strerror(errno)));
- }
- }
-
- return (result == 0);
-}
-
-int set_gpfs_lease(int fd, int leasetype)
-{
- int gpfs_type = GPFS_LEASE_NONE;
-
- if (gpfs_set_lease_fn == NULL) {
- errno = EINVAL;
- return -1;
- }
-
- if (leasetype == F_RDLCK) {
- gpfs_type = GPFS_LEASE_READ;
- }
- if (leasetype == F_WRLCK) {
- gpfs_type = GPFS_LEASE_WRITE;
- }
-
- /* we unconditionally set CAP_LEASE, rather than looking for
- -1/EACCES as there is a bug in some versions of
- libgpfs_gpl.so which results in a leaked fd on /dev/ss0
- each time we try this with the wrong capabilities set
- */
- linux_set_lease_capability();
- return gpfs_set_lease_fn(fd, gpfs_type);
-}
-
-int smbd_gpfs_getacl(char *pathname, int flags, void *acl)
-{
- if (gpfs_getacl_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_getacl_fn(pathname, flags, acl);
-}
-
-int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
-{
- if (gpfs_putacl_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_putacl_fn(pathname, flags, acl);
-}
-
-int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length)
-{
- if (gpfs_ftruncate_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_ftruncate_fn(fd, length);
-}
-
-int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
- int *buflen)
-{
- if (gpfs_get_realfilename_path_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_get_realfilename_path_fn(pathname, filenamep, buflen);
-}
-
-int get_gpfs_winattrs(char *pathname,struct gpfs_winattr *attrs)
-{
- if (gpfs_get_winattrs_path_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
- DEBUG(10, ("gpfs_get_winattrs_path:open call %s\n",pathname));
- return gpfs_get_winattrs_path_fn(pathname, attrs);
-}
-
-int smbd_fget_gpfs_winattrs(int fd, struct gpfs_winattr *attrs)
-{
- if (gpfs_get_winattrs_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
- DEBUG(10, ("gpfs_get_winattrs:open call %d\n", fd));
- return gpfs_get_winattrs_fn(fd, attrs);
-}
-
-int smbd_gpfs_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes)
-{
- if (gpfs_prealloc_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_prealloc_fn(fd, start, bytes);
-}
-
-int set_gpfs_winattrs(char *pathname,int flags,struct gpfs_winattr *attrs)
-{
- if (gpfs_set_winattrs_path_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- DEBUG(10, ("gpfs_set_winattrs_path:open call %s\n",pathname));
- return gpfs_set_winattrs_path_fn(pathname,flags, attrs);
-}
-
-int get_gpfs_quota(const char *pathname, int type, int id,
- struct gpfs_quotaInfo *qi)
-{
- int ret;
-
- if (!gpfs_quotactl_fn) {
- errno = ENOSYS;
- return -1;
- }
-
- ZERO_STRUCTP(qi);
- ret = gpfs_quotactl_fn(discard_const_p(char, pathname),
- GPFS_QCMD(Q_GETQUOTA, type), id, qi);
-
- if (ret) {
- if (errno == GPFS_E_NO_QUOTA_INST) {
- DEBUG(10, ("Quotas disabled on GPFS filesystem.\n"));
- } else {
- DEBUG(0, ("Get quota failed, type %d, id, %d, "
- "errno %d.\n", type, id, errno));
- }
-
- return ret;
- }
-
- DEBUG(10, ("quota type %d, id %d, blk u:%lld h:%lld s:%lld gt:%u\n",
- type, id, qi->blockUsage, qi->blockHardLimit,
- qi->blockSoftLimit, qi->blockGraceTime));
-
- return ret;
-}
-
-int get_gpfs_fset_id(const char *pathname, int *fset_id)
-{
- int err, fd, errno_fcntl;
-
- struct {
- gpfsFcntlHeader_t hdr;
- gpfsGetFilesetName_t fsn;
- } arg;
-
- if (!gpfs_fcntl_fn || !gpfs_getfilesetid_fn) {
- errno = ENOSYS;
- return -1;
- }
-
- arg.hdr.totalLength = sizeof(arg);
- arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
- arg.hdr.fcntlReserved = 0;
- arg.fsn.structLen = sizeof(arg.fsn);
- arg.fsn.structType = GPFS_FCNTL_GET_FILESETNAME;
-
- fd = open(pathname, O_RDONLY);
- if (fd == -1) {
- DEBUG(1, ("Could not open %s: %s\n",
- pathname, strerror(errno)));
- return fd;
- }
-
- err = gpfs_fcntl_fn(fd, &arg);
- errno_fcntl = errno;
- close(fd);
-
- if (err) {
- errno = errno_fcntl;
- DEBUG(1, ("GPFS_FCNTL_GET_FILESETNAME for %s failed: %s\n",
- pathname, strerror(errno)));
- return err;
- }
-
- err = gpfs_getfilesetid_fn(discard_const_p(char, pathname),
- arg.fsn.buffer, fset_id);
- if (err) {
- DEBUG(1, ("gpfs_getfilesetid for %s failed: %s\n",
- pathname, strerror(errno)));
- }
- return err;
-}
-
-void smbd_gpfs_lib_init()
-{
- if (gpfs_lib_init_fn) {
- int rc = gpfs_lib_init_fn(0);
- DEBUG(10, ("gpfs_lib_init() finished with rc %d "
- "and errno %d\n", rc, errno));
- } else {
- DEBUG(10, ("libgpfs lacks gpfs_lib_init\n"));
- }
-}
-
-static void timespec_to_gpfs_time(struct timespec ts, gpfs_timestruc_t *gt,
- int idx, int *flags)
-{
- if (!null_timespec(ts)) {
- *flags |= 1 << idx;
- gt[idx].tv_sec = ts.tv_sec;
- gt[idx].tv_nsec = ts.tv_nsec;
- DEBUG(10, ("Setting GPFS time %d, flags 0x%x\n", idx, *flags));
- }
-}
-
-int smbd_gpfs_set_times_path(char *path, struct smb_file_time *ft)
-{
- gpfs_timestruc_t gpfs_times[4];
- int flags = 0;
- int rc;
-
- if (!gpfs_set_times_path_fn) {
- errno = ENOSYS;
- return -1;
- }
-
- ZERO_ARRAY(gpfs_times);
- timespec_to_gpfs_time(ft->atime, gpfs_times, 0, &flags);
- timespec_to_gpfs_time(ft->mtime, gpfs_times, 1, &flags);
- /* No good mapping from LastChangeTime to ctime, not storing */
- timespec_to_gpfs_time(ft->create_time, gpfs_times, 3, &flags);
-
- if (!flags) {
- DEBUG(10, ("nothing to do, return to avoid EINVAL\n"));
- return 0;
- }
-
- rc = gpfs_set_times_path_fn(path, flags, gpfs_times);
-
- if (rc != 0) {
- DEBUG(1,("gpfs_set_times() returned with error %s\n",
- strerror(errno)));
- }
-
- return rc;
-}
-
-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;
-
- DEBUG(10, ("trying to load name %s from %s\n",
- fn_name, libname));
-
- 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)
-{
- init_gpfs_function(&gpfs_set_share_fn, "gpfs_set_share");
- 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");
- init_gpfs_function(&gpfs_get_realfilename_path_fn,
- "gpfs_get_realfilename_path");
- init_gpfs_function(&gpfs_get_winattrs_path_fn,"gpfs_get_winattrs_path");
- init_gpfs_function(&gpfs_set_winattrs_path_fn,"gpfs_set_winattrs_path");
- init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs");
- init_gpfs_function(&gpfs_prealloc_fn, "gpfs_prealloc");
- init_gpfs_function(&gpfs_ftruncate_fn, "gpfs_ftruncate");
- init_gpfs_function(&gpfs_lib_init_fn,"gpfs_lib_init");
- init_gpfs_function(&gpfs_set_times_path_fn, "gpfs_set_times_path");
- init_gpfs_function(&gpfs_quotactl_fn, "gpfs_quotactl");
- init_gpfs_function(&gpfs_fcntl_fn, "gpfs_fcntl");
- init_gpfs_function(&gpfs_getfilesetid_fn, "gpfs_getfilesetid");
-
- return;
-}
diff --git a/source3/modules/gpfswrap.c b/source3/modules/gpfswrap.c
new file mode 100644
index 0000000..aac2f44
--- /dev/null
+++ b/source3/modules/gpfswrap.c
@@ -0,0 +1,226 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Wrapper for GPFS library
+ * Copyright (C) Volker Lendecke 2005
+ * Copyright (C) Christof Schmitt 2015
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "replace.h"
+#include "gpfswrap.h"
+
+static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
+static int (*gpfs_set_lease_fn)(int fd, unsigned int type);
+static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl);
+static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl);
+static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep,
+ int *len);
+static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags,
+ struct gpfs_winattr *attrs);
+static int (*gpfs_get_winattrs_path_fn)(char *pathname,
+ struct gpfs_winattr *attrs);
+static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
+static int (*gpfs_prealloc_fn)(int fd, gpfs_off64_t start, gpfs_off64_t bytes);
+static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
+static int (*gpfs_lib_init_fn)(int flags);
+static int (*gpfs_set_times_path_fn)(char *pathname, int flags,
+ gpfs_timestruc_t times[4]);
+static int (*gpfs_quotactl_fn)(char *pathname, int cmd, int id, void *bufp);
+static int (*gpfs_fcntl_fn)(int fd, void *argp);
+static int (*gpfs_getfilesetid_fn)(char *pathname, char *name, int *idp);
+
+int gpfswrap_init(void)
+{
+ static void *l;
+
+ if (l != NULL) {
+ return 0;
+ }
+
+ l = dlopen("libgpfs.so", RTLD_LAZY);
+ if (l == NULL) {
+ return -1;
+ }
+
+ gpfs_set_share_fn = dlsym(l, "gpfs_set_share");
+ gpfs_set_lease_fn = dlsym(l, "gpfs_set_lease");
+ gpfs_getacl_fn = dlsym(l, "gpfs_getacl");
+ gpfs_putacl_fn = dlsym(l, "gpfs_putacl");
+ gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path");
+ gpfs_set_winattrs_path_fn = dlsym(l, "gpfs_set_winattrs_path");
+ gpfs_get_winattrs_path_fn = dlsym(l, "gpfs_get_winattrs_path");
+ gpfs_get_winattrs_fn = dlsym(l, "gpfs_get_winattrs");
+ gpfs_prealloc_fn = dlsym(l, "gpfs_prealloc");
+ gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate");
+ gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init");
+ gpfs_set_times_path_fn = dlsym(l, "gpfs_set_times_path");
+ gpfs_quotactl_fn = dlsym(l, "gpfs_quotactl");
+ gpfs_fcntl_fn = dlsym(l, "gpfs_fcntl");
+ gpfs_getfilesetid_fn = dlsym(l, "gpfs_getfilesetid");
+
+ return 0;
+}
+
+int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny)
+{
+ if (gpfs_set_share_fn == NULL) {
+ errno = ENOSYS;
+ return -1;
+ }
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list