s3/locking: add share_mode_forall() and share_mode_forall_read() varients
All existing callers use share_mode_forall_read(), so no change in behaviour.
Note: doing the indirection via the function pointers "ro_fn" and "rw_fn" in a
single state "struct share_mode_forall_state" avoids duplicating
share_mode_forall_dump_fn() and share_mode_forall_fn() and has the benefit of
code sharing of these functions for both read-only and read-write cases.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15608
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>