From: Volker Lendecke Date: Fri, 1 Nov 2019 11:33:23 +0000 (+0100) Subject: smbd: Make share_mode_do_locked() pass TDB_DATA instead of a record X-Git-Tag: talloc-2.3.1~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=231397f45ee7a328ea41214b1367632298339e44;p=thirdparty%2Fsamba.git smbd: Make share_mode_do_locked() pass TDB_DATA instead of a record No callback used (and should not use) the record directly, this is all handled within share_mode_lock.c Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Nov 13 21:41:09 UTC 2019 on sn-devel-184 --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 52309e5fc81..7822c2b3665 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -247,7 +247,7 @@ struct do_lock_state { }; static void do_lock_fn( - struct db_record *rec, + TDB_DATA value, bool *modified_dependent, void *private_data) { diff --git a/source3/locking/proto.h b/source3/locking/proto.h index fe171ea5012..fc11ef8863c 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -23,6 +23,8 @@ #ifndef _LOCKING_PROTO_H_ #define _LOCKING_PROTO_H_ +#include + /* The following definitions come from locking/brlock.c */ void brl_init(bool read_only); @@ -142,7 +144,7 @@ bool file_has_read_lease(struct files_struct *fsp); struct db_record; NTSTATUS share_mode_do_locked( struct file_id id, - void (*fn)(struct db_record *rec, + void (*fn)(TDB_DATA value, bool *modified_dependent, void *private_data), void *private_data); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 4fcca861e48..234dd90c1d0 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -225,10 +225,9 @@ struct fsp_update_share_mode_flags_state { }; static void fsp_update_share_mode_flags_fn( - struct db_record *rec, bool *modified_dependent, void *private_data) + TDB_DATA value, bool *modified_dependent, void *private_data) { struct fsp_update_share_mode_flags_state *state = private_data; - TDB_DATA value = dbwrap_record_get_value(rec); DATA_BLOB blob = { .data = value.dptr, .length = value.dsize }; uint64_t seq; @@ -715,7 +714,7 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck) } struct share_mode_do_locked_state { - void (*fn)(struct db_record *rec, + void (*fn)(TDB_DATA value, bool *modified_dependent, void *private_data); void *private_data; @@ -727,6 +726,7 @@ static void share_mode_do_locked_fn(struct db_record *rec, struct share_mode_do_locked_state *state = private_data; bool modified_dependent = false; bool reset_static_share_mode_record = false; + TDB_DATA value = dbwrap_record_get_value(rec); if (static_share_mode_record == NULL) { static_share_mode_record = rec; @@ -736,7 +736,7 @@ static void share_mode_do_locked_fn(struct db_record *rec, SMB_ASSERT(static_share_mode_record == rec); } - state->fn(rec, &modified_dependent, state->private_data); + state->fn(value, &modified_dependent, state->private_data); if (modified_dependent) { dbwrap_watched_wakeup(rec); @@ -749,7 +749,7 @@ static void share_mode_do_locked_fn(struct db_record *rec, NTSTATUS share_mode_do_locked( struct file_id id, - void (*fn)(struct db_record *rec, + void (*fn)(TDB_DATA value, bool *modified_dependent, void *private_data), void *private_data) @@ -759,7 +759,7 @@ NTSTATUS share_mode_do_locked( if (static_share_mode_record != NULL) { bool modified_dependent = false; - TDB_DATA static_key; + TDB_DATA static_key, static_value; int cmp; static_key = dbwrap_record_get_key(static_share_mode_record); @@ -771,9 +771,9 @@ NTSTATUS share_mode_do_locked( return NT_STATUS_INVALID_LOCK_SEQUENCE; } - fn(static_share_mode_record, - &modified_dependent, - private_data); + static_value = dbwrap_record_get_value(static_share_mode_record); + + fn(static_value, &modified_dependent, private_data); if (modified_dependent) { dbwrap_watched_wakeup(static_share_mode_record); @@ -798,7 +798,7 @@ NTSTATUS share_mode_do_locked( return NT_STATUS_OK; } -static void share_mode_wakeup_waiters_fn(struct db_record *rec, +static void share_mode_wakeup_waiters_fn(TDB_DATA value, bool *modified_dependent, void *private_data) {