summaryrefslogtreecommitdiffstats
path: root/tools/virtiofsd/buffer.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert2019-02-08 13:49:54 +0100
committerDr. David Alan Gilbert2020-01-23 17:41:36 +0100
commita3e23f325439a290c504d6bbc48c2e742149ecab (patch)
treecb2536210f239e5e8efba6bb5a8f2716241c2cd4 /tools/virtiofsd/buffer.c
parentvirtiofsd: Add passthrough_ll (diff)
downloadqemu-a3e23f325439a290c504d6bbc48c2e742149ecab.tar.gz
qemu-a3e23f325439a290c504d6bbc48c2e742149ecab.tar.xz
qemu-a3e23f325439a290c504d6bbc48c2e742149ecab.zip
virtiofsd: Trim down imported files
There's a lot of the original fuse code we don't need; trim them down. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> with additional trimming by: Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools/virtiofsd/buffer.c')
-rw-r--r--tools/virtiofsd/buffer.c71
1 files changed, 1 insertions, 70 deletions
diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
index 5ab9b87455..aefb7dbf15 100644
--- a/tools/virtiofsd/buffer.c
+++ b/tools/virtiofsd/buffer.c
@@ -157,73 +157,6 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
return copied;
}
-#ifdef HAVE_SPLICE
-static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
- const struct fuse_buf *src, size_t src_off,
- size_t len, enum fuse_buf_copy_flags flags)
-{
- int splice_flags = 0;
- off_t *srcpos = NULL;
- off_t *dstpos = NULL;
- off_t srcpos_val;
- off_t dstpos_val;
- ssize_t res;
- size_t copied = 0;
-
- if (flags & FUSE_BUF_SPLICE_MOVE)
- splice_flags |= SPLICE_F_MOVE;
- if (flags & FUSE_BUF_SPLICE_NONBLOCK)
- splice_flags |= SPLICE_F_NONBLOCK;
-
- if (src->flags & FUSE_BUF_FD_SEEK) {
- srcpos_val = src->pos + src_off;
- srcpos = &srcpos_val;
- }
- if (dst->flags & FUSE_BUF_FD_SEEK) {
- dstpos_val = dst->pos + dst_off;
- dstpos = &dstpos_val;
- }
-
- while (len) {
- res = splice(src->fd, srcpos, dst->fd, dstpos, len,
- splice_flags);
- if (res == -1) {
- if (copied)
- break;
-
- if (errno != EINVAL || (flags & FUSE_BUF_FORCE_SPLICE))
- return -errno;
-
- /* Maybe splice is not supported for this combination */
- return fuse_buf_fd_to_fd(dst, dst_off, src, src_off,
- len);
- }
- if (res == 0)
- break;
-
- copied += res;
- if (!(src->flags & FUSE_BUF_FD_RETRY) &&
- !(dst->flags & FUSE_BUF_FD_RETRY)) {
- break;
- }
-
- len -= res;
- }
-
- return copied;
-}
-#else
-static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
- const struct fuse_buf *src, size_t src_off,
- size_t len, enum fuse_buf_copy_flags flags)
-{
- (void) flags;
-
- return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
-}
-#endif
-
-
static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
const struct fuse_buf *src, size_t src_off,
size_t len, enum fuse_buf_copy_flags flags)
@@ -247,10 +180,8 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
return fuse_buf_write(dst, dst_off, src, src_off, len);
} else if (!dst_is_fd) {
return fuse_buf_read(dst, dst_off, src, src_off, len);
- } else if (flags & FUSE_BUF_NO_SPLICE) {
- return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
} else {
- return fuse_buf_splice(dst, dst_off, src, src_off, len, flags);
+ return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
}
}