linux-splice-support-20071106
authorAnders Kaseorg <andersk@mit.edu>
Tue, 6 Nov 2007 18:30:19 +0000 (18:30 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 6 Nov 2007 18:30:19 +0000 (18:30 +0000)
support splice in kernels new enough to support it (sendfile is deprecated)

acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index db381a2..64f41a7 100644 (file)
@@ -615,6 +615,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_AOP_WRITEBACK_CONTROL
                 LINUX_FS_STRUCT_FOP_HAS_FLOCK
                 LINUX_FS_STRUCT_FOP_HAS_SENDFILE
+                LINUX_FS_STRUCT_FOP_HAS_SPLICE
                 LINUX_KERNEL_LINUX_SYSCALL_H
                 LINUX_KERNEL_LINUX_SEQ_FILE_H
                 LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
@@ -866,6 +867,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_fs_struct_fop_has_sendfile" = "xyes" ; then
                  AC_DEFINE(STRUCT_FILE_OPERATIONS_HAS_SENDFILE, 1, [define if your struct file_operations has sendfile])
                 fi
+                if test "x$ac_cv_linux_fs_struct_fop_has_splice" = "xyes" ; then
+                 AC_DEFINE(STRUCT_FILE_OPERATIONS_HAS_SPLICE, 1, [define if your struct file_operations has splice_write and splice_read])
+                fi
                 if test "x$ac_cv_linux_register_sysctl_table_noflag" = "xyes" ; then
                  AC_DEFINE(REGISTER_SYSCTL_TABLE_NOFLAG, 1, [define if register_sysctl_table has no insert_at head flag])
                 fi
index 93bba1c..b5b29d1 100644 (file)
@@ -661,6 +661,10 @@ struct file_operations afs_file_fops = {
 #if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SENDFILE)
   .sendfile =   generic_file_sendfile,
 #endif
+#if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE)
+  .splice_write = generic_file_splice_write,
+  .splice_read = generic_file_splice_read,
+#endif
   .release =   afs_linux_release,
   .fsync =     afs_linux_fsync,
   .lock =      afs_linux_lock,
index 659edaf..36dce1a 100644 (file)
@@ -913,3 +913,15 @@ AC_DEFUN([LINUX_HAVE_SVC_ADDR_IN], [
       ac_cv_linux_have_svc_addr_in=no)])
   AC_MSG_RESULT($ac_cv_linux_have_svc_addr_in)])
 
+AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
+  AC_MSG_CHECKING([for splice_write and splice_read in struct file_operations])
+  AC_CACHE_VAL([ac_cv_linux_fs_struct_fop_has_splice], [
+    AC_TRY_KBUILD(
+[#include <linux/fs.h>],
+[struct file_operations _fop;
+_fop.splice_write(NULL, NULL, NULL, 0, 0);
+_fop.splice_read(NULL, NULL, NULL, 0, 0);],
+      ac_cv_linux_fs_struct_fop_has_splice=yes,
+      ac_cv_linux_fs_struct_fop_has_splice=no)])
+  AC_MSG_RESULT($ac_cv_linux_fs_struct_fop_has_splice)])
+