Compile out splice support from nfs when the splice-family of syscalls is not
supported by the system (i.e. CONFIG_SYSCALL_SPLICE is undefined).

Signed-off-by: Pieter Smith <[email protected]>
---
 fs/nfs/file.c     | 6 ++++--
 fs/nfs/nfs4file.c | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 524dd80..b36b4fb 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -187,6 +187,7 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to)
 }
 EXPORT_SYMBOL_GPL(nfs_file_read);
 
+#ifdef CONFIG_SYSCALL_SPLICE
 ssize_t
 nfs_file_splice_read(struct file *filp, loff_t *ppos,
                     struct pipe_inode_info *pipe, size_t count,
@@ -207,6 +208,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
        return res;
 }
 EXPORT_SYMBOL_GPL(nfs_file_splice_read);
+#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
 
 int
 nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
@@ -915,8 +917,8 @@ const struct file_operations nfs_file_operations = {
        .fsync          = nfs_file_fsync,
        .lock           = nfs_lock,
        .flock          = nfs_flock,
-       .splice_read    = nfs_file_splice_read,
-       .splice_write   = iter_file_splice_write,
+       SPLICE_READ_INIT(nfs_file_splice_read)
+       SPLICE_WRITE_INIT(iter_file_splice_write)
        .check_flags    = nfs_check_flags,
        .setlease       = nfs_setlease,
 };
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index a816f06..81dd4c8 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -128,8 +128,8 @@ const struct file_operations nfs4_file_operations = {
        .fsync          = nfs4_file_fsync,
        .lock           = nfs_lock,
        .flock          = nfs_flock,
-       .splice_read    = nfs_file_splice_read,
-       .splice_write   = iter_file_splice_write,
+       SPLICE_READ_INIT(nfs_file_splice_read)
+       SPLICE_WRITE_INIT(iter_file_splice_write)
        .check_flags    = nfs_check_flags,
        .setlease       = nfs_setlease,
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to