s3: Add access_mask to the flock VFS call
authorAbhidnya P Chirmule <achirmul@in.ibm.com>
Tue, 6 Oct 2009 15:14:56 +0000 (17:14 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 6 Oct 2009 16:52:06 +0000 (18:52 +0200)
source3/include/proto.h
source3/include/vfs.h
source3/include/vfs_macros.h
source3/lib/system.c
source3/modules/onefs_open.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_gpfs.c
source3/smbd/open.c
source3/smbd/vfs.c

index c8e4fe1916ff270eb02ff71469d3114fa23185b2..d31483a02e27b1c700a72e9ebcea3c5a71b24e1a 100644 (file)
@@ -937,7 +937,7 @@ SMB_OFF_T sys_ftell(FILE *fp);
 int sys_creat(const char *path, mode_t mode);
 int sys_open(const char *path, int oflag, mode_t mode);
 FILE *sys_fopen(const char *path, const char *type);
-void kernel_flock(int fd, uint32 share_mode);
+void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
 SMB_STRUCT_DIR *sys_opendir(const char *name);
 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
index ed49d1fd28f490e8532009f05bce37aa67d9f825..f9c1f0a54f20840b39a12e17a40bc1f4decf2c83 100644 (file)
@@ -247,7 +247,8 @@ struct vfs_fn_pointers {
                      struct smb_file_time *ft);
        int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset);
        bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
-       int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode);
+       int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp,
+                           uint32 share_mode, uint32_t access_mask);
        int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
        bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
        int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
@@ -598,7 +599,8 @@ bool smb_vfs_call_lock(struct vfs_handle_struct *handle,
                       struct files_struct *fsp, int op, SMB_OFF_T offset,
                       SMB_OFF_T count, int type);
 int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, uint32 share_mode);
+                             struct files_struct *fsp, uint32 share_mode,
+                             uint32_t access_mask);
 int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
                                struct files_struct *fsp, int leasetype);
 bool smb_vfs_call_getlock(struct vfs_handle_struct *handle,
index 8ca7f373bf71e51ea68aa9d6fb150cb69b111187..7206bf41bb700799af7ba220058e16b2a5b2154d 100644 (file)
 #define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) \
        smb_vfs_call_lock((handle)->next, (fsp), (op), (offset), (count), (type))
 
-#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) \
-       smb_vfs_call_kernel_flock((fsp)->conn->vfs_handles, (fsp), (share_mode))
-#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode) \
-       smb_vfs_call_kernel_flock((handle)->next, (fsp), (share_mode))
+#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode, access_mask) \
+       smb_vfs_call_kernel_flock((fsp)->conn->vfs_handles, (fsp), (share_mode), (access_mask))
+#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask)        \
+       smb_vfs_call_kernel_flock((handle)->next, (fsp), (share_mode), (access_mask))
 
 #define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) \
        smb_vfs_call_linux_setlease((fsp)->conn->vfs_handles, (fsp), (leasetype))
index 2c6894ff941cfc8cb46a2bcfd5430dee9039de03..f9cd4a2355a114a082dbe898c2ab2f072b4e7168 100644 (file)
@@ -702,7 +702,7 @@ FILE *sys_fopen(const char *path, const char *type)
  A flock() wrapper that will perform the kernel flock.
 ********************************************************************/
 
-void kernel_flock(int fd, uint32 share_mode)
+void kernel_flock(int fd, uint32 share_mode, uint32 access_mask)
 {
 #if HAVE_KERNEL_SHARE_MODES
        int kernel_mode = 0;
index b9a2c30734cc7e0b94476324dec9ca7e6db6d092..d90f165cd7627ccc5805936f9e46d8934059e9aa 100644 (file)
@@ -1253,7 +1253,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
           note that GPFS supports it as well - jmcd */
 
        if (fsp->fh->fd != -1) {
-               ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
+               ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask);
                if(ret_flock == -1 ){
 
                        TALLOC_FREE(lck);
index 680eb1205b430cd3724c0e303b977dc39383b117..036a4380025bc1e314140575734b34eb572b9b0f 100644 (file)
@@ -1057,10 +1057,10 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, S
 }
 
 static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
-                               uint32 share_mode)
+                               uint32 share_mode, uint32 access_mask)
 {
        START_PROFILE(syscall_kernel_flock);
-       kernel_flock(fsp->fh->fd, share_mode);
+       kernel_flock(fsp->fh->fd, share_mode, access_mask);
        END_PROFILE(syscall_kernel_flock);
        return 0;
 }
index 22abee416ca0c8db67453d75a90802e2c316f33a..5305af48324418da5d4e5d285209a65b699dacb9 100644 (file)
@@ -1245,11 +1245,11 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
 
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
                                       struct files_struct *fsp,
-                                      uint32 share_mode)
+                                      uint32 share_mode, uint32 access_mask)
 {
        int result;
 
-       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode);
+       result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
 
        do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
               fsp_str_do_log(fsp));
index c1131a92b92e9f283ecc2cc3ab56c868721f0b7b..7c481d6ba0f602fa5e14a169266cb6201f43383c 100644 (file)
 #include "vfs_gpfs.h"
 
 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
-                                uint32 share_mode)
+                                uint32 share_mode, uint32 access_mask)
 {
 
        START_PROFILE(syscall_kernel_flock);
 
-       kernel_flock(fsp->fh->fd, share_mode);
+       kernel_flock(fsp->fh->fd, share_mode, access_mask);
 
-       if (!set_gpfs_sharemode(fsp, fsp->access_mask, fsp->share_access)) {
+       if (!set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) {
 
                return -1;
 
index 492164ceeee50af7e56143c51b53d7327553d43c..85b7d9106ddd37ad8c067aa6d0d1aa9ec230b49b 100644 (file)
@@ -2091,7 +2091,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
           note that GPFS supports it as well - jmcd */
 
        if (fsp->fh->fd != -1) {
-               ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access);
+               ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access, access_mask);
                if(ret_flock == -1 ){
 
                        TALLOC_FREE(lck);
index 966742a6d019b5ed4529c46552bc539c60aae6c5..35e4f3f9868466e8c9894ba05e65809cd891d498 100644 (file)
@@ -1417,10 +1417,12 @@ int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
 }
 
 int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle,
-                             struct files_struct *fsp, uint32 share_mode)
+                             struct files_struct *fsp, uint32 share_mode,
+                             uint32_t access_mask)
 {
        VFS_FIND(kernel_flock);
-       return handle->fns->kernel_flock(handle, fsp, share_mode);
+       return handle->fns->kernel_flock(handle, fsp, share_mode,
+                                        access_mask);
 }
 
 int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,