VFS: rename do_splice_to/from to vfs_splice_* and export symbols
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 21 Mar 2008 20:04:42 +0000 (16:04 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 11 Nov 2014 01:04:30 +0000 (20:04 -0500)
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 <ezk@cs.sunysb.edu>
fs/splice.c
include/linux/splice.h

index 84f810d63c3765898146b02057240c3b0a7fd847..cf476e67c524dc7b14590dff3718ef2a15d0db38 100644 (file)
@@ -1111,8 +1111,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)
 {
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
                                loff_t *, size_t, unsigned int);
@@ -1124,13 +1124,14 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 
        return 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)
 {
        ssize_t (*splice_read)(struct file *, loff_t *,
                               struct pipe_inode_info *, size_t, unsigned int);
@@ -1150,6 +1151,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 
        return splice_read(in, ppos, pipe, len, flags);
 }
+EXPORT_SYMBOL_GPL(vfs_splice_to);
 
 /**
  * splice_direct_to_actor - splices data directly between two non-pipes
@@ -1219,7 +1221,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
                size_t read_len;
                loff_t pos = sd->pos, prev_pos = pos;
 
-               ret = do_splice_to(in, &pos, pipe, len, flags);
+               ret = vfs_splice_to(in, &pos, pipe, len, flags);
                if (unlikely(ret <= 0))
                        goto out_release;
 
@@ -1278,8 +1280,8 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
 {
        struct file *file = sd->u.file;
 
-       return do_splice_from(pipe, file, sd->opos, sd->total_len,
-                             sd->flags);
+       return vfs_splice_from(pipe, file, sd->opos, sd->total_len,
+                              sd->flags);
 }
 
 /**
@@ -1387,7 +1389,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                        return ret;
 
                file_start_write(out);
-               ret = do_splice_from(ipipe, out, &offset, len, flags);
+               ret = vfs_splice_from(ipipe, out, &offset, len, flags);
                file_end_write(out);
 
                if (!off_out)
@@ -1410,7 +1412,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                        offset = in->f_pos;
                }
 
-               ret = do_splice_to(in, &offset, opipe, len, flags);
+               ret = vfs_splice_to(in, &offset, opipe, len, flags);
 
                if (!off_in)
                        in->f_pos = offset;
index 74575cbf2d6f579c317fec5f1f16e9d3793fab03..d9c28075cbf5367ec46d37bbdd051b95a53d4654 100644 (file)
@@ -83,6 +83,11 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *,
                              struct splice_pipe_desc *);
 extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
                                      splice_direct_actor *);
+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);
 
 /*
  * for dynamic pipe sizing