summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2022-08-26 10:24:52 +0200
committerJeremy Allison <jra@samba.org>2022-09-20 00:34:35 +0000
commitb6789ff1c07202d43822c5c7cc0c51df84aba4cd (patch)
treeb8bb30b22242be61733f13232dcc82f5bc6b9df5 /source3/locking
parentb508c5a0be6565355351cb036ce6495e35d76862 (diff)
downloadsamba-b6789ff1c07202d43822c5c7cc0c51df84aba4cd.tar.gz
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 <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/share_mode_lock.c12
-rw-r--r--source3/locking/share_mode_lock_private.h3
2 files changed, 15 insertions, 0 deletions
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