mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
smbd: move files_struct.modified to a bitfield
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
b95c62bc90
commit
65a4302474
@ -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. */
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user