From: Volker Lendecke Date: Mon, 26 Aug 2019 16:59:44 +0000 (+0200) Subject: smbd: Make remove_stale_share_mode_entries() static in share_mode_lock.c X-Git-Tag: talloc-2.3.1~783 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f96aa7063e846021b69403cc9caa091c8e09b578;p=thirdparty%2Fsamba.git smbd: Make remove_stale_share_mode_entries() static in share_mode_lock.c ... to the place where the record is stored in the database Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index a24d5b68048..e3fc354a5fa 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -779,27 +779,6 @@ bool share_entry_stale_pid(struct share_mode_entry *e) return true; } -void remove_stale_share_mode_entries(struct share_mode_data *d) -{ - uint32_t i; - - i = 0; - while (i < d->num_share_modes) { - if (d->share_modes[i].stale) { - struct share_mode_entry *m = d->share_modes; - m[i] = m[d->num_share_modes-1]; - d->num_share_modes -= 1; - continue; - } - i += 1; - } - - if (d->num_share_modes == 0) { - TALLOC_FREE(d->delete_tokens); - d->num_delete_tokens = 0; - } -} - bool set_share_mode(struct share_mode_lock *lck, struct files_struct *fsp, uid_t uid, diff --git a/source3/locking/proto.h b/source3/locking/proto.h index f99984b23c2..fe171ea5012 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -187,7 +187,6 @@ bool reset_share_mode_entry( NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck, const struct GUID *client_guid, const struct smb2_lease_key *lease_key); -void remove_stale_share_mode_entries(struct share_mode_data *d); bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); bool mark_share_mode_disconnected(struct share_mode_lock *lck, struct files_struct *fsp); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 92ba3fe046e..54c82234f94 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -386,6 +386,27 @@ fail: return NULL; } +static void remove_stale_share_mode_entries(struct share_mode_data *d) +{ + uint32_t i; + + i = 0; + while (i < d->num_share_modes) { + if (d->share_modes[i].stale) { + struct share_mode_entry *m = d->share_modes; + m[i] = m[d->num_share_modes-1]; + d->num_share_modes -= 1; + continue; + } + i += 1; + } + + if (d->num_share_modes == 0) { + TALLOC_FREE(d->delete_tokens); + d->num_delete_tokens = 0; + } +} + /******************************************************************* If modified, store the share_mode_data back into the database. ********************************************************************/