From: Volker Lendecke Date: Tue, 10 Sep 2019 19:21:01 +0000 (+0200) Subject: smbd: Stop passing "share_mode_lock" via share_mode_forall_leases() X-Git-Tag: talloc-2.3.1~798 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=f69310672501c0e2d0afe638a18a0e21fec17298 smbd: Stop passing "share_mode_lock" via share_mode_forall_leases() Why? Next commit will make share_mode_forall_leases() use share_mode_forall_entries(), and that does not necessarily have to depend on "share_mode_lock". And as we can pass the required information via "private_data", don't embed the "share_mode_lock" reference into this lowlevel library routine. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index a8b05a40ea9..ae42058e605 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -478,8 +478,7 @@ struct rename_share_filename_state { struct file_rename_message msg; }; -static bool rename_lease_fn(struct share_mode_lock *lck, - struct share_mode_entry *e, +static bool rename_lease_fn(struct share_mode_entry *e, void *private_data) { struct rename_share_filename_state *state = private_data; @@ -1371,8 +1370,7 @@ bool share_mode_forall_entries( bool share_mode_forall_leases( struct share_mode_lock *lck, - bool (*fn)(struct share_mode_lock *lck, - struct share_mode_entry *e, + bool (*fn)(struct share_mode_entry *e, void *private_data), void *private_data) { @@ -1425,7 +1423,7 @@ bool share_mode_forall_leases( continue; } - stop = fn(lck, e, private_data); + stop = fn(e, private_data); if (stop) { TALLOC_FREE(leases); return true; diff --git a/source3/locking/proto.h b/source3/locking/proto.h index ae8768e68e9..32f6c64965c 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -218,8 +218,7 @@ bool share_mode_cleanup_disconnected(struct file_id id, uint64_t open_persistent_id); bool share_mode_forall_leases( struct share_mode_lock *lck, - bool (*fn)(struct share_mode_lock *lck, - struct share_mode_entry *e, + bool (*fn)(struct share_mode_entry *e, void *private_data), void *private_data); diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 3e805d47d48..b6de20ef4e3 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1077,8 +1077,7 @@ struct cleanup_disconnected_lease_state { struct file_id fid; }; -static bool cleanup_disconnected_lease(struct share_mode_lock *lck, - struct share_mode_entry *e, +static bool cleanup_disconnected_lease(struct share_mode_entry *e, void *private_data) { struct cleanup_disconnected_lease_state *state = private_data; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 3c57e0a99f2..44aeaf48a63 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -1154,8 +1154,7 @@ struct break_to_none_state { size_t num_broken; }; -static bool do_break_lease_to_none(struct share_mode_lock *lck, - struct share_mode_entry *e, +static bool do_break_lease_to_none(struct share_mode_entry *e, void *private_data) { struct break_to_none_state *state = private_data;