diff options
Diffstat (limited to 'netfs/daemon/daemonFile.cpp')
-rw-r--r-- | netfs/daemon/daemonFile.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/netfs/daemon/daemonFile.cpp b/netfs/daemon/daemonFile.cpp index 48730bc..ec96bc3 100644 --- a/netfs/daemon/daemonFile.cpp +++ b/netfs/daemon/daemonFile.cpp @@ -6,6 +6,7 @@ #include <sys/stat.h> #include "daemonFile.h" #include <entCache.h> +#include <unistd.h> FileServer::FileServer(int f, EntryTypeConverter & t) : EntryTypeConverter(t), @@ -69,3 +70,22 @@ FileServer::write(Ice::Long offset, Ice::Long size, const NetFS::Buffer data, co } } +Ice::Long +FileServer::copyrange(NetFS::FilePrxPtr to, Ice::Long offsrc, Ice::Long offdst, Ice::Long size, Ice::Int flags, const Ice::Current& ice) +{ + if (auto obj = ice.adapter->findByProxy(to); + auto file = std::dynamic_pointer_cast<FileServer>(obj)) { + errno = 0; + off_t src = offsrc, dst = offdst; + if (auto rtn = copy_file_range(fd, &src, file->fd, &dst, size, flags); + rtn != -1) { + return rtn; + } + throw NetFS::SystemError(errno); + } + else { + to->write(offdst, size, read(offsrc, size, ice)); + return size; + } +} + |