From 4fe70bcee2ec8515f123d8c826631b54bbf793e7 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Thu, 9 Nov 2006 20:29:31 +0000 Subject: r19647: Add some GPFS support in a vfs mod. Also adds the kernel flock op to the vfs layer, since gpfs supports it. Thanks to Volker, Christian, Mathias, Chetan, and Peter. (This used to be commit 0620658890fa9c68a9848538728023192319c81a) --- source3/lib/system.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/system.c b/source3/lib/system.c index a440ece410..9ee3f7cc26 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -379,6 +379,31 @@ FILE *sys_fopen(const char *path, const char *type) #endif } + +/******************************************************************* + A flock() wrapper that will perform the kernel flock. +********************************************************************/ + +void kernel_flock(int fd, uint32 share_mode) +{ +#if HAVE_KERNEL_SHARE_MODES + int kernel_mode = 0; + if (share_mode == FILE_SHARE_WRITE) { + kernel_mode = LOCK_MAND|LOCK_WRITE; + } else if (share_mode == FILE_SHARE_READ) { + kernel_mode = LOCK_MAND|LOCK_READ; + } else if (share_mode == FILE_SHARE_NONE) { + kernel_mode = LOCK_MAND; + } + if (kernel_mode) { + flock(fd, kernel_mode); + } +#endif + ; +} + + + /******************************************************************* An opendir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -- cgit