]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: move files_struct.can_lock to a bitfield
authorRalph Boehme <slow@samba.org>
Thu, 2 Apr 2020 15:09:36 +0000 (17:09 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 3 Apr 2020 19:05:43 +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/locking.c
source3/printing/printspoolss.c
source3/smbd/durable.c
source3/smbd/fake_file.c
source3/smbd/files.c
source3/smbd/open.c
source3/smbd/pipes.c
source3/smbd/pysmbd.c
source3/torture/cmd_vfs.c

index 23dbc7d2289d20e3c5accfd7491e8a3507d151e6..2600cc3b31d812c9962b1125119031871a591f2f 100644 (file)
@@ -362,6 +362,7 @@ typedef struct files_struct {
                bool update_write_time_triggered : 1;
                bool update_write_time_on_close : 1;
                bool write_time_forced : 1;
+               bool can_lock : 1;
        } fsp_flags;
 
        struct tevent_timer *update_write_time_event;
@@ -382,7 +383,6 @@ typedef struct files_struct {
        struct lock_struct last_lock_failure;
        int current_lock_count; /* Count the number of outstanding locks and pending locks. */
 
-       bool can_lock;
        bool can_read;
        bool can_write;
        bool modified;
index 1220cb3a2be1656b2dc07e1979771190612bf008..7d71e436f4a949702b60a224e5f17a991e2005af 100644 (file)
@@ -178,7 +178,7 @@ NTSTATUS query_lock(files_struct *fsp,
 {
        struct byte_range_lock *br_lck = NULL;
 
-       if (!fsp->can_lock) {
+       if (!fsp->fsp_flags.can_lock) {
                return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
        }
 
@@ -306,7 +306,7 @@ NTSTATUS do_lock(files_struct *fsp,
                return NT_STATUS_OK;
        }
 
-       if (!fsp->can_lock) {
+       if (!fsp->fsp_flags.can_lock) {
                if (fsp->is_directory) {
                        return NT_STATUS_INVALID_DEVICE_REQUEST;
                }
@@ -362,7 +362,7 @@ NTSTATUS do_unlock(files_struct *fsp,
        bool ok = False;
        struct byte_range_lock *br_lck = NULL;
 
-       if (!fsp->can_lock) {
+       if (!fsp->fsp_flags.can_lock) {
                return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
        }
 
index 523e429b205b3f790b64e796aa987f8ff3ad9a24..e3dbc2e7b8f2746518286500d1907589e9f19bc0 100644 (file)
@@ -228,7 +228,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        fsp->fh->fd = fd;
 
        fsp->vuid = current_vuid;
-       fsp->can_lock = false;
+       fsp->fsp_flags.can_lock = false;
        fsp->can_read = false;
        fsp->access_mask = FILE_GENERIC_WRITE;
        fsp->can_write = true;
index 1d482b377fd9322f21db75eafaf532d8d8a9c7a9..0a38d5a5c55e7ce0079215662edb393f51567d15 100644 (file)
@@ -699,7 +699,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
        /*
         * For normal files, can_lock == !is_directory
         */
-       fsp->can_lock = true;
+       fsp->fsp_flags.can_lock = true;
        /*
         * We do not support aio write behind for smb2
         */
index 81ccbde6aab5fc351cef5e6971c487e717c104e1..625c21ff8bdb774955d0734386c313b9183e4ac6 100644 (file)
@@ -166,7 +166,7 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
        fsp->fh->fd = -1;
        fsp->vuid = current_vuid;
        fsp->fh->pos = -1;
-       fsp->can_lock = False; /* Should this be true ? - No, JRA */
+       fsp->fsp_flags.can_lock = false; /* Should this be true ? - No, JRA */
        fsp->access_mask = access_mask;
        status = fsp_set_smb_fname(fsp, smb_fname);
        if (!NT_STATUS_IS_OK(status)) {
index 433c9b00866608df30e90a8b995ceea99429120f..18b3d086a9227432cf84e24c4b9bbcd2858c0a02 100644 (file)
@@ -788,7 +788,7 @@ NTSTATUS dup_file_fsp(
        to->open_time = from->open_time;
        to->access_mask = access_mask;
        to->oplock_type = from->oplock_type;
-       to->can_lock = from->can_lock;
+       to->fsp_flags.can_lock = from->fsp_flags.can_lock;
        to->can_read = ((access_mask & FILE_READ_DATA) != 0);
        to->can_write =
                CAN_WRITE(from->conn) &&
index 41f253c77e43ee18c1905be175e09d75615fc1b9..40f4b2be5d7cc4be4958222789598d90aea2a286 100644 (file)
@@ -1429,7 +1429,7 @@ static NTSTATUS open_file(files_struct *fsp,
        fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
        fsp->vuid = req ? req->vuid : UID_FIELD_INVALID;
        fsp->file_pid = req ? req->smbpid : 0;
-       fsp->can_lock = True;
+       fsp->fsp_flags.can_lock = true;
        fsp->can_read = ((access_mask & FILE_READ_DATA) != 0);
        fsp->can_write =
                CAN_WRITE(conn) &&
@@ -4391,7 +4391,7 @@ static NTSTATUS open_directory(connection_struct *conn,
        fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_dname->st);
        fsp->vuid = req ? req->vuid : UID_FIELD_INVALID;
        fsp->file_pid = req ? req->smbpid : 0;
-       fsp->can_lock = False;
+       fsp->fsp_flags.can_lock = false;
        fsp->can_read = False;
        fsp->can_write = False;
 
index dd72d16313496e985c9dc0e289f7bf23d71ed074..49802aed44e127db92088babfdd9dca44cf8a5b2 100644 (file)
@@ -48,7 +48,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
        fsp->conn = conn;
        fsp->fh->fd = -1;
        fsp->vuid = smb_req->vuid;
-       fsp->can_lock = false;
+       fsp->fsp_flags.can_lock = false;
        fsp->access_mask = FILE_READ_DATA | FILE_WRITE_DATA;
 
        smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL, 0);
index 39fe875a385b34db1c010306d354c75c9a0d69a5..859855399849555c6699fede2f8784109f2e34f1 100644 (file)
@@ -193,7 +193,7 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx,
        fsp->file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
        fsp->vuid = UID_FIELD_INVALID;
        fsp->file_pid = 0;
-       fsp->can_lock = True;
+       fsp->fsp_flags.can_lock = true;
        fsp->can_read = True;
        fsp->can_write = True;
        fsp->print_file = NULL;
index 1e12c5bba5dc0fbe31c8eeaaa916702979800fdd..3485ebb0fda93738ac7d87ba660344082cde5438 100644 (file)
@@ -422,7 +422,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
        fsp->file_id = vfs_file_id_from_sbuf(vfs->conn, &smb_fname->st);
        fsp->vuid = UID_FIELD_INVALID;
        fsp->file_pid = 0;
-       fsp->can_lock = True;
+       fsp->fsp_flags.can_lock = true;
        fsp->can_read = True;
        fsp->can_write =
                CAN_WRITE(vfs->conn);
@@ -1651,7 +1651,7 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
        fsp->file_id = vfs_file_id_from_sbuf(vfs->conn, &smb_fname->st);
        fsp->vuid = UID_FIELD_INVALID;
        fsp->file_pid = 0;
-       fsp->can_lock = True;
+       fsp->fsp_flags.can_lock = true;
        fsp->can_read = True;
        fsp->can_write = True;
        fsp->print_file = NULL;