gpfs: Move set_gpfs_sharemode to vfs_gpfs.c
authorChristof Schmitt <cs@samba.org>
Wed, 10 Dec 2014 22:49:25 +0000 (15:49 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 2 Mar 2015 21:31:08 +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.c
source3/modules/vfs_gpfs.h

index 44bf6b35e2c4287d868cd6437b7c9d3928f2211d..585c522f641e9bb7f0060db3e56826dc28165f0f 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <fcntl.h>
 #include <gpfs_fcntl.h>
-#include "libcli/security/security.h"
 #include "vfs_gpfs.h"
 
 static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
@@ -230,51 +229,6 @@ int gpfswrap_getfilesetid(char *pathname, char *name, int *idp)
        return gpfs_getfilesetid_fn(pathname, name, 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 ((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 = gpfswrap_set_share(fsp->fh->fd, allow, deny);
-       if (result != 0) {
-               if (errno == ENOSYS) {
-                       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",
-                                  strerror(errno)));
-               }
-       }
-
-       return (result == 0);
-}
-
 int set_gpfs_lease(int fd, int leasetype)
 {
        int gpfs_type = GPFS_LEASE_NONE;
index 883894d5a4a9f66c8c8b4da04e6d20e4b6265462..053b673d71766a847ce66b5137ca4ca649205931 100644 (file)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/ndr_xattr.h"
 #include "include/smbprofile.h"
 #include "modules/non_posix_acls.h"
+#include "libcli/security/security.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -71,6 +72,51 @@ static inline gpfs_ace_v4_t *gpfs_ace_ptr(gpfs_acl_t *gacl, unsigned int i)
        return &gacl->ace_v4[i];
 }
 
+static 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 ((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 = gpfswrap_set_share(fsp->fh->fd, allow, deny);
+       if (result != 0) {
+               if (errno == ENOSYS) {
+                       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",
+                                  strerror(errno)));
+               }
+       }
+
+       return (result == 0);
+}
+
 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
                                 uint32 share_mode, uint32 access_mask)
 {
index 5c7dc1b4ddd739d227218948ae503ccbe25a9a82..61389b9618aa36df8edd3d75948c0f465d642ba4 100644 (file)
@@ -45,8 +45,6 @@ int gpfswrap_set_times_path(char *pathname, int flags,
 int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp);
 int gpfswrap_fcntl(int fd, void *argp);
 int gpfswrap_getfilesetid(char *pathname, char *name, int *idp);
-bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
-                       uint32 share_access);
 int set_gpfs_lease(int fd, int leasetype);
 int get_gpfs_quota(const char *pathname, int type, int id,
                   struct gpfs_quotaInfo *qi);