From: Stefan Metzmacher Date: Thu, 18 Aug 2022 12:14:20 +0000 (+0200) Subject: s3:locking: move get_existing_share_mode_lock() to share_mode_lock.[ch] X-Git-Tag: talloc-2.4.0~1392 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf8f2258497f7d2a5a5f8d1cacf1a30899ed455c;p=thirdparty%2Fsamba.git s3:locking: move get_existing_share_mode_lock() to share_mode_lock.[ch] This should be where get_share_mode_lock() is located. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index b002e80fee4..befdc10f369 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -468,17 +468,6 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, (unsigned int)e->name_hash); } -/******************************************************************* - Fetch a share mode where we know one MUST exist. This call reference - counts it internally to allow for nested lock fetches. -********************************************************************/ - -struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx, - const struct file_id id) -{ - 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; diff --git a/source3/locking/proto.h b/source3/locking/proto.h index d6e7a54a766..52452e56a7b 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -128,8 +128,6 @@ void locking_close_file(files_struct *fsp, char *share_mode_str(TALLOC_CTX *ctx, int num, const struct file_id *id, const struct share_mode_entry *e); -struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx, - struct file_id id); bool rename_share_filename(struct messaging_context *msg_ctx, struct share_mode_lock *lck, diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index b3f30c0f512..75912ec5dc8 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1005,6 +1005,17 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck) return 0; } +/******************************************************************* + Fetch a share mode where we know one MUST exist. This call reference + counts it internally to allow for nested lock fetches. +********************************************************************/ + +struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx, + const struct file_id id) +{ + return get_share_mode_lock(mem_ctx, id, NULL, NULL, NULL); +} + struct share_mode_do_locked_state { TDB_DATA key; void (*fn)(const uint8_t *buf, diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h index f8693b14b54..4f47b6fbcbe 100644 --- a/source3/locking/share_mode_lock.h +++ b/source3/locking/share_mode_lock.h @@ -38,6 +38,8 @@ struct share_mode_lock *get_share_mode_lock( const char *servicepath, const struct smb_filename *smb_fname, const struct timespec *old_write_time); +struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx, + struct file_id id); bool del_share_mode(struct share_mode_lock *lck, struct files_struct *fsp); diff --git a/source3/smbd/smbd.h b/source3/smbd/smbd.h index f2c3abcda2d..6cf2b64a5a1 100644 --- a/source3/smbd/smbd.h +++ b/source3/smbd/smbd.h @@ -25,6 +25,7 @@ struct dptr_struct; #include "vfs.h" #include "smbd/proto.h" #include "locking/proto.h" +#include "locking/share_mode_lock.h" #include "smbd/fd_handle.h" #if defined(WITH_SMB1SERVER) #include "smbd/smb1_message.h"