]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: move files_struct.use_ofd_locks to a bitfield
authorRalph Boehme <slow@samba.org>
Fri, 3 Apr 2020 06:02:23 +0000 (08:02 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 3 Apr 2020 19:05:44 +0000 (19:05 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/locking/posix.c
source3/modules/vfs_default.c
source3/smbd/files.c

index ec3bbb4446597ebcf0e11e53b34808f2d0b77ec2..c7f430aa646e9392894d601239070ea7079f9bdd 100644 (file)
@@ -372,6 +372,7 @@ typedef struct files_struct {
                bool delete_on_close : 1;
                bool is_sparse : 1;
                bool backup_intent : 1;
+               bool use_ofd_locks : 1;
        } fsp_flags;
 
        struct tevent_timer *update_write_time_event;
@@ -393,7 +394,6 @@ typedef struct files_struct {
        int current_lock_count; /* Count the number of outstanding locks and pending locks. */
 
        uint64_t posix_flags;
-       bool use_ofd_locks; /* Are we using open file description locks ? */
        struct smb_filename *fsp_name;
        uint32_t name_hash;             /* Jenkins hash of full pathname. */
        uint64_t mid;                   /* Mid of the operation that created us. */
index e7d773a6f667de317f70a2f012cd18236a1af362..32f8317776e1aad3654e6fd09b92c2666f39564c 100644 (file)
@@ -585,7 +585,7 @@ int fd_close_posix(const struct files_struct *fsp)
 
        if (!lp_locking(fsp->conn->params) ||
            !lp_posix_locking(fsp->conn->params) ||
-           fsp->use_ofd_locks)
+           fsp->fsp_flags.use_ofd_locks)
        {
                /*
                 * No locking or POSIX to worry about or we are using POSIX
index 3527d0371ce1e4c6564344fa23d90b7833ebb9e1..2a7e04f79d13336fd96f75367cfd485ead88fb7d 100644 (file)
@@ -2730,7 +2730,7 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, o
 
        START_PROFILE(syscall_fcntl_lock);
 
-       if (fsp->use_ofd_locks) {
+       if (fsp->fsp_flags.use_ofd_locks) {
                op = map_process_lock_to_ofd_lock(op);
        }
 
@@ -2800,7 +2800,7 @@ static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t
 
        START_PROFILE(syscall_fcntl_getlock);
 
-       if (fsp->use_ofd_locks) {
+       if (fsp->fsp_flags.use_ofd_locks) {
                op = map_process_lock_to_ofd_lock(op);
        }
 
index 6269dd94dd5addfd77f4c4607000522ec82d785f..9a8a5188a1c368d27c5fcbcf9ba83f037d0e371b 100644 (file)
@@ -52,12 +52,12 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
        }
 
 #if defined(HAVE_OFD_LOCKS)
-       fsp->use_ofd_locks = true;
+       fsp->fsp_flags.use_ofd_locks = true;
        if (lp_parm_bool(SNUM(conn),
                         "smbd",
                         "force process locks",
                         false)) {
-               fsp->use_ofd_locks = false;
+               fsp->fsp_flags.use_ofd_locks = false;
        }
 #endif
        fsp->fh->ref_count = 1;