From: Stefan Metzmacher Date: Sun, 21 Aug 2022 13:15:09 +0000 (+0200) Subject: s3:smbd: move locking related vfs functions to smbd/vfs.c X-Git-Tag: talloc-2.4.0~903 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7cf1b07b6928f18b0147f4b6b74a97ae3fb667b;p=thirdparty%2Fsamba.git s3:smbd: move locking related vfs functions to smbd/vfs.c This allows us to make VFS_FIND local to smbd/vfs.c in the next step. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 68ade6b6d59..d2e4abf48d7 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -971,14 +971,6 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck, return status; } -NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle, - struct byte_range_lock *br_lck, - struct lock_struct *plock) -{ - VFS_FIND(brl_lock_windows); - return handle->fns->brl_lock_windows_fn(handle, br_lck, plock); -} - /**************************************************************************** Lock a range of bytes. ****************************************************************************/ @@ -1250,14 +1242,6 @@ static bool brl_unlock_posix(struct byte_range_lock *br_lck, return True; } -bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle, - struct byte_range_lock *br_lck, - const struct lock_struct *plock) -{ - VFS_FIND(brl_unlock_windows); - return handle->fns->brl_unlock_windows_fn(handle, br_lck, plock); -} - /**************************************************************************** Unlock a range of bytes. ****************************************************************************/ diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 536d8bf802b..5aad427a218 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -179,14 +179,6 @@ static bool posix_lock_in_range(off_t *offset_out, off_t *count_out, return True; } -bool smb_vfs_call_lock(struct vfs_handle_struct *handle, - struct files_struct *fsp, int op, off_t offset, - off_t count, int type) -{ - VFS_FIND(lock); - return handle->fns->lock_fn(handle, fsp, op, offset, count, type); -} - /**************************************************************************** Actual function that does POSIX locks. Copes with 64 -> 32 bit cruft and broken NFS implementations. @@ -243,15 +235,6 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, off_t offset, off_t coun return ret; } -bool smb_vfs_call_getlock(struct vfs_handle_struct *handle, - struct files_struct *fsp, off_t *poffset, - off_t *pcount, int *ptype, pid_t *ppid) -{ - VFS_FIND(getlock); - return handle->fns->getlock_fn(handle, fsp, poffset, pcount, ptype, - ppid); -} - /**************************************************************************** Actual function that gets POSIX locks. Copes with 64 -> 32 bit cruft and broken NFS implementations. diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 1d9f70bafc9..acd66f3ca20 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2633,3 +2633,36 @@ NTSTATUS smb_vfs_call_freaddir_attr(struct vfs_handle_struct *handle, mem_ctx, attr_data); } + +bool smb_vfs_call_lock(struct vfs_handle_struct *handle, + struct files_struct *fsp, int op, off_t offset, + off_t count, int type) +{ + VFS_FIND(lock); + return handle->fns->lock_fn(handle, fsp, op, offset, count, type); +} + +bool smb_vfs_call_getlock(struct vfs_handle_struct *handle, + struct files_struct *fsp, off_t *poffset, + off_t *pcount, int *ptype, pid_t *ppid) +{ + VFS_FIND(getlock); + return handle->fns->getlock_fn(handle, fsp, poffset, pcount, ptype, + ppid); +} + +NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle, + struct byte_range_lock *br_lck, + struct lock_struct *plock) +{ + VFS_FIND(brl_lock_windows); + return handle->fns->brl_lock_windows_fn(handle, br_lck, plock); +} + +bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle, + struct byte_range_lock *br_lck, + const struct lock_struct *plock) +{ + VFS_FIND(brl_unlock_windows); + return handle->fns->brl_unlock_windows_fn(handle, br_lck, plock); +} diff --git a/source3/wscript_build b/source3/wscript_build index 19e31c80e75..df0bfb95c01 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -758,6 +758,7 @@ bld.SAMBA3_SUBSYSTEM('LOCKING', deps=''' tdb talloc + vfs LEASES_DB LEASES_UTIL NDR_OPEN_FILES