From 5fb2568d5b723fcd77861f14d4ba7de1978876a9 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 18 Feb 2015 14:22:55 -0700 Subject: [PATCH] gpfs: Introduce wrapper for gpfs_set_share MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Christof Schmitt Reviewed-by: Ralph Böhme --- source3/modules/gpfs.c | 21 ++++++++++++++------- source3/modules/vfs_gpfs.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c index 933d491e0a1..e2628a56d14 100644 --- a/source3/modules/gpfs.c +++ b/source3/modules/gpfs.c @@ -76,6 +76,16 @@ int gpfswrap_init(void) return 0; } +int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny) +{ + if (gpfs_set_share_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_share_fn(fd, allow, deny); +} + bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, uint32 share_access) { @@ -83,10 +93,6 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, 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; @@ -109,11 +115,12 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, 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); + result = gpfswrap_set_share(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")); + DEBUG(5, ("VFS module vfs_gpfs loaded, but gpfs " + "set_share function support not available. " + "Allowing access\n")); return True; } else { DEBUG(10, ("gpfs_set_share failed: %s\n", diff --git a/source3/modules/vfs_gpfs.h b/source3/modules/vfs_gpfs.h index 37b58f712c7..5ab9ff36497 100644 --- a/source3/modules/vfs_gpfs.h +++ b/source3/modules/vfs_gpfs.h @@ -28,6 +28,7 @@ #endif int gpfswrap_init(void); +int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny); bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, uint32 share_access); int set_gpfs_lease(int fd, int leasetype); -- 2.34.1