summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-03-29 10:40:39 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2020-03-29 10:40:39 +0100
commit1fd518aac79d26a4cd40d7d0b99f7302c45a97c7 (patch)
treeacc8d137442436d1bb7832addd01315a9472fce4 /netfs/fuse
parentFix FUSE version number (diff)
downloadnetfs-1fd518aac79d26a4cd40d7d0b99f7302c45a97c7.tar.bz2
netfs-1fd518aac79d26a4cd40d7d0b99f7302c45a97c7.tar.xz
netfs-1fd518aac79d26a4cd40d7d0b99f7302c45a97c7.zip
Implement copy range
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/fuseApp.h1
-rw-r--r--netfs/fuse/fuseFiles.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index ca3e631..eec2932 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -88,6 +88,7 @@ namespace NetFS {
int release(const char *, struct fuse_file_info * fi) override;
int read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi) override;
int write(const char *, const char * buf, size_t s, off_t o, struct fuse_file_info * fi) override;
+ ssize_t copy_file_range(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) override;
int truncate(const char *, off_t, struct fuse_file_info *) override;
// fs
int statfs(const char *, struct statvfs *) override;
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index c166e46..48b3f87 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -204,6 +204,23 @@ FuseApp::write(const char *, const char * buf, size_t s, off_t o, struct fuse_fi
}
}
+ssize_t
+FuseApp::copy_file_range(const char *, struct fuse_file_info *fi_in, off_t offset_in, const char *, struct fuse_file_info *fi_out, off_t offset_out, size_t size, int flags)
+{
+ try {
+ auto of_in = getProxy<OpenFilePtr>(fi_in->fh);
+ auto of_out = getProxy<OpenFilePtr>(fi_out->fh);
+ auto remote_in = of_in->remote;
+ auto remote_out = of_out->remote;
+ of_in->wait();
+ of_out->wait();
+ return remote_in->copyrange(remote_out, offset_in, offset_out, size, flags);
+ }
+ catch (SystemError & e) {
+ return -e.syserrno;
+ }
+}
+
int
FuseApp::truncate(const char * p, off_t o, fuse_file_info * fi)
{