system: Remove kernel_flock
authorChristof Schmitt <cs@samba.org>
Mon, 13 Sep 2021 20:13:44 +0000 (13:13 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 14 Sep 2021 23:14:36 +0000 (23:14 +0000)
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>
source3/lib/system.c

index a14fc51ca63e3d704b1364681106b5c27426a4b0..671fc2760a02df446e7daafe06bd4137c62dd19f 100644 (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.
 ********************************************************************/