1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

system: Remove kernel_flock

LOCK_MAND will be deprecated in the Linux kernel, so stop using this
feature and remove the kernel_flock function.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Christof Schmitt 2021-09-13 13:13:44 -07:00 committed by Jeremy Allison
parent e1398c34b2
commit b2b7f9e658

View File

@ -471,39 +471,6 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len)
#endif /* HAVE_LINUX_FALLOCATE */
}
#ifdef HAVE_KERNEL_SHARE_MODES
#ifndef LOCK_MAND
#define LOCK_MAND 32 /* This is a mandatory flock */
#define LOCK_READ 64 /* ... Which allows concurrent read operations */
#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
#endif
#endif
/*******************************************************************
A flock() wrapper that will perform the kernel flock.
********************************************************************/
void kernel_flock(int fd, uint32_t share_access, uint32_t access_mask)
{
#ifdef HAVE_KERNEL_SHARE_MODES
int kernel_mode = 0;
if (share_access == FILE_SHARE_WRITE) {
kernel_mode = LOCK_MAND|LOCK_WRITE;
} else if (share_access == FILE_SHARE_READ) {
kernel_mode = LOCK_MAND|LOCK_READ;
} else if (share_access == FILE_SHARE_NONE) {
kernel_mode = LOCK_MAND;
}
if (kernel_mode) {
flock(fd, kernel_mode);
}
#endif
;
}
/*******************************************************************
An fdopendir wrapper.
********************************************************************/