s3: lib: Add 'int op' parameter to fcntl_getlock().
authorJeremy Allison <jra@samba.org>
Thu, 12 May 2016 18:57:36 +0000 (20:57 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 20 May 2016 23:28:28 +0000 (01:28 +0200)
Will allow us to move to open file description locks
from process-associated locks.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
source3/include/proto.h
source3/lib/util.c
source3/modules/vfs_default.c

index c032b9e8ce1f02340efa044329660d38f9fa52a4..15e0095f882da177604673c1cb00853618918833 100644 (file)
@@ -385,7 +385,7 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
 void set_namearray(name_compare_entry **ppname_array, const char *namelist);
 void free_namearray(name_compare_entry *name_array);
 bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type);
-bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
+bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
 bool is_myname(const char *s);
 void ra_lanman_string( const char *native_lanman );
 const char *get_remote_arch_str(void);
index f64f6b56db15a7a0f979ac4303e8aa589d9c4f73..36a27504b9f3ab12ea5da5ee443222e63ad0fb47 100644 (file)
@@ -1150,13 +1150,13 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in)
  F_UNLCK in *ptype if the region is unlocked). False if the call failed.
 ****************************************************************************/
 
-bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
+bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
 {
        struct flock lock;
        int ret;
 
-       DEBUG(8,("fcntl_getlock fd=%d offset=%.0f count=%.0f type=%d\n",
-                   fd,(double)*poffset,(double)*pcount,*ptype));
+       DEBUG(8,("fcntl_getlock fd=%d op=%d offset=%.0f count=%.0f type=%d\n",
+                   fd,op,(double)*poffset,(double)*pcount,*ptype));
 
        lock.l_type = *ptype;
        lock.l_whence = SEEK_SET;
@@ -1164,7 +1164,7 @@ bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppi
        lock.l_len = *pcount;
        lock.l_pid = 0;
 
-       ret = sys_fcntl_ptr(fd,F_GETLK,&lock);
+       ret = sys_fcntl_ptr(fd,op,&lock);
 
        if (ret == -1) {
                int sav = errno;
index 8ee163506b46c0b710d001a40d8fbfa06bf62365..087fb446feb13ff93ad97ad8ffa5ba260aaa7f27 100644 (file)
@@ -2119,9 +2119,10 @@ static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp,
 static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
 {
        bool result;
+       int op = F_GETLK;
 
        START_PROFILE(syscall_fcntl_getlock);
-       result =  fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid);
+       result = fcntl_getlock(fsp->fh->fd, op, poffset, pcount, ptype, ppid);
        END_PROFILE(syscall_fcntl_getlock);
        return result;
 }