From: Stefan Metzmacher Date: Fri, 26 Aug 2022 08:24:52 +0000 (+0200) Subject: s3:locking: add share_mode_lock_access_private_data() X-Git-Tag: talloc-2.4.0~894 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6789ff1c07202d43822c5c7cc0c51df84aba4cd;p=thirdparty%2Fsamba.git s3:locking: add share_mode_lock_access_private_data() In future we should avoid dereference 'struct share_mode_lock' as much as possible. This will also allow us to load struct share_mode_data only if required in future. 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 d0954b80336..4fd9d1b3b50 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -839,6 +839,18 @@ static NTSTATUS get_static_share_mode_data( return NT_STATUS_OK; } +NTSTATUS share_mode_lock_access_private_data(struct share_mode_lock *lck, + struct share_mode_data **data) +{ + /* + * For now we always have lck->data, + * but we may change that in future. + */ + SMB_ASSERT(lck->data != NULL); + *data = lck->data; + return NT_STATUS_OK; +} + /******************************************************************* Get a share_mode_lock, Reference counted to allow nested calls. ********************************************************************/ diff --git a/source3/locking/share_mode_lock_private.h b/source3/locking/share_mode_lock_private.h index 14a3c1b2a47..7e11d58fa7a 100644 --- a/source3/locking/share_mode_lock_private.h +++ b/source3/locking/share_mode_lock_private.h @@ -21,4 +21,7 @@ struct share_mode_lock { struct share_mode_data *data; }; +NTSTATUS share_mode_lock_access_private_data(struct share_mode_lock *lck, + struct share_mode_data **data); + #endif