From: Stefan Metzmacher Date: Fri, 26 Aug 2022 08:40:44 +0000 (+0200) Subject: s3:locking: add share_mode_lock_file_id() X-Git-Tag: talloc-2.4.0~891 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d42bb5d831ccc2e5134a2c3776546e1dda2736ac;p=thirdparty%2Fsamba.git s3:locking: add share_mode_lock_file_id() This will simplify some (mostly debug) code soon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 4fd9d1b3b50..3d8bebda68d 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -839,6 +839,11 @@ static NTSTATUS get_static_share_mode_data( return NT_STATUS_OK; } +struct file_id share_mode_lock_file_id(const struct share_mode_lock *lck) +{ + return lck->id; +} + NTSTATUS share_mode_lock_access_private_data(struct share_mode_lock *lck, struct share_mode_data **data) { @@ -874,6 +879,7 @@ struct share_mode_lock *get_share_mode_lock( DEBUG(1, ("talloc failed\n")); return NULL; } + lck->id = id; if (static_share_mode_data != NULL) { if (!file_id_equal(&static_share_mode_data->id, &id)) { @@ -1359,6 +1365,7 @@ static void fetch_share_mode_unlocked_parser( DEBUG(0, ("talloc failed\n")); return; } + state->lck->id = state->id; state->lck->data = parse_share_modes( state->lck, @@ -1497,6 +1504,7 @@ static void fetch_share_mode_fn( state->status = NT_STATUS_NO_MEMORY; return; } + state->lck->id = state->id, state->lck->data = parse_share_modes( state->lck, @@ -1679,6 +1687,7 @@ static int share_entry_traverse_fn(struct file_id fid, { struct share_entry_forall_state *state = private_data; struct share_mode_lock lck = { + .id = fid, .data = discard_const_p(struct share_mode_data, data) }; bool ok; diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h index 199e500df23..e6d7e5dc88f 100644 --- a/source3/locking/share_mode_lock.h +++ b/source3/locking/share_mode_lock.h @@ -32,6 +32,8 @@ bool locking_init(void); bool locking_init_readonly(void); bool locking_end(void); +struct file_id share_mode_lock_file_id(const struct share_mode_lock *lck); + struct share_mode_lock *get_share_mode_lock( TALLOC_CTX *mem_ctx, struct file_id id, diff --git a/source3/locking/share_mode_lock_private.h b/source3/locking/share_mode_lock_private.h index 7e11d58fa7a..ad1346db3c2 100644 --- a/source3/locking/share_mode_lock_private.h +++ b/source3/locking/share_mode_lock_private.h @@ -18,6 +18,7 @@ struct share_mode_data; struct share_mode_lock { + struct file_id id; struct share_mode_data *data; };