From 59eb3de5ea3bc9588c91d3f2dbb6a598fa56ad43 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 17 May 2007 07:34:15 +0000 Subject: [PATCH] linux-posix-lock-file-has-wait-arg-now-20070517 FIXES 58590 hopefully this works, i can't actually try it now --- acinclude.m4 | 4 ++++ src/afs/LINUX/osi_vnodeops.c | 6 +++--- src/cf/linux-test4.m4 | 11 +++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 17799ddbc..9090ce199 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -612,6 +612,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_FS_STRUCT_FOP_HAS_FLOCK LINUX_KERNEL_LINUX_SYSCALL_H LINUX_KERNEL_LINUX_SEQ_FILE_H + LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG LINUX_KERNEL_SELINUX LINUX_KERNEL_SOCK_CREATE LINUX_KERNEL_PAGE_FOLLOW_LINK @@ -768,6 +769,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_func_recalc_sigpending_takes_void" = "xyes"; then AC_DEFINE(RECALC_SIGPENDING_TAKES_VOID, 1, [define if your recalc_sigpending takes void]) fi + if test "x$ac_cv_linux_kernel_posix_lock_file_wait_arg" = "xyes" ; then + AC_DEFINE(LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG, 1, [define if your linux kernel uses 3 arguments for posix_lock_file]) + fi if test "x$ac_cv_linux_kernel_is_selinux" = "xyes" ; then AC_DEFINE(LINUX_KERNEL_IS_SELINUX, 1, [define if your linux kernel uses SELinux features]) fi diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index e115ae4f8..9a266034c 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -491,11 +491,11 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) #ifdef AFS_LINUX24_ENV if ((code == 0 || flp->fl_type == F_UNLCK) && (cmd == F_SETLK || cmd == F_SETLKW)) { -#ifdef AFS_LINUX26_ENV +#ifdef LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG + code = posix_lock_file(fp, flp, 0); +#else flp->fl_flags &=~ FL_SLEEP; code = posix_lock_file(fp, flp); -#else - code = posix_lock_file(fp, flp, 0); #endif if (code && flp->fl_type != F_UNLCK) { struct AFS_FLOCK flock2; diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index c8659fbf8..dd543b3c6 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -456,6 +456,17 @@ printk("%p\n", _super.alloc_inode);], AC_MSG_RESULT($ac_cv_linux_fs_struct_super_has_alloc_inode)]) +AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [ + AC_MSG_CHECKING([for 3rd argument in posix_lock_file found in new kernels]) + AC_CACHE_VAL([ac_cv_linux_kernel_posix_lock_file_wait_arg], [ + AC_TRY_KBUILD( +[#include ], +[posix_lock_file(0,0,0);], + ac_cv_linux_kernel_posix_lock_file_wait_arg=yes, + ac_cv_linux_kernel_posix_lock_file_wait_arg=no)]) + AC_MSG_RESULT($ac_cv_linux_kernel_posix_lock_file_wait_arg)]) + + AC_DEFUN([LINUX_KERNEL_SOCK_CREATE], [ AC_MSG_CHECKING([for 5th argument in sock_create found in some SELinux kernels]) AC_CACHE_VAL([ac_cv_linux_kernel_sock_create_v], [ -- 2.39.5