diff options
author | Volker Lendecke <vl@samba.org> | 2019-09-10 21:12:23 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-09-17 22:49:37 +0000 |
commit | f82aebe943534d5ab9b89dcec2150f985b574115 (patch) | |
tree | 99471632e9b3ed95f3681f40669c03ba5af580ee /source3/locking | |
parent | 2a784883a889b517b86cce328f0798c92b69a2d5 (diff) | |
download | samba-f82aebe943534d5ab9b89dcec2150f985b574115.tar.gz |
smbd: Avoid "share_mode_lock" dependency in rename_lease_fn()
share_mode_forall_leases() will stop passing "lck" soon.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/locking.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index f26f5821a5e..a8b05a40ea9 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -469,11 +469,21 @@ struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx, return get_share_mode_lock(mem_ctx, id, NULL, NULL, NULL); } +struct rename_share_filename_state { + struct share_mode_lock *lck; + struct messaging_context *msg_ctx; + struct server_id self; + uint32_t orig_name_hash; + uint32_t new_name_hash; + struct file_rename_message msg; +}; + static bool rename_lease_fn(struct share_mode_lock *lck, struct share_mode_entry *e, void *private_data) { - struct share_mode_data *d = lck->data; + struct rename_share_filename_state *state = private_data; + struct share_mode_data *d = state->lck->data; NTSTATUS status; status = leases_db_rename(&e->client_guid, @@ -502,14 +512,6 @@ static bool rename_lease_fn(struct share_mode_lock *lck, Based on an initial code idea from SATOH Fumiyasu <fumiya@samba.gr.jp> ********************************************************************/ -struct rename_share_filename_state { - struct messaging_context *msg_ctx; - struct server_id self; - uint32_t orig_name_hash; - uint32_t new_name_hash; - struct file_rename_message msg; -}; - static bool rename_share_filename_fn( struct share_mode_entry *e, bool *modified, @@ -570,6 +572,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx, const struct smb_filename *smb_fname_dst) { struct rename_share_filename_state state = { + .lck = lck, .msg_ctx = msg_ctx, .self = messaging_server_id(msg_ctx), .orig_name_hash = orig_name_hash, @@ -611,7 +614,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx, DBG_WARNING("share_mode_forall_entries failed\n"); } - ok = share_mode_forall_leases(lck, rename_lease_fn, NULL); + ok = share_mode_forall_leases(lck, rename_lease_fn, &state); if (!ok) { /* * Ignore error here. Not sure what to do.. |