diff --git a/acinclude.m4 b/acinclude.m4 index 703d3ea7b5..8952776c62 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1195,6 +1195,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED LINUX_IOP_LOOKUP_TAKES_UNSIGNED LINUX_D_INVALIDATE_IS_VOID + LINUX_KERNEL_READ_OFFSET_IS_LAST dnl If we are guaranteed that keyrings will work - that is dnl a) The kernel has keyrings enabled diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 60cfdc1c27..62fce213de 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -659,7 +659,11 @@ afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos) #if defined(HAVE_LINUX___VFS_WRITE) return __vfs_read(filp, buf, len, pos); #elif defined(HAVE_LINUX_KERNEL_WRITE) +# if defined(LINUX_KERNEL_READ_OFFSET_IS_LAST) return kernel_read(filp, buf, len, pos); +# else + return kernel_read(filp, *pos, buf, len); +# endif #else return filp->f_op->read(filp, buf, len, pos); #endif @@ -671,7 +675,11 @@ afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos) #if defined(HAVE_LINUX___VFS_WRITE) return __vfs_write(filp, buf, len, pos); #elif defined(HAVE_LINUX_KERNEL_WRITE) +# if defined(LINUX_KERNEL_READ_OFFSET_IS_LAST) return kernel_write(filp, buf, len, pos); +# else + return kernel_write(filp, buf, len, *pos); +# endif #else return filp->f_op->write(filp, buf, len, pos); #endif diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index ed759e1ee8..6746a107ac 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -799,3 +799,15 @@ AC_DEFUN([LINUX_D_INVALIDATE_IS_VOID], [ [define if your d_invalidate returns void], []) ]) + +AC_DEFUN([LINUX_KERNEL_READ_OFFSET_IS_LAST], [ + AC_CHECK_LINUX_BUILD([whether offset is the last argument to kernel_read], + [ac_cv_linux_func_kernel_read_offset_is_last], + [#include ], + [ + ssize_t kernel_read(struct file *, void *, size_t, loff_t *); + ], + [KERNEL_READ_OFFSET_IS_LAST], + [define if your kernel_read has offset as the last argument], + []) +])