diff options
author | Niels de Vos <ndevos@redhat.com> | 2018-06-18 19:31:43 +0200 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2018-11-19 12:33:56 +0000 |
commit | fe4f9428fc403fa8b99051f52d84ea5bd13f3855 (patch) | |
tree | b1a5256ba956152490d14a3acd05083a91bb2811 /include/fuse.h | |
parent | 4c699e7debd99b178b9574e7dd20f36937ef296e (diff) | |
download | libfuse-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.h')
-rw-r--r-- | include/fuse.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/fuse.h b/include/fuse.h index 24e04bc..d3644ad 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -750,6 +750,23 @@ struct fuse_operations { */ int (*fallocate) (const char *, int, off_t, off_t, struct fuse_file_info *); + + /** + * 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. + */ + ssize_t (*copy_file_range) (const char *path_in, + struct fuse_file_info *fi_in, + off_t offset_in, const char *path_out, + struct fuse_file_info *fi_out, + off_t offset_out, size_t size, int flags); }; /** Extra context that may be needed by some filesystems @@ -1165,6 +1182,11 @@ int fuse_fs_poll(struct fuse_fs *fs, const char *path, unsigned *reventsp); int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode, off_t offset, off_t length, struct fuse_file_info *fi); +ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs, const char *path_in, + struct fuse_file_info *fi_in, off_t off_in, + const char *path_out, + struct fuse_file_info *fi_out, off_t off_out, + size_t len, int flags); void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn, struct fuse_config *cfg); void fuse_fs_destroy(struct fuse_fs *fs); |