]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: move files_struct.modified to a bitfield
authorRalph Boehme <slow@samba.org>
Thu, 2 Apr 2020 15:37:02 +0000 (17:37 +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>
12 files changed:
source3/include/vfs.h
source3/modules/vfs_virusfilter.c
source3/printing/printspoolss.c
source3/smbd/durable.c
source3/smbd/fileio.c
source3/smbd/files.c
source3/smbd/open.c
source3/smbd/pysmbd.c
source3/smbd/reply.c
source3/smbd/smb2_flush.c
source3/smbd/trans2.c
source3/torture/cmd_vfs.c

index d270dcbd92aca942c1141fddfbfe142065a70a2d..74d9aa17e4304abe9591aa58a3642ed9915e6a7c 100644 (file)
@@ -365,6 +365,7 @@ typedef struct files_struct {
                bool can_lock : 1;
                bool can_read : 1;
                bool can_write : 1;
+               bool modified : 1;
        } fsp_flags;
 
        struct tevent_timer *update_write_time_event;
@@ -385,7 +386,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 modified;
        bool is_directory;
        bool aio_write_behind;
        bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */
index 12f0364d2a7b6e99cd0fe227b57f0e5b47089ce8..9dbe9b6348baa5acbcbb2f6decb80d56cab98162 100644 (file)
@@ -1335,7 +1335,7 @@ static int virusfilter_vfs_close(
         * If close failed, file likely doesn't exist, do not try to scan.
         */
        if (close_result == -1 && close_errno == EBADF) {
-               if (fsp->modified) {
+               if (fsp->fsp_flags.modified) {
                        DBG_DEBUG("Removing cache entry (if existent): "
                                  "fname: %s\n", fname);
                        virusfilter_cache_remove(config->cache,
@@ -1350,7 +1350,7 @@ static int virusfilter_vfs_close(
        }
 
        if (is_named_stream(fsp->fsp_name)) {
-               if (config->scan_on_open && fsp->modified) {
+               if (config->scan_on_open && fsp->fsp_flags.modified) {
                        if (config->cache) {
                                DBG_DEBUG("Removing cache entry (if existent)"
                                          ": fname: %s\n", fname);
@@ -1365,7 +1365,7 @@ static int virusfilter_vfs_close(
        }
 
        if (!config->scan_on_close) {
-               if (config->scan_on_open && fsp->modified) {
+               if (config->scan_on_open && fsp->fsp_flags.modified) {
                        if (config->cache) {
                                DBG_DEBUG("Removing cache entry (if existent)"
                                          ": fname: %s\n", fname);
@@ -1379,7 +1379,7 @@ static int virusfilter_vfs_close(
                return close_result;
        }
 
-       if (!fsp->modified) {
+       if (!fsp->fsp_flags.modified) {
                DBG_NOTICE("Not scanned: File not modified: %s/%s\n",
                           cwd_fname, fname);
 
index fbf4054b19249ceefe4deceb80e917991ecf7ffa..c397902592c04b196eb2f95fc60d8f13e798c0c0 100644 (file)
@@ -232,7 +232,7 @@ NTSTATUS print_spool_open(files_struct *fsp,
        fsp->fsp_flags.can_read = false;
        fsp->access_mask = FILE_GENERIC_WRITE;
        fsp->fsp_flags.can_write = true;
-       fsp->modified = false;
+       fsp->fsp_flags.modified = false;
        fsp->oplock_type = NO_OPLOCK;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = false;
index 54283a7bef11c7964aec68f3a40ac024e091ca31..d6e05c6245aa32132af1c8a3dc8ea6bef8961d20 100644 (file)
@@ -691,7 +691,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
         * TODO:
         * Do we need to store the modified flag in the DB?
         */
-       fsp->modified = false;
+       fsp->fsp_flags.modified = false;
        /*
         * no durables for directories
         */
index 2300f5a209f4660e7ba3c257a005ba55b8e0d356..14610eb225d60a27fd91f720797e613529d9ca05 100644 (file)
@@ -210,11 +210,11 @@ void mark_file_modified(files_struct *fsp)
 
        trigger_write_time_update(fsp);
 
-       if (fsp->modified) {
+       if (fsp->fsp_flags.modified) {
                return;
        }
 
-       fsp->modified = true;
+       fsp->fsp_flags.modified = true;
 
        if (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) {
                return;
index 78df1fad6f4f9c0a9396c5a64a97cef795f3e231..5a0b5622096513f8c0a47cbebc94b1dc94bfa853 100644 (file)
@@ -793,7 +793,7 @@ NTSTATUS dup_file_fsp(
        to->fsp_flags.can_write =
                CAN_WRITE(from->conn) &&
                ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0);
-       to->modified = from->modified;
+       to->fsp_flags.modified = from->fsp_flags.modified;
        to->is_directory = from->is_directory;
        to->aio_write_behind = from->aio_write_behind;
 
index 4e0b375237126a2f2f90536fe268d80ffa5030e0..ffb3ea5f9d147fed23c5fd277a5938a2dcf81c0d 100644 (file)
@@ -1435,7 +1435,7 @@ static NTSTATUS open_file(files_struct *fsp,
                CAN_WRITE(conn) &&
                ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0);
        fsp->print_file = NULL;
-       fsp->modified = False;
+       fsp->fsp_flags.modified = false;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = False;
        if (conn->aio_write_behind_list &&
@@ -4402,7 +4402,7 @@ static NTSTATUS open_directory(connection_struct *conn,
         */
        fsp->access_mask = access_mask | FILE_READ_ATTRIBUTES;
        fsp->print_file = NULL;
-       fsp->modified = False;
+       fsp->fsp_flags.modified = false;
        fsp->oplock_type = NO_OPLOCK;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = True;
index 224619b601467db994d06dc9b1a44d3b94d8a80d..d9d4a6143cc3f70a2140855dbe3f9d8a6e6cf0bc 100644 (file)
@@ -197,7 +197,7 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx,
        fsp->fsp_flags.can_read = true;
        fsp->fsp_flags.can_write = true;
        fsp->print_file = NULL;
-       fsp->modified = False;
+       fsp->fsp_flags.modified = false;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = S_ISDIR(smb_fname->st.st_ex_mode);
 
index 6a2093a1498e12b739f7a21871bcc59f24566c23..7c9900d763cd6e2a89a97e48f8d55432dbe038e9 100644 (file)
@@ -5717,7 +5717,7 @@ static struct files_struct *file_sync_one_fn(struct files_struct *fsp,
        }
        sync_file(conn, fsp, True /* write through */);
 
-       if (fsp->modified) {
+       if (fsp->fsp_flags.modified) {
                trigger_write_time_update_immediate(fsp);
        }
 
@@ -5759,7 +5759,7 @@ void reply_flush(struct smb_request *req)
                        END_PROFILE(SMBflush);
                        return;
                }
-               if (fsp->modified) {
+               if (fsp->fsp_flags.modified) {
                        trigger_write_time_update_immediate(fsp);
                }
        }
@@ -9524,7 +9524,7 @@ void reply_setattrE(struct smb_request *req)
                goto out;
        }
 
-       if (fsp->modified) {
+       if (fsp->fsp_flags.modified) {
                trigger_write_time_update_immediate(fsp);
        }
 
index 08539e9580769f9b9db39893d34dc4807af6d0e9..677877ca62f22b5eed0c2160c6b55af6c03cfffb 100644 (file)
@@ -220,7 +220,7 @@ static void smbd_smb2_flush_done(struct tevent_req *subreq)
                tevent_req_nterror(req, map_nt_error_from_unix(vfs_aio_state.error));
                return;
        }
-       if (state->fsp->modified) {
+       if (state->fsp->fsp_flags.modified) {
                trigger_write_time_update_immediate(state->fsp);
        }
        tevent_req_done(req);
index a4cf666d76fb420b5b16a51dcdd6ceda03ada78e..380b276e759061d90fbdf6b2e3d2a4ccf845ed5b 100644 (file)
@@ -6697,7 +6697,7 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
                if (fsp == NULL) {
                        return NT_STATUS_OK;
                }
-               if (!fsp->modified) {
+               if (!fsp->fsp_flags.modified) {
                        return NT_STATUS_OK;
                }
                trigger_write_time_update_immediate(fsp);
@@ -7865,7 +7865,7 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
                return status;
        }
 
-       if (fsp != NULL && fsp->modified) {
+       if (fsp != NULL && fsp->fsp_flags.modified) {
                trigger_write_time_update_immediate(fsp);
        }
        return NT_STATUS_OK;
@@ -7910,7 +7910,7 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn,
                return status;
        }
 
-       if (fsp != NULL && fsp->modified) {
+       if (fsp != NULL && fsp->fsp_flags.modified) {
                trigger_write_time_update_immediate(fsp);
        }
        return NT_STATUS_OK;
index 4ad65dc31ba5c7f158ab34f066bc49f5083093cd..e66f5d44d969594c3559bc2113db41b1f98f3ca4 100644 (file)
@@ -426,7 +426,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
        fsp->fsp_flags.can_read = true;
        fsp->fsp_flags.can_write = CAN_WRITE(vfs->conn);
        fsp->print_file = NULL;
-       fsp->modified = False;
+       fsp->fsp_flags.modified = false;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = False;
 
@@ -1654,7 +1654,7 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
        fsp->fsp_flags.can_read = true;
        fsp->fsp_flags.can_write = true;
        fsp->print_file = NULL;
-       fsp->modified = False;
+       fsp->fsp_flags.modified = false;
        fsp->sent_oplock_break = NO_BREAK_SENT;
        fsp->is_directory = S_ISDIR(smb_fname->st.st_ex_mode);