commit e39d2aae4ace768320d64a8ecb6f706458f3bb72
Author: Erez Zadok <[EMAIL PROTECTED]>
Date:   Tue Apr 15 19:35:30 2008 -0400

    VFS: rename do_splice_to/from to vfs_splice_* and export symbols
    
    A stackable file system which uses vm_ops->fault, and does not implement
    address_space_operations, cannot use generic_file_splice_read/write, but has
    to implement ->splice_read/write itself.  These two helper functions are
    very useful to such a module.
    
    Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>

diff --git a/fs/splice.c b/fs/splice.c
index 5428b0f..eb81e7f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -898,8 +898,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
 /*
  * Attempt to initiate a splice from pipe to file.
  */
-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-                          loff_t *ppos, size_t len, unsigned int flags)
+long vfs_splice_from(struct pipe_inode_info *pipe, struct file *out,
+                    loff_t *ppos, size_t len, unsigned int flags)
 {
        int ret;
 
@@ -915,13 +915,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, 
struct file *out,
 
        return out->f_op->splice_write(pipe, out, ppos, len, flags);
 }
+EXPORT_SYMBOL_GPL(vfs_splice_from);
 
 /*
  * Attempt to initiate a splice from a file to a pipe.
  */
-static long do_splice_to(struct file *in, loff_t *ppos,
-                        struct pipe_inode_info *pipe, size_t len,
-                        unsigned int flags)
+long vfs_splice_to(struct file *in, loff_t *ppos,
+                  struct pipe_inode_info *pipe, size_t len,
+                  unsigned int flags)
 {
        loff_t isize, left;
        int ret;
@@ -946,6 +947,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 
        return in->f_op->splice_read(in, ppos, pipe, len, flags);
 }
+EXPORT_SYMBOL_GPL(vfs_splice_to);
 
 long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
                      size_t len, unsigned int flags)
@@ -1000,7 +1002,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, 
struct file *out,
                 */
                max_read_len = min(len, (size_t)(PIPE_BUFFERS*PAGE_SIZE));
 
-               ret = do_splice_to(in, ppos, pipe, max_read_len, flags);
+               ret = vfs_splice_to(in, ppos, pipe, max_read_len, flags);
                if (unlikely(ret < 0))
                        goto out_release;
 
@@ -1011,8 +1013,8 @@ long do_splice_direct(struct file *in, loff_t *ppos, 
struct file *out,
                 * must not do the output in nonblocking mode as then we
                 * could get stuck data in the internal pipe:
                 */
-               ret = do_splice_from(pipe, out, &out_off, read_len,
-                                    flags & ~SPLICE_F_NONBLOCK);
+               ret = vfs_splice_from(pipe, out, &out_off, read_len,
+                                     flags & ~SPLICE_F_NONBLOCK);
                if (unlikely(ret < 0))
                        goto out_release;
 
@@ -1098,7 +1100,7 @@ static long do_splice(struct file *in, loff_t __user 
*off_in,
                } else
                        off = &out->f_pos;
 
-               ret = do_splice_from(pipe, out, off, len, flags);
+               ret = vfs_splice_from(pipe, out, off, len, flags);
 
                if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
                        ret = -EFAULT;
@@ -1119,7 +1121,7 @@ static long do_splice(struct file *in, loff_t __user 
*off_in,
                } else
                        off = &in->f_pos;
 
-               ret = do_splice_to(in, off, pipe, len, flags);
+               ret = vfs_splice_to(in, off, pipe, len, flags);
 
                if (off_in && copy_to_user(off_in, off, sizeof(loff_t)))
                        ret = -EFAULT;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 86ec3f4..ed2714c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1738,6 +1738,11 @@ extern ssize_t generic_splice_sendpage(struct 
pipe_inode_info *pipe,
                struct file *out, loff_t *, size_t len, unsigned int flags);
 extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
                size_t len, unsigned int flags);
+extern long vfs_splice_from(struct pipe_inode_info *pipe, struct file *out,
+                           loff_t *ppos, size_t len, unsigned int flags);
+extern long vfs_splice_to(struct file *in, loff_t *ppos,
+                         struct pipe_inode_info *pipe, size_t len,
+                         unsigned int flags);
 
 extern void
 file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to