[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Jul 2 18:18:02 UTC 2019
The branch, master has been updated
via 9b017ab0465 smbd: Simplify filename_convert_internal()
via ce3666fb83a smbd: Remove unused "msg_ctx" from smbd_smb1_do_locks_send()
via f952967e582 smbd: Remove unused "msg_ctx" from smbd_do_locks_try()
via 45d2720a878 smbd: Remove unused "msg_ctx" from locking_close_file()
via 0658626776c smbd: Remove unused "msg_ctx" from do_unlock()
via 316365805a4 smbd: Remove unused "msg_ctx" from brl_close_fnum()
via c2292a85f54 smbd: Remove unused "msg_ctx" from brl_unlock()
via 39f14da9adc vfs: Remove unused "msg_ctx" from SMB_VFS_BRL_UNLOCK_WINDOWS
via 3a93c638944 smbd: Remove unused "msg_ctx" from brl_unlock_posix()
via 4d75c0aa53a smbd: Remove unused "msg_ctx" from do_lock()
via b809e68c12f smbd: Remove unused "msg_ctx" from brl_lock()
via 5a89031cf87 smbd: Remove unused "msg_ctx" from brl_lock_posix
via a045b9b1f37 smbd: Remove unused "blocking_lock" from brl_lock_windows_default()
via f83775d8557 vfs: Remove "blocking_lock" from SMB_VFS_BRL_LOCK_WINDOWS
via 37c9c4c3ce3 smbd: brl_lock() never sees blocking locks anymore
via 5a012a0fdfd smbd: do_lock() never sees blocking locks anymore
via b70d855e1ae smbd: Make do_lock() return NTSTATUS
via b0d4939d6ca smbd: Avoid casts in do_lock()
via e36398d93b6 smbd: Ensure initialized vars in do_lock
from ee9527f5c3b librpc/idl: fix build with --enable-spotlight
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9b017ab0465f912de738ba0679b378e8a49fba5f
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jun 24 13:48:10 2019 +0200
smbd: Simplify filename_convert_internal()
Use a direct struct assignment
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jul 2 18:17:39 UTC 2019 on sn-devel-184
commit ce3666fb83ade72807fd3510d9d30251325cdcac
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:42:56 2019 +0200
smbd: Remove unused "msg_ctx" from smbd_smb1_do_locks_send()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f952967e5822a299d2ea176764fd5596ba53ee5a
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:41:07 2019 +0200
smbd: Remove unused "msg_ctx" from smbd_do_locks_try()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 45d2720a878a07be1d219164f7245d3d89726829
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:35:19 2019 +0200
smbd: Remove unused "msg_ctx" from locking_close_file()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0658626776c19c903d894e32a036e8d8eccad425
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:33:58 2019 +0200
smbd: Remove unused "msg_ctx" from do_unlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 316365805a427bc95465d9f42605885111d41baf
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:31:04 2019 +0200
smbd: Remove unused "msg_ctx" from brl_close_fnum()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c2292a85f54ed46fe9dc0b9126be7b64f2656118
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:28:10 2019 +0200
smbd: Remove unused "msg_ctx" from brl_unlock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 39f14da9adc1832838ea79b23fbce9876fddb098
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:25:27 2019 +0200
vfs: Remove unused "msg_ctx" from SMB_VFS_BRL_UNLOCK_WINDOWS
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 3a93c638944a16b3e2104dbee25cb3668d01deea
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:18:58 2019 +0200
smbd: Remove unused "msg_ctx" from brl_unlock_posix()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4d75c0aa53ad5f319e8f3eb59edc1b6571a4825e
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:17:27 2019 +0200
smbd: Remove unused "msg_ctx" from do_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b809e68c12f35ec1f2d6aac37d2a28706b91be62
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:15:41 2019 +0200
smbd: Remove unused "msg_ctx" from brl_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 5a89031cf878055659e82f4def743ee38efa9665
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 15:13:59 2019 +0200
smbd: Remove unused "msg_ctx" from brl_lock_posix
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a045b9b1f37177253a38c348f0d428fe2fdcf607
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:58:35 2019 +0200
smbd: Remove unused "blocking_lock" from brl_lock_windows_default()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f83775d8557587c1aa6db031c0b250455d4d7a6b
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:55:42 2019 +0200
vfs: Remove "blocking_lock" from SMB_VFS_BRL_LOCK_WINDOWS
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 37c9c4c3ce3e26730f79bce5feaf51433bd331f7
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:42:50 2019 +0200
smbd: brl_lock() never sees blocking locks anymore
This is now all handled in protocol-specific layers
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 5a012a0fdfdd68640bae4a5044dbd071143fa252
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:42:50 2019 +0200
smbd: do_lock() never sees blocking locks anymore
This is now all handled in protocol-specific layers
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b70d855e1aedf6b267b9d6fe189fefd207bffc2c
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:30:15 2019 +0200
smbd: Make do_lock() return NTSTATUS
This routine did a NO-GO: It returned something on talloc_tos(), for
later consumption by push_blocking_lock_request. This is now gone, no
caller uses the "struct byte_range_lock" returned anymore.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b0d4939d6ca09c4617089f81a213b9390fc2da49
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:23:27 2019 +0200
smbd: Avoid casts in do_lock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e36398d93b6a26c25d034b815671e9744392b234
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 1 14:19:16 2019 +0200
smbd: Ensure initialized vars in do_lock
brl_lock does not initialize these variables in all cases
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_opaque.c | 4 +-
examples/VFS/skel_transparent.c | 9 ++--
source3/include/vfs.h | 15 +++---
source3/include/vfs_macros.h | 18 +++----
source3/locking/brlock.c | 65 ++++++++++-------------
source3/locking/locking.c | 99 +++++++++++++++++------------------
source3/locking/proto.h | 68 ++++++++++--------------
source3/modules/vfs_default.c | 8 ++-
source3/modules/vfs_fruit.c | 36 ++-----------
source3/modules/vfs_full_audit.c | 15 ++----
source3/modules/vfs_not_implemented.c | 4 +-
source3/modules/vfs_time_audit.c | 10 ++--
source3/smbd/blocking.c | 20 +------
source3/smbd/close.c | 2 +-
source3/smbd/filename.c | 5 +-
source3/smbd/proto.h | 2 -
source3/smbd/reply.c | 15 +++---
source3/smbd/smb2_lock.c | 2 -
source3/smbd/trans2.c | 1 -
19 files changed, 150 insertions(+), 248 deletions(-)
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 4e4475a11e8..4b2b11a1aaa 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -647,14 +647,12 @@ static const char *skel_connectpath(struct vfs_handle_struct *handle,
static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock)
+ struct lock_struct *plock)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock)
{
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index ac2665ef07b..0de01ac9d54 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -818,19 +818,16 @@ static const char *skel_connectpath(struct vfs_handle_struct *handle,
static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock)
+ struct lock_struct *plock)
{
- return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle,
- br_lck, plock, blocking_lock);
+ return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock);
}
static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock)
{
- return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock);
+ return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, br_lck, plock);
}
static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 56f4b9dd1f8..a7ac50f06d2 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -266,6 +266,9 @@
/* Version 41 - add st_ex_itime to struct stat_ex */
/* Version 41 - add st_ex_file_id to struct stat_ex */
/* Version 41 - add SMB_VFS_FS_FILE_ID */
+/* Version 41 - Remove "blocking_lock" parameter from
+ SMB_VFS_BRL_LOCK_WINDOWS */
+/* Version 41 - Remove "msg_ctx" parameter from SMB_VFS_BRL_UNLOCK_WINDOWS */
#define SMB_VFS_INTERFACE_VERSION 41
@@ -870,11 +873,9 @@ struct vfs_fn_pointers {
NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock);
+ struct lock_struct *plock);
bool (*brl_unlock_windows_fn)(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
@@ -1345,10 +1346,8 @@ const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock);
+ struct lock_struct *plock);
bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
bool smb_vfs_call_strict_lock_check(struct vfs_handle_struct *handle,
@@ -1808,10 +1807,8 @@ const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock);
+ struct lock_struct *plock);
bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock);
bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index c4fa0fe022e..fd0d9681084 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -351,15 +351,15 @@
#define SMB_VFS_NEXT_CONNECTPATH(conn, smb_fname) \
smb_vfs_call_connectpath((conn)->next, (smb_fname))
-#define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock) \
- smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock), (blocking_lock))
-#define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock, blocking_lock) \
- smb_vfs_call_brl_lock_windows((handle)->next, (br_lck), (plock), (blocking_lock))
-
-#define SMB_VFS_BRL_UNLOCK_WINDOWS(conn, msg_ctx, br_lck, plock) \
- smb_vfs_call_brl_unlock_windows((conn)->vfs_handles, (msg_ctx), (br_lck), (plock))
-#define SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock) \
- smb_vfs_call_brl_unlock_windows((handle)->next, (msg_ctx), (br_lck), (plock))
+#define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock) \
+ smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock))
+#define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock) \
+ smb_vfs_call_brl_lock_windows((handle)->next, (br_lck), (plock))
+
+#define SMB_VFS_BRL_UNLOCK_WINDOWS(conn, br_lck, plock) \
+ smb_vfs_call_brl_unlock_windows((conn)->vfs_handles, (br_lck), (plock))
+#define SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, br_lck, plock) \
+ smb_vfs_call_brl_unlock_windows((handle)->next, (br_lck), (plock))
#define SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, plock) \
smb_vfs_call_strict_lock_check((conn)->vfs_handles, (fsp), (plock))
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index b4628831f5b..75c020f57a6 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -346,7 +346,7 @@ static int lock_compare(const struct lock_struct *lck1,
****************************************************************************/
NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
- struct lock_struct *plock, bool blocking_lock)
+ struct lock_struct *plock)
{
unsigned int i;
files_struct *fsp = br_lck->fsp;
@@ -723,8 +723,7 @@ OR
We must cope with range splits and merges.
****************************************************************************/
-static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
+static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
struct lock_struct *plock)
{
unsigned int i, count, posix_count;
@@ -892,29 +891,26 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock)
+ struct lock_struct *plock)
{
VFS_FIND(brl_lock_windows);
- return handle->fns->brl_lock_windows_fn(handle, br_lck, plock,
- blocking_lock);
+ return handle->fns->brl_lock_windows_fn(handle, br_lck, plock);
}
/****************************************************************************
Lock a range of bytes.
****************************************************************************/
-NTSTATUS brl_lock(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
- uint64_t smblctx,
- struct server_id pid,
- br_off start,
- br_off size,
- enum brl_type lock_type,
- enum brl_flavour lock_flav,
- bool blocking_lock,
- struct server_id *blocker_pid,
- uint64_t *psmblctx)
+NTSTATUS brl_lock(
+ struct byte_range_lock *br_lck,
+ uint64_t smblctx,
+ struct server_id pid,
+ br_off start,
+ br_off size,
+ enum brl_type lock_type,
+ enum brl_flavour lock_flav,
+ struct server_id *blocker_pid,
+ uint64_t *psmblctx)
{
NTSTATUS ret;
struct lock_struct lock;
@@ -939,17 +935,16 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx,
};
if (lock_flav == WINDOWS_LOCK) {
- ret = SMB_VFS_BRL_LOCK_WINDOWS(br_lck->fsp->conn, br_lck,
- &lock, blocking_lock);
+ ret = SMB_VFS_BRL_LOCK_WINDOWS(
+ br_lck->fsp->conn, br_lck, &lock);
} else {
- ret = brl_lock_posix(msg_ctx, br_lck, &lock);
+ ret = brl_lock_posix(br_lck, &lock);
}
#if ZERO_ZERO
/* sort the lock list */
TYPESAFE_QSORT(br_lck->lock_data, (size_t)br_lck->num_locks, lock_compare);
#endif
-
/* If we're returning an error, return who blocked us. */
if (!NT_STATUS_IS_OK(ret) && psmblctx) {
*blocker_pid = lock.context.pid;
@@ -973,9 +968,8 @@ static void brl_delete_lock_struct(struct lock_struct *locks,
Unlock a range of bytes - Windows semantics.
****************************************************************************/
-bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
- const struct lock_struct *plock)
+bool brl_unlock_windows_default(struct byte_range_lock *br_lck,
+ const struct lock_struct *plock)
{
unsigned int i;
struct lock_struct *locks = br_lck->lock_data;
@@ -1055,8 +1049,7 @@ bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
Unlock a range of bytes - POSIX semantics.
****************************************************************************/
-static bool brl_unlock_posix(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
+static bool brl_unlock_posix(struct byte_range_lock *br_lck,
struct lock_struct *plock)
{
unsigned int i, count;
@@ -1187,21 +1180,18 @@ static bool brl_unlock_posix(struct messaging_context *msg_ctx,
}
bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
- struct messaging_context *msg_ctx,
struct byte_range_lock *br_lck,
const struct lock_struct *plock)
{
VFS_FIND(brl_unlock_windows);
- return handle->fns->brl_unlock_windows_fn(handle, msg_ctx, br_lck,
- plock);
+ return handle->fns->brl_unlock_windows_fn(handle, br_lck, plock);
}
/****************************************************************************
Unlock a range of bytes.
****************************************************************************/
-bool brl_unlock(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
+bool brl_unlock(struct byte_range_lock *br_lck,
uint64_t smblctx,
struct server_id pid,
br_off start,
@@ -1220,10 +1210,10 @@ bool brl_unlock(struct messaging_context *msg_ctx,
lock.lock_flav = lock_flav;
if (lock_flav == WINDOWS_LOCK) {
- return SMB_VFS_BRL_UNLOCK_WINDOWS(br_lck->fsp->conn, msg_ctx,
- br_lck, &lock);
+ return SMB_VFS_BRL_UNLOCK_WINDOWS(
+ br_lck->fsp->conn, br_lck, &lock);
} else {
- return brl_unlock_posix(msg_ctx, br_lck, &lock);
+ return brl_unlock_posix(br_lck, &lock);
}
}
@@ -1368,8 +1358,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
fd and so we should not immediately close the fd.
****************************************************************************/
-void brl_close_fnum(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck)
+void brl_close_fnum(struct byte_range_lock *br_lck)
{
files_struct *fsp = br_lck->fsp;
uint32_t tid = fsp->conn->cnum;
@@ -1397,7 +1386,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx,
if (lock->context.tid == tid && serverid_equal(&lock->context.pid, &pid) &&
(lock->fnum == fnum)) {
- brl_unlock(msg_ctx,
+ brl_unlock(
br_lck,
lock->context.smblctx,
pid,
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index aa4d17e04d1..6c69b0055dc 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -230,63 +230,64 @@ static void decrement_current_lock_count(files_struct *fsp,
Utility function called by locking requests.
****************************************************************************/
-struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
- files_struct *fsp,
- uint64_t smblctx,
- uint64_t count,
- uint64_t offset,
- enum brl_type lock_type,
- enum brl_flavour lock_flav,
- bool blocking_lock,
- NTSTATUS *perr,
- struct server_id *pblocker_pid,
- uint64_t *psmblctx)
+NTSTATUS do_lock(files_struct *fsp,
+ uint64_t smblctx,
+ uint64_t count,
+ uint64_t offset,
+ enum brl_type lock_type,
+ enum brl_flavour lock_flav,
+ struct server_id *pblocker_pid,
+ uint64_t *psmblctx)
{
struct byte_range_lock *br_lck = NULL;
- struct server_id blocker_pid;
- uint64_t blocker_smblctx;
+ struct server_id blocker_pid = { 0 };
+ uint64_t blocker_smblctx = 0;
+ NTSTATUS status;
/* silently return ok on print files as we don't do locking there */
if (fsp->print_file) {
- *perr = NT_STATUS_OK;
- return NULL;
+ return NT_STATUS_OK;
}
if (!fsp->can_lock) {
- *perr = fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
- return NULL;
+ if (fsp->is_directory) {
+ return NT_STATUS_INVALID_DEVICE_REQUEST;
+ }
+ return NT_STATUS_INVALID_HANDLE;
}
if (!lp_locking(fsp->conn->params)) {
- *perr = NT_STATUS_OK;
- return NULL;
+ return NT_STATUS_OK;
}
/* NOTE! 0 byte long ranges ARE allowed and should be stored */
- DEBUG(10,("do_lock: lock flavour %s lock type %s start=%ju len=%ju "
- "blocking_lock=%s requested for %s file %s\n",
- lock_flav_name(lock_flav), lock_type_name(lock_type),
- (uintmax_t)offset, (uintmax_t)count, blocking_lock ? "true" :
- "false", fsp_fnum_dbg(fsp), fsp_str_dbg(fsp)));
+ DBG_DEBUG("lock flavour %s lock type %s start=%"PRIu64" len=%"PRIu64" "
+ "requested for %s file %s\n",
+ lock_flav_name(lock_flav),
+ lock_type_name(lock_type),
+ offset,
+ count,
+ fsp_fnum_dbg(fsp),
+ fsp_str_dbg(fsp));
br_lck = brl_get_locks(talloc_tos(), fsp);
if (!br_lck) {
- *perr = NT_STATUS_NO_MEMORY;
- return NULL;
+ return NT_STATUS_NO_MEMORY;
}
- *perr = brl_lock(msg_ctx,
- br_lck,
- smblctx,
- messaging_server_id(fsp->conn->sconn->msg_ctx),
- offset,
- count,
- lock_type,
- lock_flav,
- blocking_lock,
- &blocker_pid,
- &blocker_smblctx);
+ status = brl_lock(
+ br_lck,
+ smblctx,
+ messaging_server_id(fsp->conn->sconn->msg_ctx),
+ offset,
+ count,
+ lock_type,
+ lock_flav,
+ &blocker_pid,
+ &blocker_smblctx);
+
+ TALLOC_FREE(br_lck);
if (psmblctx != NULL) {
*psmblctx = blocker_smblctx;
@@ -295,22 +296,22 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
*pblocker_pid = blocker_pid;
}
- DEBUG(10, ("do_lock: returning status=%s\n", nt_errstr(*perr)));
+ DBG_DEBUG("returning status=%s\n", nt_errstr(status));
increment_current_lock_count(fsp, lock_flav);
- return br_lck;
+
+ return status;
}
/****************************************************************************
Utility function called by unlocking requests.
****************************************************************************/
-NTSTATUS do_unlock(struct messaging_context *msg_ctx,
- files_struct *fsp,
- uint64_t smblctx,
- uint64_t count,
- uint64_t offset,
- enum brl_flavour lock_flav)
+NTSTATUS do_unlock(files_struct *fsp,
+ uint64_t smblctx,
+ uint64_t count,
+ uint64_t offset,
+ enum brl_flavour lock_flav)
{
bool ok = False;
struct byte_range_lock *br_lck = NULL;
@@ -335,8 +336,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
return NT_STATUS_NO_MEMORY;
}
- ok = brl_unlock(msg_ctx,
- br_lck,
+ ok = brl_unlock(br_lck,
smblctx,
messaging_server_id(fsp->conn->sconn->msg_ctx),
offset,
@@ -358,8 +358,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
Remove any locks on this fd. Called from file_close().
****************************************************************************/
-void locking_close_file(struct messaging_context *msg_ctx,
- files_struct *fsp,
+void locking_close_file(files_struct *fsp,
enum file_close_type close_type)
{
struct byte_range_lock *br_lck;
@@ -385,7 +384,7 @@ void locking_close_file(struct messaging_context *msg_ctx,
* implictly, we're closing the file and thus remove a
* share mode. This will wake the waiters.
*/
- brl_close_fnum(msg_ctx, br_lck);
+ brl_close_fnum(br_lck);
TALLOC_FREE(br_lck);
}
}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 1e90a40a9ea..15826a9d4af 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -35,30 +35,26 @@ void brl_set_num_read_oplocks(struct byte_range_lock *brl,
uint32_t num_read_oplocks);
NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
- struct lock_struct *plock,
- bool blocking_lock);
+ struct lock_struct *plock);
-NTSTATUS brl_lock(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
- uint64_t smblctx,
- struct server_id pid,
- br_off start,
- br_off size,
- enum brl_type lock_type,
- enum brl_flavour lock_flav,
- bool blocking_lock,
- struct server_id *blocker_pid,
- uint64_t *psmblctx);
-bool brl_unlock(struct messaging_context *msg_ctx,
- struct byte_range_lock *br_lck,
+NTSTATUS brl_lock(
+ struct byte_range_lock *br_lck,
+ uint64_t smblctx,
+ struct server_id pid,
+ br_off start,
+ br_off size,
+ enum brl_type lock_type,
+ enum brl_flavour lock_flav,
+ struct server_id *blocker_pid,
+ uint64_t *psmblctx);
+bool brl_unlock(struct byte_range_lock *br_lck,
uint64_t smblctx,
struct server_id pid,
br_off start,
br_off size,
enum brl_flavour lock_flav);
-bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list