gpfs: Introduce wrapper for gpfs_set_share
authorChristof Schmitt <cs@samba.org>
Wed, 18 Feb 2015 21:22:55 +0000 (14:22 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 2 Mar 2015 21:31:07 +0000 (22:31 +0100)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/gpfs.c
source3/modules/vfs_gpfs.h

index 933d491e0a1a81649518402e45168e1a91f3ed7e..e2628a56d14d5d53f025a546309a37299dc64606 100644 (file)
@@ -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",
index 37b58f712c743a4711be386182ffa16558c0114b..5ab9ff36497eb5782bcc513212b2086caea8e472 100644 (file)
@@ -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);