From 396b31e82e301b18e747e040fb0430e8e86f6bb0 Mon Sep 17 00:00:00 2001 From: tol Date: Sat, 8 Mar 2008 21:40:10 +0000 Subject: [PATCH] Adapt to 2.6.23+. From Frej Drejhammar --- nnpfs/linux/nnpfs_inodeops.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/nnpfs/linux/nnpfs_inodeops.c b/nnpfs/linux/nnpfs_inodeops.c index 4747bb748..aa41f1900 100644 --- a/nnpfs/linux/nnpfs_inodeops.c +++ b/nnpfs/linux/nnpfs_inodeops.c @@ -105,7 +105,11 @@ nnpfs_vma_close (struct vm_area_struct *vma) } static struct vm_operations_struct nnpfs_file_vm_ops = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) .nopage = filemap_nopage, +#else + .fault = filemap_fault, +#endif .close = nnpfs_vma_close, }; @@ -1545,6 +1549,8 @@ nnpfs_d_delete(struct dentry *dentry) return 0; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) + static ssize_t nnpfs_sendfile(struct file *file, loff_t *ppos, size_t count, read_actor_t actor, void *target) @@ -1568,6 +1574,33 @@ nnpfs_sendfile(struct file *file, loff_t *ppos, size_t count, return error; } +#else + +static ssize_t +nnpfs_splice_read(struct file *file, loff_t *ppos, + struct pipe_inode_info *pipe, size_t count, + unsigned int flags) +{ + int error = 0; + struct inode *inode = file->f_dentry->d_inode; + struct nnpfs_node *xn = VNODE_TO_XNODE(inode); + + if (xn != NULL) + NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: tokens: 0x%x\n", xn->tokens)); + + error = nnpfs_data_valid(inode, NNPFS_DATA_R, *ppos, *ppos + count); + if (error) { + NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: data not valid %d\n", error)); + return error; + } + error = file->f_op->splice_read(file, ppos, pipe, count, flags); + + NNPFSDEB(XDEBVNOPS, ("nnpfs_sendfile: error = %d\n", error)); + return error; +} + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */ + /* * * @@ -1924,7 +1957,11 @@ struct file_operations nnpfs_file_operations = { .flush = nnpfs_flush, .release = nnpfs_release_file, .fsync = nnpfs_fsync, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) .sendfile = nnpfs_sendfile, +#else + .splice_read = nnpfs_splice_read, +#endif }; struct file_operations nnpfs_dead_operations = { -- 2.11.4.GIT