aboutsummaryrefslogtreecommitdiff
path: root/include/fuse_lowlevel.h
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2018-06-18 19:31:43 +0200
committerNikolaus Rath <Nikolaus@rath.org>2018-11-19 12:33:56 +0000
commitfe4f9428fc403fa8b99051f52d84ea5bd13f3855 (patch)
treeb1a5256ba956152490d14a3acd05083a91bb2811 /include/fuse_lowlevel.h
parent4c699e7debd99b178b9574e7dd20f36937ef296e (diff)
downloadlibfuse-fe4f9428fc403fa8b99051f52d84ea5bd13f3855.tar.gz
libfuse: add copy_file_range() support
Add support for the relatively new copy_file_range() syscall. Backend filesystems can now implement an efficient way of cloning/duplicating data ranges within files. See 'man 2 copy_file_range' for more details.
Diffstat (limited to 'include/fuse_lowlevel.h')
-rw-r--r--include/fuse_lowlevel.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 395c0d9..12e3946 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -1160,6 +1160,42 @@ struct fuse_lowlevel_ops {
*/
void (*readdirplus) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
struct fuse_file_info *fi);
+
+ /**
+ * Copy a range of data from one file to another
+ *
+ * Performs an optimized copy between two file descriptors without the
+ * additional cost of transferring data through the FUSE kernel module
+ * to user space (glibc) and then back into the FUSE filesystem again.
+ *
+ * In case this method is not implemented, glibc falls back to reading
+ * data from the source and writing to the destination. Effectively
+ * doing an inefficient copy of the data.
+ *
+ * If this request is answered with an error code of ENOSYS, this is
+ * treated as a permanent failure with error code EOPNOTSUPP, i.e. all
+ * future copy_file_range() requests will fail with EOPNOTSUPP without
+ * being send to the filesystem process.
+ *
+ * Valid replies:
+ * fuse_reply_write
+ * fuse_reply_err
+ *
+ * @param req request handle
+ * @param ino_in the inode number or the source file
+ * @param off_in starting point from were the data should be read
+ * @param fi_in file information of the source file
+ * @param ino_out the inode number or the destination file
+ * @param off_out starting point where the data should be written
+ * @param fi_out file information of the destination file
+ * @param len maximum size of the data to copy
+ * @param flags passed along with the copy_file_range() syscall
+ */
+ void (*copy_file_range) (fuse_req_t req, fuse_ino_t ino_in,
+ off_t off_in, struct fuse_file_info *fi_in,
+ fuse_ino_t ino_out, off_t off_out,
+ struct fuse_file_info *fi_out, size_t len,
+ int flags);
};
/**