1d442bb
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
1d442bb
Date: Mon, 27 Jan 2020 19:00:48 +0000
1d442bb
Subject: [PATCH] virtiofsd: Remove unused enum fuse_buf_copy_flags
1d442bb
1d442bb
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
1d442bb
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
1d442bb
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442bb
(cherry picked from commit 8c3fe75e0308ba2f01d160ace534b7e386cea808)
1d442bb
---
1d442bb
 tools/virtiofsd/buffer.c         |  7 +++--
1d442bb
 tools/virtiofsd/fuse_common.h    | 46 +-------------------------------
1d442bb
 tools/virtiofsd/fuse_lowlevel.c  | 13 ++++-----
1d442bb
 tools/virtiofsd/fuse_lowlevel.h  | 35 ++----------------------
1d442bb
 tools/virtiofsd/passthrough_ll.c |  4 +--
1d442bb
 5 files changed, 13 insertions(+), 92 deletions(-)
1d442bb
1d442bb
diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
1d442bb
index 5df946c82c..4d507f3302 100644
1d442bb
--- a/tools/virtiofsd/buffer.c
1d442bb
+++ b/tools/virtiofsd/buffer.c
1d442bb
@@ -171,7 +171,7 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
1d442bb
 
1d442bb
 static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
1d442bb
                                  const struct fuse_buf *src, size_t src_off,
1d442bb
-                                 size_t len, enum fuse_buf_copy_flags flags)
1d442bb
+                                 size_t len)
1d442bb
 {
1d442bb
     int src_is_fd = src->flags & FUSE_BUF_IS_FD;
1d442bb
     int dst_is_fd = dst->flags & FUSE_BUF_IS_FD;
1d442bb
@@ -224,8 +224,7 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
1d442bb
     return 1;
1d442bb
 }
1d442bb
 
1d442bb
-ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
1d442bb
-                      enum fuse_buf_copy_flags flags)
1d442bb
+ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv)
1d442bb
 {
1d442bb
     size_t copied = 0;
1d442bb
 
1d442bb
@@ -249,7 +248,7 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
1d442bb
         dst_len = dst->size - dstv->off;
1d442bb
         len = min_size(src_len, dst_len);
1d442bb
 
1d442bb
-        res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len, flags);
1d442bb
+        res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len);
1d442bb
         if (res < 0) {
1d442bb
             if (!copied) {
1d442bb
                 return res;
1d442bb
diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h
1d442bb
index bd9bf861f0..0cb33acc2f 100644
1d442bb
--- a/tools/virtiofsd/fuse_common.h
1d442bb
+++ b/tools/virtiofsd/fuse_common.h
1d442bb
@@ -604,48 +604,6 @@ enum fuse_buf_flags {
1d442bb
     FUSE_BUF_FD_RETRY = (1 << 3),
1d442bb
 };
1d442bb
 
1d442bb
-/**
1d442bb
- * Buffer copy flags
1d442bb
- */
1d442bb
-enum fuse_buf_copy_flags {
1d442bb
-    /**
1d442bb
-     * Don't use splice(2)
1d442bb
-     *
1d442bb
-     * Always fall back to using read and write instead of
1d442bb
-     * splice(2) to copy data from one file descriptor to another.
1d442bb
-     *
1d442bb
-     * If this flag is not set, then only fall back if splice is
1d442bb
-     * unavailable.
1d442bb
-     */
1d442bb
-    FUSE_BUF_NO_SPLICE = (1 << 1),
1d442bb
-
1d442bb
-    /**
1d442bb
-     * Force splice
1d442bb
-     *
1d442bb
-     * Always use splice(2) to copy data from one file descriptor
1d442bb
-     * to another.  If splice is not available, return -EINVAL.
1d442bb
-     */
1d442bb
-    FUSE_BUF_FORCE_SPLICE = (1 << 2),
1d442bb
-
1d442bb
-    /**
1d442bb
-     * Try to move data with splice.
1d442bb
-     *
1d442bb
-     * If splice is used, try to move pages from the source to the
1d442bb
-     * destination instead of copying.  See documentation of
1d442bb
-     * SPLICE_F_MOVE in splice(2) man page.
1d442bb
-     */
1d442bb
-    FUSE_BUF_SPLICE_MOVE = (1 << 3),
1d442bb
-
1d442bb
-    /**
1d442bb
-     * Don't block on the pipe when copying data with splice
1d442bb
-     *
1d442bb
-     * Makes the operations on the pipe non-blocking (if the pipe
1d442bb
-     * is full or empty).  See SPLICE_F_NONBLOCK in the splice(2)
1d442bb
-     * man page.
1d442bb
-     */
1d442bb
-    FUSE_BUF_SPLICE_NONBLOCK = (1 << 4),
1d442bb
-};
1d442bb
-
1d442bb
 /**
1d442bb
  * Single data buffer
1d442bb
  *
1d442bb
@@ -741,11 +699,9 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv);
1d442bb
  *
1d442bb
  * @param dst destination buffer vector
1d442bb
  * @param src source buffer vector
1d442bb
- * @param flags flags controlling the copy
1d442bb
  * @return actual number of bytes copied or -errno on error
1d442bb
  */
1d442bb
-ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
1d442bb
-                      enum fuse_buf_copy_flags flags);
1d442bb
+ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src);
1d442bb
 
1d442bb
 /*
1d442bb
  * Signal handling
1d442bb
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
1d442bb
index eb0ec49d38..3da80de233 100644
1d442bb
--- a/tools/virtiofsd/fuse_lowlevel.c
1d442bb
+++ b/tools/virtiofsd/fuse_lowlevel.c
1d442bb
@@ -490,16 +490,14 @@ static int fuse_send_data_iov_fallback(struct fuse_session *se,
1d442bb
 
1d442bb
 static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
1d442bb
                               struct iovec *iov, int iov_count,
1d442bb
-                              struct fuse_bufvec *buf, unsigned int flags)
1d442bb
+                              struct fuse_bufvec *buf)
1d442bb
 {
1d442bb
     size_t len = fuse_buf_size(buf);
1d442bb
-    (void)flags;
1d442bb
 
1d442bb
     return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1d442bb
 }
1d442bb
 
1d442bb
-int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
1d442bb
-                    enum fuse_buf_copy_flags flags)
1d442bb
+int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv)
1d442bb
 {
1d442bb
     struct iovec iov[2];
1d442bb
     struct fuse_out_header out;
1d442bb
@@ -511,7 +509,7 @@ int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
1d442bb
     out.unique = req->unique;
1d442bb
     out.error = 0;
1d442bb
 
1d442bb
-    res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);
1d442bb
+    res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv);
1d442bb
     if (res <= 0) {
1d442bb
         fuse_free_req(req);
1d442bb
         return res;
1d442bb
@@ -1969,8 +1967,7 @@ int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
1d442bb
 }
1d442bb
 
1d442bb
 int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
1d442bb
-                               off_t offset, struct fuse_bufvec *bufv,
1d442bb
-                               enum fuse_buf_copy_flags flags)
1d442bb
+                               off_t offset, struct fuse_bufvec *bufv)
1d442bb
 {
1d442bb
     struct fuse_out_header out;
1d442bb
     struct fuse_notify_store_out outarg;
1d442bb
@@ -1999,7 +1996,7 @@ int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
1d442bb
     iov[1].iov_base = &outarg;
1d442bb
     iov[1].iov_len = sizeof(outarg);
1d442bb
 
1d442bb
-    res = fuse_send_data_iov(se, NULL, iov, 2, bufv, flags);
1d442bb
+    res = fuse_send_data_iov(se, NULL, iov, 2, bufv);
1d442bb
     if (res > 0) {
1d442bb
         res = -res;
1d442bb
     }
1d442bb
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
1d442bb
index 12a84b460f..2fa225d40b 100644
1d442bb
--- a/tools/virtiofsd/fuse_lowlevel.h
1d442bb
+++ b/tools/virtiofsd/fuse_lowlevel.h
1d442bb
@@ -1363,33 +1363,6 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
1d442bb
 /**
1d442bb
  * Reply with data copied/moved from buffer(s)
1d442bb
  *
1d442bb
- * Zero copy data transfer ("splicing") will be used under
1d442bb
- * the following circumstances:
1d442bb
- *
1d442bb
- * 1. FUSE_CAP_SPLICE_WRITE is set in fuse_conn_info.want, and
1d442bb
- * 2. the kernel supports splicing from the fuse device
1d442bb
- *    (FUSE_CAP_SPLICE_WRITE is set in fuse_conn_info.capable), and
1d442bb
- * 3. *flags* does not contain FUSE_BUF_NO_SPLICE
1d442bb
- * 4. The amount of data that is provided in file-descriptor backed
1d442bb
- *    buffers (i.e., buffers for which bufv[n].flags == FUSE_BUF_FD)
1d442bb
- *    is at least twice the page size.
1d442bb
- *
1d442bb
- * In order for SPLICE_F_MOVE to be used, the following additional
1d442bb
- * conditions have to be fulfilled:
1d442bb
- *
1d442bb
- * 1. FUSE_CAP_SPLICE_MOVE is set in fuse_conn_info.want, and
1d442bb
- * 2. the kernel supports it (i.e, FUSE_CAP_SPLICE_MOVE is set in
1d442bb
-      fuse_conn_info.capable), and
1d442bb
- * 3. *flags* contains FUSE_BUF_SPLICE_MOVE
1d442bb
- *
1d442bb
- * Note that, if splice is used, the data is actually spliced twice:
1d442bb
- * once into a temporary pipe (to prepend header data), and then again
1d442bb
- * into the kernel. If some of the provided buffers are memory-backed,
1d442bb
- * the data in them is copied in step one and spliced in step two.
1d442bb
- *
1d442bb
- * The FUSE_BUF_SPLICE_FORCE_SPLICE and FUSE_BUF_SPLICE_NONBLOCK flags
1d442bb
- * are silently ignored.
1d442bb
- *
1d442bb
  * Possible requests:
1d442bb
  *   read, readdir, getxattr, listxattr
1d442bb
  *
1d442bb
@@ -1400,11 +1373,9 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
1d442bb
  *
1d442bb
  * @param req request handle
1d442bb
  * @param bufv buffer vector
1d442bb
- * @param flags flags controlling the copy
1d442bb
  * @return zero for success, -errno for failure to send reply
1d442bb
  */
1d442bb
-int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
1d442bb
-                    enum fuse_buf_copy_flags flags);
1d442bb
+int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv);
1d442bb
 
1d442bb
 /**
1d442bb
  * Reply with data vector
1d442bb
@@ -1705,12 +1676,10 @@ int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
1d442bb
  * @param ino the inode number
1d442bb
  * @param offset the starting offset into the file to store to
1d442bb
  * @param bufv buffer vector
1d442bb
- * @param flags flags controlling the copy
1d442bb
  * @return zero for success, -errno for failure
1d442bb
  */
1d442bb
 int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
1d442bb
-                               off_t offset, struct fuse_bufvec *bufv,
1d442bb
-                               enum fuse_buf_copy_flags flags);
1d442bb
+                               off_t offset, struct fuse_bufvec *bufv);
1d442bb
 
1d442bb
 /*
1d442bb
  * Utility functions
1d442bb
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
1d442bb
index 9377718d9d..126a56ccbd 100644
1d442bb
--- a/tools/virtiofsd/passthrough_ll.c
1d442bb
+++ b/tools/virtiofsd/passthrough_ll.c
1d442bb
@@ -931,7 +931,7 @@ static void lo_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t offset,
1d442bb
     buf.buf[0].fd = fi->fh;
1d442bb
     buf.buf[0].pos = offset;
1d442bb
 
1d442bb
-    fuse_reply_data(req, &buf, FUSE_BUF_SPLICE_MOVE);
1d442bb
+    fuse_reply_data(req, &buf;;
1d442bb
 }
1d442bb
 
1d442bb
 static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
1d442bb
@@ -952,7 +952,7 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
1d442bb
                  out_buf.buf[0].size, (unsigned long)off);
1d442bb
     }
1d442bb
 
1d442bb
-    res = fuse_buf_copy(&out_buf, in_buf, 0);
1d442bb
+    res = fuse_buf_copy(&out_buf, in_buf);
1d442bb
     if (res < 0) {
1d442bb
         fuse_reply_err(req, -res);
1d442bb
     } else {