Blame 0015-virtiofsd-Trim-down-imported-files.patch

1d442b
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:00:44 +0000
1d442b
Subject: [PATCH] virtiofsd: Trim down imported files
1d442b
MIME-Version: 1.0
1d442b
Content-Type: text/plain; charset=UTF-8
1d442b
Content-Transfer-Encoding: 8bit
1d442b
1d442b
There's a lot of the original fuse code we don't need; trim them down.
1d442b
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
with additional trimming by:
1d442b
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
1d442b
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
1d442b
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit a3e23f325439a290c504d6bbc48c2e742149ecab)
1d442b
---
1d442b
 tools/virtiofsd/buffer.c              |  71 +--
1d442b
 tools/virtiofsd/fuse.h                |  46 --
1d442b
 tools/virtiofsd/fuse_common.h         |  32 --
1d442b
 tools/virtiofsd/fuse_i.h              |  41 --
1d442b
 tools/virtiofsd/fuse_log.h            |   8 -
1d442b
 tools/virtiofsd/fuse_lowlevel.c       | 675 +-------------------------
1d442b
 tools/virtiofsd/fuse_lowlevel.h       |  28 --
1d442b
 tools/virtiofsd/fuse_opt.h            |   8 -
1d442b
 tools/virtiofsd/helper.c              | 143 ------
1d442b
 tools/virtiofsd/passthrough_helpers.h |  26 -
1d442b
 tools/virtiofsd/passthrough_ll.c      |   1 -
1d442b
 11 files changed, 8 insertions(+), 1071 deletions(-)
1d442b
1d442b
diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
1d442b
index 5ab9b87455..aefb7dbf15 100644
1d442b
--- a/tools/virtiofsd/buffer.c
1d442b
+++ b/tools/virtiofsd/buffer.c
1d442b
@@ -157,73 +157,6 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
1d442b
 	return copied;
1d442b
 }
1d442b
 
1d442b
-#ifdef HAVE_SPLICE
1d442b
-static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
1d442b
-			       const struct fuse_buf *src, size_t src_off,
1d442b
-			       size_t len, enum fuse_buf_copy_flags flags)
1d442b
-{
1d442b
-	int splice_flags = 0;
1d442b
-	off_t *srcpos = NULL;
1d442b
-	off_t *dstpos = NULL;
1d442b
-	off_t srcpos_val;
1d442b
-	off_t dstpos_val;
1d442b
-	ssize_t res;
1d442b
-	size_t copied = 0;
1d442b
-
1d442b
-	if (flags & FUSE_BUF_SPLICE_MOVE)
1d442b
-		splice_flags |= SPLICE_F_MOVE;
1d442b
-	if (flags & FUSE_BUF_SPLICE_NONBLOCK)
1d442b
-		splice_flags |= SPLICE_F_NONBLOCK;
1d442b
-
1d442b
-	if (src->flags & FUSE_BUF_FD_SEEK) {
1d442b
-		srcpos_val = src->pos + src_off;
1d442b
-		srcpos = &srcpos_val;
1d442b
-	}
1d442b
-	if (dst->flags & FUSE_BUF_FD_SEEK) {
1d442b
-		dstpos_val = dst->pos + dst_off;
1d442b
-		dstpos = &dstpos_val;
1d442b
-	}
1d442b
-
1d442b
-	while (len) {
1d442b
-		res = splice(src->fd, srcpos, dst->fd, dstpos, len,
1d442b
-			     splice_flags);
1d442b
-		if (res == -1) {
1d442b
-			if (copied)
1d442b
-				break;
1d442b
-
1d442b
-			if (errno != EINVAL || (flags & FUSE_BUF_FORCE_SPLICE))
1d442b
-				return -errno;
1d442b
-
1d442b
-			/* Maybe splice is not supported for this combination */
1d442b
-			return fuse_buf_fd_to_fd(dst, dst_off, src, src_off,
1d442b
-						 len);
1d442b
-		}
1d442b
-		if (res == 0)
1d442b
-			break;
1d442b
-
1d442b
-		copied += res;
1d442b
-		if (!(src->flags & FUSE_BUF_FD_RETRY) &&
1d442b
-		    !(dst->flags & FUSE_BUF_FD_RETRY)) {
1d442b
-			break;
1d442b
-		}
1d442b
-
1d442b
-		len -= res;
1d442b
-	}
1d442b
-
1d442b
-	return copied;
1d442b
-}
1d442b
-#else
1d442b
-static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
1d442b
-			       const struct fuse_buf *src, size_t src_off,
1d442b
-			       size_t len, enum fuse_buf_copy_flags flags)
1d442b
-{
1d442b
-	(void) flags;
1d442b
-
1d442b
-	return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
-
1d442b
 static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
1d442b
 				 const struct fuse_buf *src, size_t src_off,
1d442b
 				 size_t len, enum fuse_buf_copy_flags flags)
1d442b
@@ -247,10 +180,8 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
1d442b
 		return fuse_buf_write(dst, dst_off, src, src_off, len);
1d442b
 	} else if (!dst_is_fd) {
1d442b
 		return fuse_buf_read(dst, dst_off, src, src_off, len);
1d442b
-	} else if (flags & FUSE_BUF_NO_SPLICE) {
1d442b
-		return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
1d442b
 	} else {
1d442b
-		return fuse_buf_splice(dst, dst_off, src, src_off, len, flags);
1d442b
+		return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
1d442b
 	}
1d442b
 }
1d442b
 
1d442b
diff --git a/tools/virtiofsd/fuse.h b/tools/virtiofsd/fuse.h
1d442b
index 883f6e59fb..3202fba6bb 100644
1d442b
--- a/tools/virtiofsd/fuse.h
1d442b
+++ b/tools/virtiofsd/fuse.h
1d442b
@@ -25,10 +25,6 @@
1d442b
 #include <sys/statvfs.h>
1d442b
 #include <sys/uio.h>
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-extern "C" {
1d442b
-#endif
1d442b
-
1d442b
 /* ----------------------------------------------------------- *
1d442b
  * Basic FUSE API					       *
1d442b
  * ----------------------------------------------------------- */
1d442b
@@ -978,44 +974,6 @@ int fuse_loop(struct fuse *f);
1d442b
  */
1d442b
 void fuse_exit(struct fuse *f);
1d442b
 
1d442b
-/**
1d442b
- * FUSE event loop with multiple threads
1d442b
- *
1d442b
- * Requests from the kernel are processed, and the appropriate
1d442b
- * operations are called.  Request are processed in parallel by
1d442b
- * distributing them between multiple threads.
1d442b
- *
1d442b
- * For a description of the return value and the conditions when the
1d442b
- * event loop exits, refer to the documentation of
1d442b
- * fuse_session_loop().
1d442b
- *
1d442b
- * Note: using fuse_loop() instead of fuse_loop_mt() means you are running in
1d442b
- * single-threaded mode, and that you will not have to worry about reentrancy,
1d442b
- * though you will have to worry about recursive lookups. In single-threaded
1d442b
- * mode, FUSE will wait for one callback to return before calling another.
1d442b
- *
1d442b
- * Enabling multiple threads, by using fuse_loop_mt(), will cause FUSE to make
1d442b
- * multiple simultaneous calls into the various callback functions given by your
1d442b
- * fuse_operations record.
1d442b
- *
1d442b
- * If you are using multiple threads, you can enjoy all the parallel execution
1d442b
- * and interactive response benefits of threads, and you get to enjoy all the
1d442b
- * benefits of race conditions and locking bugs, too. Ensure that any code used
1d442b
- * in the callback function of fuse_operations is also thread-safe.
1d442b
- *
1d442b
- * @param f the FUSE handle
1d442b
- * @param config loop configuration
1d442b
- * @return see fuse_session_loop()
1d442b
- *
1d442b
- * See also: fuse_loop()
1d442b
- */
1d442b
-#if FUSE_USE_VERSION < 32
1d442b
-int fuse_loop_mt_31(struct fuse *f, int clone_fd);
1d442b
-#define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
1d442b
-#else
1d442b
-int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
1d442b
-#endif
1d442b
-
1d442b
 /**
1d442b
  * Get the current context
1d442b
  *
1d442b
@@ -1268,8 +1226,4 @@ struct fuse_session *fuse_get_session(struct fuse *f);
1d442b
  */
1d442b
 int fuse_open_channel(const char *mountpoint, const char *options);
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
 #endif /* FUSE_H_ */
1d442b
diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h
1d442b
index 2d686b2ac4..bf8f8cc865 100644
1d442b
--- a/tools/virtiofsd/fuse_common.h
1d442b
+++ b/tools/virtiofsd/fuse_common.h
1d442b
@@ -28,10 +28,6 @@
1d442b
 #define FUSE_MAKE_VERSION(maj, min)  ((maj) * 10 + (min))
1d442b
 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-extern "C" {
1d442b
-#endif
1d442b
-
1d442b
 /**
1d442b
  * Information about an open file.
1d442b
  *
1d442b
@@ -100,30 +96,6 @@ struct fuse_file_info {
1d442b
 	uint32_t poll_events;
1d442b
 };
1d442b
 
1d442b
-/**
1d442b
- * Configuration parameters passed to fuse_session_loop_mt() and
1d442b
- * fuse_loop_mt().
1d442b
- */
1d442b
-struct fuse_loop_config {
1d442b
-	/**
1d442b
-	 * whether to use separate device fds for each thread
1d442b
-	 * (may increase performance)
1d442b
-	 */
1d442b
-	int clone_fd;
1d442b
-
1d442b
-	/**
1d442b
-	 * The maximum number of available worker threads before they
1d442b
-	 * start to get deleted when they become idle. If not
1d442b
-	 * specified, the default is 10.
1d442b
-	 *
1d442b
-	 * Adjusting this has performance implications; a very small number
1d442b
-	 * of threads in the pool will cause a lot of thread creation and
1d442b
-	 * deletion overhead and performance may suffer. When set to 0, a new
1d442b
-	 * thread will be created to service every operation.
1d442b
-	 */
1d442b
-	unsigned int max_idle_threads;
1d442b
-};
1d442b
-
1d442b
 /**************************************************************************
1d442b
  * Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
1d442b
  **************************************************************************/
1d442b
@@ -802,10 +774,6 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
1d442b
 #  error only API version 30 or greater is supported
1d442b
 #endif
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
 
1d442b
 /*
1d442b
  * This interface uses 64 bit off_t.
1d442b
diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
1d442b
index d38b630ac5..b39522e3ca 100644
1d442b
--- a/tools/virtiofsd/fuse_i.h
1d442b
+++ b/tools/virtiofsd/fuse_i.h
1d442b
@@ -9,8 +9,6 @@
1d442b
 #include "fuse.h"
1d442b
 #include "fuse_lowlevel.h"
1d442b
 
1d442b
-struct mount_opts;
1d442b
-
1d442b
 struct fuse_req {
1d442b
 	struct fuse_session *se;
1d442b
 	uint64_t unique;
1d442b
@@ -45,7 +43,6 @@ struct fuse_session {
1d442b
 	char *mountpoint;
1d442b
 	volatile int exited;
1d442b
 	int fd;
1d442b
-	struct mount_opts *mo;
1d442b
 	int debug;
1d442b
 	int deny_others;
1d442b
 	struct fuse_lowlevel_ops op;
1d442b
@@ -58,7 +55,6 @@ struct fuse_session {
1d442b
 	struct fuse_req interrupts;
1d442b
 	pthread_mutex_t lock;
1d442b
 	int got_destroy;
1d442b
-	pthread_key_t pipe_key;
1d442b
 	int broken_splice_nonblock;
1d442b
 	uint64_t notify_ctr;
1d442b
 	struct fuse_notify_req notify_list;
1d442b
@@ -87,53 +83,16 @@ struct fuse_module {
1d442b
 	int ctr;
1d442b
 };
1d442b
 
1d442b
-/* ----------------------------------------------------------- *
1d442b
- * Channel interface (when using -o clone_fd)		       *
1d442b
- * ----------------------------------------------------------- */
1d442b
-
1d442b
-/**
1d442b
- * Obtain counted reference to the channel
1d442b
- *
1d442b
- * @param ch the channel
1d442b
- * @return the channel
1d442b
- */
1d442b
-struct fuse_chan *fuse_chan_get(struct fuse_chan *ch);
1d442b
-
1d442b
-/**
1d442b
- * Drop counted reference to a channel
1d442b
- *
1d442b
- * @param ch the channel
1d442b
- */
1d442b
-void fuse_chan_put(struct fuse_chan *ch);
1d442b
-
1d442b
-struct mount_opts *parse_mount_opts(struct fuse_args *args);
1d442b
-void destroy_mount_opts(struct mount_opts *mo);
1d442b
-void fuse_mount_version(void);
1d442b
-unsigned get_max_read(struct mount_opts *o);
1d442b
-void fuse_kern_unmount(const char *mountpoint, int fd);
1d442b
-int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo);
1d442b
-
1d442b
 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
1d442b
 			       int count);
1d442b
 void fuse_free_req(fuse_req_t req);
1d442b
 
1d442b
-void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
1d442b
-
1d442b
-int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
1d442b
-
1d442b
-int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
1d442b
-				 struct fuse_chan *ch);
1d442b
 void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
 				  const struct fuse_buf *buf, struct fuse_chan *ch);
1d442b
 
1d442b
-struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op,
1d442b
-		      size_t op_size, void *private_data);
1d442b
-int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config);
1d442b
-int fuse_session_loop_mt_32(struct fuse_session *se, struct fuse_loop_config *config);
1d442b
 
1d442b
 #define FUSE_MAX_MAX_PAGES 256
1d442b
 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
1d442b
 
1d442b
 /* room needed in buffer to accommodate header */
1d442b
 #define FUSE_BUFFER_HEADER_SIZE 0x1000
1d442b
-
1d442b
diff --git a/tools/virtiofsd/fuse_log.h b/tools/virtiofsd/fuse_log.h
1d442b
index 5e112e0f53..0af700da6b 100644
1d442b
--- a/tools/virtiofsd/fuse_log.h
1d442b
+++ b/tools/virtiofsd/fuse_log.h
1d442b
@@ -16,10 +16,6 @@
1d442b
 
1d442b
 #include <stdarg.h>
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-extern "C" {
1d442b
-#endif
1d442b
-
1d442b
 /**
1d442b
  * Log severity level
1d442b
  *
1d442b
@@ -75,8 +71,4 @@ void fuse_set_log_func(fuse_log_func_t func);
1d442b
  */
1d442b
 void fuse_log(enum fuse_log_level level, const char *fmt, ...);
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
 #endif /* FUSE_LOG_H_ */
1d442b
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
1d442b
index f2d7038e34..e6fa247924 100644
1d442b
--- a/tools/virtiofsd/fuse_lowlevel.c
1d442b
+++ b/tools/virtiofsd/fuse_lowlevel.c
1d442b
@@ -16,7 +16,6 @@
1d442b
 #include "fuse_kernel.h"
1d442b
 #include "fuse_opt.h"
1d442b
 #include "fuse_misc.h"
1d442b
-#include "mount_util.h"
1d442b
 
1d442b
 #include <stdio.h>
1d442b
 #include <stdlib.h>
1d442b
@@ -28,12 +27,6 @@
1d442b
 #include <assert.h>
1d442b
 #include <sys/file.h>
1d442b
 
1d442b
-#ifndef F_LINUX_SPECIFIC_BASE
1d442b
-#define F_LINUX_SPECIFIC_BASE       1024
1d442b
-#endif
1d442b
-#ifndef F_SETPIPE_SZ
1d442b
-#define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
1d442b
-#endif
1d442b
 
1d442b
 
1d442b
 #define PARAM(inarg) (((char *)(inarg)) + sizeof(*(inarg)))
1d442b
@@ -137,7 +130,6 @@ void fuse_free_req(fuse_req_t req)
1d442b
 	req->u.ni.data = NULL;
1d442b
 	list_del_req(req);
1d442b
 	ctr = --req->ctr;
1d442b
-	fuse_chan_put(req->ch);
1d442b
 	req->ch = NULL;
1d442b
 	pthread_mutex_unlock(&se->lock);
1d442b
 	if (!ctr)
1d442b
@@ -184,19 +176,7 @@ static int fuse_send_msg(struct fuse_session *se, struct fuse_chan *ch,
1d442b
 		}
1d442b
 	}
1d442b
 
1d442b
-	ssize_t res = writev(ch ? ch->fd : se->fd,
1d442b
-			     iov, count);
1d442b
-	int err = errno;
1d442b
-
1d442b
-	if (res == -1) {
1d442b
-		assert(se != NULL);
1d442b
-
1d442b
-		/* ENOENT means the operation was interrupted */
1d442b
-		if (!fuse_session_exited(se) && err != ENOENT)
1d442b
-			perror("fuse: writing device");
1d442b
-		return -err;
1d442b
-	}
1d442b
-
1d442b
+	abort(); /* virtio should have taken it before here */
1d442b
 	return 0;
1d442b
 }
1d442b
 
1d442b
@@ -480,10 +460,6 @@ static int fuse_send_data_iov_fallback(struct fuse_session *se,
1d442b
 				       struct fuse_bufvec *buf,
1d442b
 				       size_t len)
1d442b
 {
1d442b
-	struct fuse_bufvec mem_buf = FUSE_BUFVEC_INIT(len);
1d442b
-	void *mbuf;
1d442b
-	int res;
1d442b
-
1d442b
 	/* Optimize common case */
1d442b
 	if (buf->count == 1 && buf->idx == 0 && buf->off == 0 &&
1d442b
 	    !(buf->buf[0].flags & FUSE_BUF_IS_FD)) {
1d442b
@@ -496,350 +472,10 @@ static int fuse_send_data_iov_fallback(struct fuse_session *se,
1d442b
 		return fuse_send_msg(se, ch, iov, iov_count);
1d442b
 	}
1d442b
 
1d442b
-	res = posix_memalign(&mbuf, pagesize, len);
1d442b
-	if (res != 0)
1d442b
-		return res;
1d442b
-
1d442b
-	mem_buf.buf[0].mem = mbuf;
1d442b
-	res = fuse_buf_copy(&mem_buf, buf, 0);
1d442b
-	if (res < 0) {
1d442b
-		free(mbuf);
1d442b
-		return -res;
1d442b
-	}
1d442b
-	len = res;
1d442b
-
1d442b
-	iov[iov_count].iov_base = mbuf;
1d442b
-	iov[iov_count].iov_len = len;
1d442b
-	iov_count++;
1d442b
-	res = fuse_send_msg(se, ch, iov, iov_count);
1d442b
-	free(mbuf);
1d442b
-
1d442b
-	return res;
1d442b
-}
1d442b
-
1d442b
-struct fuse_ll_pipe {
1d442b
-	size_t size;
1d442b
-	int can_grow;
1d442b
-	int pipe[2];
1d442b
-};
1d442b
-
1d442b
-static void fuse_ll_pipe_free(struct fuse_ll_pipe *llp)
1d442b
-{
1d442b
-	close(llp->pipe[0]);
1d442b
-	close(llp->pipe[1]);
1d442b
-	free(llp);
1d442b
-}
1d442b
-
1d442b
-#ifdef HAVE_SPLICE
1d442b
-#if !defined(HAVE_PIPE2) || !defined(O_CLOEXEC)
1d442b
-static int fuse_pipe(int fds[2])
1d442b
-{
1d442b
-	int rv = pipe(fds);
1d442b
-
1d442b
-	if (rv == -1)
1d442b
-		return rv;
1d442b
-
1d442b
-	if (fcntl(fds[0], F_SETFL, O_NONBLOCK) == -1 ||
1d442b
-	    fcntl(fds[1], F_SETFL, O_NONBLOCK) == -1 ||
1d442b
-	    fcntl(fds[0], F_SETFD, FD_CLOEXEC) == -1 ||
1d442b
-	    fcntl(fds[1], F_SETFD, FD_CLOEXEC) == -1) {
1d442b
-		close(fds[0]);
1d442b
-		close(fds[1]);
1d442b
-		rv = -1;
1d442b
-	}
1d442b
-	return rv;
1d442b
-}
1d442b
-#else
1d442b
-static int fuse_pipe(int fds[2])
1d442b
-{
1d442b
-	return pipe2(fds, O_CLOEXEC | O_NONBLOCK);
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
-static struct fuse_ll_pipe *fuse_ll_get_pipe(struct fuse_session *se)
1d442b
-{
1d442b
-	struct fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);
1d442b
-	if (llp == NULL) {
1d442b
-		int res;
1d442b
-
1d442b
-		llp = malloc(sizeof(struct fuse_ll_pipe));
1d442b
-		if (llp == NULL)
1d442b
-			return NULL;
1d442b
-
1d442b
-		res = fuse_pipe(llp->pipe);
1d442b
-		if (res == -1) {
1d442b
-			free(llp);
1d442b
-			return NULL;
1d442b
-		}
1d442b
-
1d442b
-		/*
1d442b
-		 *the default size is 16 pages on linux
1d442b
-		 */
1d442b
-		llp->size = pagesize * 16;
1d442b
-		llp->can_grow = 1;
1d442b
-
1d442b
-		pthread_setspecific(se->pipe_key, llp);
1d442b
-	}
1d442b
-
1d442b
-	return llp;
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
-static void fuse_ll_clear_pipe(struct fuse_session *se)
1d442b
-{
1d442b
-	struct fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);
1d442b
-	if (llp) {
1d442b
-		pthread_setspecific(se->pipe_key, NULL);
1d442b
-		fuse_ll_pipe_free(llp);
1d442b
-	}
1d442b
-}
1d442b
-
1d442b
-#if defined(HAVE_SPLICE) && defined(HAVE_VMSPLICE)
1d442b
-static int read_back(int fd, char *buf, size_t len)
1d442b
-{
1d442b
-	int res;
1d442b
-
1d442b
-	res = read(fd, buf, len);
1d442b
-	if (res == -1) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: internal error: failed to read back from pipe: %s\n", strerror(errno));
1d442b
-		return -EIO;
1d442b
-	}
1d442b
-	if (res != len) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: internal error: short read back from pipe: %i from %zi\n", res, len);
1d442b
-		return -EIO;
1d442b
-	}
1d442b
+	abort(); /* Will have taken vhost path */
1d442b
 	return 0;
1d442b
 }
1d442b
 
1d442b
-static int grow_pipe_to_max(int pipefd)
1d442b
-{
1d442b
-	int max;
1d442b
-	int res;
1d442b
-	int maxfd;
1d442b
-	char buf[32];
1d442b
-
1d442b
-	maxfd = open("/proc/sys/fs/pipe-max-size", O_RDONLY);
1d442b
-	if (maxfd < 0)
1d442b
-		return -errno;
1d442b
-
1d442b
-	res = read(maxfd, buf, sizeof(buf) - 1);
1d442b
-	if (res < 0) {
1d442b
-		int saved_errno;
1d442b
-
1d442b
-		saved_errno = errno;
1d442b
-		close(maxfd);
1d442b
-		return -saved_errno;
1d442b
-	}
1d442b
-	close(maxfd);
1d442b
-	buf[res] = '\0';
1d442b
-
1d442b
-	max = atoi(buf);
1d442b
-	res = fcntl(pipefd, F_SETPIPE_SZ, max);
1d442b
-	if (res < 0)
1d442b
-		return -errno;
1d442b
-	return max;
1d442b
-}
1d442b
-
1d442b
-static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
1d442b
-			       struct iovec *iov, int iov_count,
1d442b
-			       struct fuse_bufvec *buf, unsigned int flags)
1d442b
-{
1d442b
-	int res;
1d442b
-	size_t len = fuse_buf_size(buf);
1d442b
-	struct fuse_out_header *out = iov[0].iov_base;
1d442b
-	struct fuse_ll_pipe *llp;
1d442b
-	int splice_flags;
1d442b
-	size_t pipesize;
1d442b
-	size_t total_fd_size;
1d442b
-	size_t idx;
1d442b
-	size_t headerlen;
1d442b
-	struct fuse_bufvec pipe_buf = FUSE_BUFVEC_INIT(len);
1d442b
-
1d442b
-	if (se->broken_splice_nonblock)
1d442b
-		goto fallback;
1d442b
-
1d442b
-	if (flags & FUSE_BUF_NO_SPLICE)
1d442b
-		goto fallback;
1d442b
-
1d442b
-	total_fd_size = 0;
1d442b
-	for (idx = buf->idx; idx < buf->count; idx++) {
1d442b
-		if (buf->buf[idx].flags & FUSE_BUF_IS_FD) {
1d442b
-			total_fd_size = buf->buf[idx].size;
1d442b
-			if (idx == buf->idx)
1d442b
-				total_fd_size -= buf->off;
1d442b
-		}
1d442b
-	}
1d442b
-	if (total_fd_size < 2 * pagesize)
1d442b
-		goto fallback;
1d442b
-
1d442b
-	if (se->conn.proto_minor < 14 ||
1d442b
-	    !(se->conn.want & FUSE_CAP_SPLICE_WRITE))
1d442b
-		goto fallback;
1d442b
-
1d442b
-	llp = fuse_ll_get_pipe(se);
1d442b
-	if (llp == NULL)
1d442b
-		goto fallback;
1d442b
-
1d442b
-
1d442b
-	headerlen = iov_length(iov, iov_count);
1d442b
-
1d442b
-	out->len = headerlen + len;
1d442b
-
1d442b
-	/*
1d442b
-	 * Heuristic for the required pipe size, does not work if the
1d442b
-	 * source contains less than page size fragments
1d442b
-	 */
1d442b
-	pipesize = pagesize * (iov_count + buf->count + 1) + out->len;
1d442b
-
1d442b
-	if (llp->size < pipesize) {
1d442b
-		if (llp->can_grow) {
1d442b
-			res = fcntl(llp->pipe[0], F_SETPIPE_SZ, pipesize);
1d442b
-			if (res == -1) {
1d442b
-				res = grow_pipe_to_max(llp->pipe[0]);
1d442b
-				if (res > 0)
1d442b
-					llp->size = res;
1d442b
-				llp->can_grow = 0;
1d442b
-				goto fallback;
1d442b
-			}
1d442b
-			llp->size = res;
1d442b
-		}
1d442b
-		if (llp->size < pipesize)
1d442b
-			goto fallback;
1d442b
-	}
1d442b
-
1d442b
-
1d442b
-	res = vmsplice(llp->pipe[1], iov, iov_count, SPLICE_F_NONBLOCK);
1d442b
-	if (res == -1)
1d442b
-		goto fallback;
1d442b
-
1d442b
-	if (res != headerlen) {
1d442b
-		res = -EIO;
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: short vmsplice to pipe: %u/%zu\n", res,
1d442b
-			headerlen);
1d442b
-		goto clear_pipe;
1d442b
-	}
1d442b
-
1d442b
-	pipe_buf.buf[0].flags = FUSE_BUF_IS_FD;
1d442b
-	pipe_buf.buf[0].fd = llp->pipe[1];
1d442b
-
1d442b
-	res = fuse_buf_copy(&pipe_buf, buf,
1d442b
-			    FUSE_BUF_FORCE_SPLICE | FUSE_BUF_SPLICE_NONBLOCK);
1d442b
-	if (res < 0) {
1d442b
-		if (res == -EAGAIN || res == -EINVAL) {
1d442b
-			/*
1d442b
-			 * Should only get EAGAIN on kernels with
1d442b
-			 * broken SPLICE_F_NONBLOCK support (<=
1d442b
-			 * 2.6.35) where this error or a short read is
1d442b
-			 * returned even if the pipe itself is not
1d442b
-			 * full
1d442b
-			 *
1d442b
-			 * EINVAL might mean that splice can't handle
1d442b
-			 * this combination of input and output.
1d442b
-			 */
1d442b
-			if (res == -EAGAIN)
1d442b
-				se->broken_splice_nonblock = 1;
1d442b
-
1d442b
-			pthread_setspecific(se->pipe_key, NULL);
1d442b
-			fuse_ll_pipe_free(llp);
1d442b
-			goto fallback;
1d442b
-		}
1d442b
-		res = -res;
1d442b
-		goto clear_pipe;
1d442b
-	}
1d442b
-
1d442b
-	if (res != 0 && res < len) {
1d442b
-		struct fuse_bufvec mem_buf = FUSE_BUFVEC_INIT(len);
1d442b
-		void *mbuf;
1d442b
-		size_t now_len = res;
1d442b
-		/*
1d442b
-		 * For regular files a short count is either
1d442b
-		 *  1) due to EOF, or
1d442b
-		 *  2) because of broken SPLICE_F_NONBLOCK (see above)
1d442b
-		 *
1d442b
-		 * For other inputs it's possible that we overflowed
1d442b
-		 * the pipe because of small buffer fragments.
1d442b
-		 */
1d442b
-
1d442b
-		res = posix_memalign(&mbuf, pagesize, len);
1d442b
-		if (res != 0)
1d442b
-			goto clear_pipe;
1d442b
-
1d442b
-		mem_buf.buf[0].mem = mbuf;
1d442b
-		mem_buf.off = now_len;
1d442b
-		res = fuse_buf_copy(&mem_buf, buf, 0);
1d442b
-		if (res > 0) {
1d442b
-			char *tmpbuf;
1d442b
-			size_t extra_len = res;
1d442b
-			/*
1d442b
-			 * Trickiest case: got more data.  Need to get
1d442b
-			 * back the data from the pipe and then fall
1d442b
-			 * back to regular write.
1d442b
-			 */
1d442b
-			tmpbuf = malloc(headerlen);
1d442b
-			if (tmpbuf == NULL) {
1d442b
-				free(mbuf);
1d442b
-				res = ENOMEM;
1d442b
-				goto clear_pipe;
1d442b
-			}
1d442b
-			res = read_back(llp->pipe[0], tmpbuf, headerlen);
1d442b
-			free(tmpbuf);
1d442b
-			if (res != 0) {
1d442b
-				free(mbuf);
1d442b
-				goto clear_pipe;
1d442b
-			}
1d442b
-			res = read_back(llp->pipe[0], mbuf, now_len);
1d442b
-			if (res != 0) {
1d442b
-				free(mbuf);
1d442b
-				goto clear_pipe;
1d442b
-			}
1d442b
-			len = now_len + extra_len;
1d442b
-			iov[iov_count].iov_base = mbuf;
1d442b
-			iov[iov_count].iov_len = len;
1d442b
-			iov_count++;
1d442b
-			res = fuse_send_msg(se, ch, iov, iov_count);
1d442b
-			free(mbuf);
1d442b
-			return res;
1d442b
-		}
1d442b
-		free(mbuf);
1d442b
-		res = now_len;
1d442b
-	}
1d442b
-	len = res;
1d442b
-	out->len = headerlen + len;
1d442b
-
1d442b
-	if (se->debug) {
1d442b
-		fuse_log(FUSE_LOG_DEBUG,
1d442b
-			"   unique: %llu, success, outsize: %i (splice)\n",
1d442b
-			(unsigned long long) out->unique, out->len);
1d442b
-	}
1d442b
-
1d442b
-	splice_flags = 0;
1d442b
-	if ((flags & FUSE_BUF_SPLICE_MOVE) &&
1d442b
-	    (se->conn.want & FUSE_CAP_SPLICE_MOVE))
1d442b
-		splice_flags |= SPLICE_F_MOVE;
1d442b
-
1d442b
-	res = splice(llp->pipe[0], NULL, ch ? ch->fd : se->fd,
1d442b
-		     NULL, out->len, splice_flags);
1d442b
-	if (res == -1) {
1d442b
-		res = -errno;
1d442b
-		perror("fuse: splice from pipe");
1d442b
-		goto clear_pipe;
1d442b
-	}
1d442b
-	if (res != out->len) {
1d442b
-		res = -EIO;
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: short splice from pipe: %u/%u\n",
1d442b
-			res, out->len);
1d442b
-		goto clear_pipe;
1d442b
-	}
1d442b
-	return 0;
1d442b
-
1d442b
-clear_pipe:
1d442b
-	fuse_ll_clear_pipe(se);
1d442b
-	return res;
1d442b
-
1d442b
-fallback:
1d442b
-	return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1d442b
-}
1d442b
-#else
1d442b
 static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
1d442b
 			       struct iovec *iov, int iov_count,
1d442b
 			       struct fuse_bufvec *buf, unsigned int flags)
1d442b
@@ -849,7 +485,6 @@ static int fuse_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
1d442b
 
1d442b
 	return fuse_send_data_iov_fallback(se, ch, iov, iov_count, buf, len);
1d442b
 }
1d442b
-#endif
1d442b
 
1d442b
 int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
1d442b
 		    enum fuse_buf_copy_flags flags)
1d442b
@@ -1408,16 +1043,11 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid, const void *inarg,
1d442b
 	if (bufv.buf[0].size < arg->size) {
1d442b
 		fuse_log(FUSE_LOG_ERR, "fuse: do_write_buf: buffer size too small\n");
1d442b
 		fuse_reply_err(req, EIO);
1d442b
-		goto out;
1d442b
+		return;
1d442b
 	}
1d442b
 	bufv.buf[0].size = arg->size;
1d442b
 
1d442b
 	se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);
1d442b
-
1d442b
-out:
1d442b
-	/* Need to reset the pipe if ->write_buf() didn't consume all data */
1d442b
-	if ((ibuf->flags & FUSE_BUF_IS_FD) && bufv.idx < bufv.count)
1d442b
-		fuse_ll_clear_pipe(se);
1d442b
 }
1d442b
 
1d442b
 static void do_flush(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
1d442b
@@ -2038,17 +1668,6 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
1d442b
 		return;
1d442b
 	}
1d442b
 
1d442b
-	unsigned max_read_mo = get_max_read(se->mo);
1d442b
-	if (se->conn.max_read != max_read_mo) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: error: init() and fuse_session_new() "
1d442b
-			"requested different maximum read size (%u vs %u)\n",
1d442b
-			se->conn.max_read, max_read_mo);
1d442b
-		fuse_reply_err(req, EPROTO);
1d442b
-		se->error = -EPROTO;
1d442b
-		fuse_session_exit(se);
1d442b
-		return;
1d442b
-	}
1d442b
-
1d442b
 	if (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) {
1d442b
 		se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE;
1d442b
 	}
1d442b
@@ -2364,8 +1983,6 @@ static void fuse_ll_retrieve_reply(struct fuse_notify_req *nreq,
1d442b
 	}
1d442b
 out:
1d442b
 	free(rreq);
1d442b
-	if ((ibuf->flags & FUSE_BUF_IS_FD) && bufv.idx < bufv.count)
1d442b
-		fuse_ll_clear_pipe(se);
1d442b
 }
1d442b
 
1d442b
 int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino,
1d442b
@@ -2496,7 +2113,6 @@ static struct {
1d442b
 	[FUSE_RENAME2]     = { do_rename2,      "RENAME2"    },
1d442b
 	[FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
1d442b
 	[FUSE_LSEEK]	   = { do_lseek,       "LSEEK"	     },
1d442b
-	[CUSE_INIT]	   = { cuse_lowlevel_init, "CUSE_INIT"   },
1d442b
 };
1d442b
 
1d442b
 #define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))
1d442b
@@ -2509,21 +2125,6 @@ static const char *opname(enum fuse_opcode opcode)
1d442b
 		return fuse_ll_ops[opcode].name;
1d442b
 }
1d442b
 
1d442b
-static int fuse_ll_copy_from_pipe(struct fuse_bufvec *dst,
1d442b
-				  struct fuse_bufvec *src)
1d442b
-{
1d442b
-	ssize_t res = fuse_buf_copy(dst, src, 0);
1d442b
-	if (res < 0) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: copy from pipe: %s\n", strerror(-res));
1d442b
-		return res;
1d442b
-	}
1d442b
-	if ((size_t)res < fuse_buf_size(dst)) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: copy from pipe: short read\n");
1d442b
-		return -1;
1d442b
-	}
1d442b
-	return 0;
1d442b
-}
1d442b
-
1d442b
 void fuse_session_process_buf(struct fuse_session *se,
1d442b
 			      const struct fuse_buf *buf)
1d442b
 {
1d442b
@@ -2533,36 +2134,12 @@ void fuse_session_process_buf(struct fuse_session *se,
1d442b
 void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
 				  const struct fuse_buf *buf, struct fuse_chan *ch)
1d442b
 {
1d442b
-	const size_t write_header_size = sizeof(struct fuse_in_header) +
1d442b
-		sizeof(struct fuse_write_in);
1d442b
-	struct fuse_bufvec bufv = { .buf[0] = *buf, .count = 1 };
1d442b
-	struct fuse_bufvec tmpbuf = FUSE_BUFVEC_INIT(write_header_size);
1d442b
 	struct fuse_in_header *in;
1d442b
 	const void *inarg;
1d442b
 	struct fuse_req *req;
1d442b
-	void *mbuf = NULL;
1d442b
 	int err;
1d442b
-	int res;
1d442b
-
1d442b
-	if (buf->flags & FUSE_BUF_IS_FD) {
1d442b
-		if (buf->size < tmpbuf.buf[0].size)
1d442b
-			tmpbuf.buf[0].size = buf->size;
1d442b
 
1d442b
-		mbuf = malloc(tmpbuf.buf[0].size);
1d442b
-		if (mbuf == NULL) {
1d442b
-			fuse_log(FUSE_LOG_ERR, "fuse: failed to allocate header\n");
1d442b
-			goto clear_pipe;
1d442b
-		}
1d442b
-		tmpbuf.buf[0].mem = mbuf;
1d442b
-
1d442b
-		res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);
1d442b
-		if (res < 0)
1d442b
-			goto clear_pipe;
1d442b
-
1d442b
-		in = mbuf;
1d442b
-	} else {
1d442b
-		in = buf->mem;
1d442b
-	}
1d442b
+	in = buf->mem;
1d442b
 
1d442b
 	if (se->debug) {
1d442b
 		fuse_log(FUSE_LOG_DEBUG,
1d442b
@@ -2584,14 +2161,14 @@ void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
 		};
1d442b
 
1d442b
 		fuse_send_msg(se, ch, &iov, 1);
1d442b
-		goto clear_pipe;
1d442b
+		return;
1d442b
 	}
1d442b
 
1d442b
 	req->unique = in->unique;
1d442b
 	req->ctx.uid = in->uid;
1d442b
 	req->ctx.gid = in->gid;
1d442b
 	req->ctx.pid = in->pid;
1d442b
-	req->ch = ch ? fuse_chan_get(ch) : NULL;
1d442b
+	req->ch = ch;
1d442b
 
1d442b
 	err = EIO;
1d442b
 	if (!se->got_init) {
1d442b
@@ -2627,28 +2204,6 @@ void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
 			fuse_reply_err(intr, EAGAIN);
1d442b
 	}
1d442b
 
1d442b
-	if ((buf->flags & FUSE_BUF_IS_FD) && write_header_size < buf->size &&
1d442b
-	    (in->opcode != FUSE_WRITE || !se->op.write_buf) &&
1d442b
-	    in->opcode != FUSE_NOTIFY_REPLY) {
1d442b
-		void *newmbuf;
1d442b
-
1d442b
-		err = ENOMEM;
1d442b
-		newmbuf = realloc(mbuf, buf->size);
1d442b
-		if (newmbuf == NULL)
1d442b
-			goto reply_err;
1d442b
-		mbuf = newmbuf;
1d442b
-
1d442b
-		tmpbuf = FUSE_BUFVEC_INIT(buf->size - write_header_size);
1d442b
-		tmpbuf.buf[0].mem = (char *)mbuf + write_header_size;
1d442b
-
1d442b
-		res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv);
1d442b
-		err = -res;
1d442b
-		if (res < 0)
1d442b
-			goto reply_err;
1d442b
-
1d442b
-		in = mbuf;
1d442b
-	}
1d442b
-
1d442b
 	inarg = (void *) &in[1];
1d442b
 	if (in->opcode == FUSE_WRITE && se->op.write_buf)
1d442b
 		do_write_buf(req, in->nodeid, inarg, buf);
1d442b
@@ -2657,16 +2212,10 @@ void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
 	else
1d442b
 		fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg);
1d442b
 
1d442b
-out_free:
1d442b
-	free(mbuf);
1d442b
 	return;
1d442b
 
1d442b
 reply_err:
1d442b
 	fuse_reply_err(req, err);
1d442b
-clear_pipe:
1d442b
-	if (buf->flags & FUSE_BUF_IS_FD)
1d442b
-		fuse_ll_clear_pipe(se);
1d442b
-	goto out_free;
1d442b
 }
1d442b
 
1d442b
 #define LL_OPTION(n,o,v) \
1d442b
@@ -2684,7 +2233,6 @@ void fuse_lowlevel_version(void)
1d442b
 {
1d442b
 	printf("using FUSE kernel interface version %i.%i\n",
1d442b
 	       FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);
1d442b
-	fuse_mount_version();
1d442b
 }
1d442b
 
1d442b
 void fuse_lowlevel_help(void)
1d442b
@@ -2692,204 +2240,29 @@ void fuse_lowlevel_help(void)
1d442b
 	/* These are not all options, but the ones that are
1d442b
 	   potentially of interest to an end-user */
1d442b
 	printf(
1d442b
-"    -o allow_other         allow access by all users\n"
1d442b
 "    -o allow_root          allow access by root\n"
1d442b
-"    -o auto_unmount        auto unmount on process termination\n");
1d442b
+);
1d442b
 }
1d442b
 
1d442b
 void fuse_session_destroy(struct fuse_session *se)
1d442b
 {
1d442b
-	struct fuse_ll_pipe *llp;
1d442b
-
1d442b
 	if (se->got_init && !se->got_destroy) {
1d442b
 		if (se->op.destroy)
1d442b
 			se->op.destroy(se->userdata);
1d442b
 	}
1d442b
-	llp = pthread_getspecific(se->pipe_key);
1d442b
-	if (llp != NULL)
1d442b
-		fuse_ll_pipe_free(llp);
1d442b
-	pthread_key_delete(se->pipe_key);
1d442b
 	pthread_mutex_destroy(&se->lock);
1d442b
 	free(se->cuse_data);
1d442b
 	if (se->fd != -1)
1d442b
 		close(se->fd);
1d442b
-	destroy_mount_opts(se->mo);
1d442b
 	free(se);
1d442b
 }
1d442b
 
1d442b
 
1d442b
-static void fuse_ll_pipe_destructor(void *data)
1d442b
-{
1d442b
-	struct fuse_ll_pipe *llp = data;
1d442b
-	fuse_ll_pipe_free(llp);
1d442b
-}
1d442b
-
1d442b
-int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf)
1d442b
-{
1d442b
-	return fuse_session_receive_buf_int(se, buf, NULL);
1d442b
-}
1d442b
-
1d442b
-int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
1d442b
-				 struct fuse_chan *ch)
1d442b
-{
1d442b
-	int err;
1d442b
-	ssize_t res;
1d442b
-#ifdef HAVE_SPLICE
1d442b
-	size_t bufsize = se->bufsize;
1d442b
-	struct fuse_ll_pipe *llp;
1d442b
-	struct fuse_buf tmpbuf;
1d442b
-
1d442b
-	if (se->conn.proto_minor < 14 || !(se->conn.want & FUSE_CAP_SPLICE_READ))
1d442b
-		goto fallback;
1d442b
-
1d442b
-	llp = fuse_ll_get_pipe(se);
1d442b
-	if (llp == NULL)
1d442b
-		goto fallback;
1d442b
-
1d442b
-	if (llp->size < bufsize) {
1d442b
-		if (llp->can_grow) {
1d442b
-			res = fcntl(llp->pipe[0], F_SETPIPE_SZ, bufsize);
1d442b
-			if (res == -1) {
1d442b
-				llp->can_grow = 0;
1d442b
-				res = grow_pipe_to_max(llp->pipe[0]);
1d442b
-				if (res > 0)
1d442b
-					llp->size = res;
1d442b
-				goto fallback;
1d442b
-			}
1d442b
-			llp->size = res;
1d442b
-		}
1d442b
-		if (llp->size < bufsize)
1d442b
-			goto fallback;
1d442b
-	}
1d442b
-
1d442b
-	res = splice(ch ? ch->fd : se->fd,
1d442b
-		     NULL, llp->pipe[1], NULL, bufsize, 0);
1d442b
-	err = errno;
1d442b
-
1d442b
-	if (fuse_session_exited(se))
1d442b
-		return 0;
1d442b
-
1d442b
-	if (res == -1) {
1d442b
-		if (err == ENODEV) {
1d442b
-			/* Filesystem was unmounted, or connection was aborted
1d442b
-			   via /sys/fs/fuse/connections */
1d442b
-			fuse_session_exit(se);
1d442b
-			return 0;
1d442b
-		}
1d442b
-		if (err != EINTR && err != EAGAIN)
1d442b
-			perror("fuse: splice from device");
1d442b
-		return -err;
1d442b
-	}
1d442b
-
1d442b
-	if (res < sizeof(struct fuse_in_header)) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "short splice from fuse device\n");
1d442b
-		return -EIO;
1d442b
-	}
1d442b
-
1d442b
-	tmpbuf = (struct fuse_buf) {
1d442b
-		.size = res,
1d442b
-		.flags = FUSE_BUF_IS_FD,
1d442b
-		.fd = llp->pipe[0],
1d442b
-	};
1d442b
-
1d442b
-	/*
1d442b
-	 * Don't bother with zero copy for small requests.
1d442b
-	 * fuse_loop_mt() needs to check for FORGET so this more than
1d442b
-	 * just an optimization.
1d442b
-	 */
1d442b
-	if (res < sizeof(struct fuse_in_header) +
1d442b
-	    sizeof(struct fuse_write_in) + pagesize) {
1d442b
-		struct fuse_bufvec src = { .buf[0] = tmpbuf, .count = 1 };
1d442b
-		struct fuse_bufvec dst = { .count = 1 };
1d442b
-
1d442b
-		if (!buf->mem) {
1d442b
-			buf->mem = malloc(se->bufsize);
1d442b
-			if (!buf->mem) {
1d442b
-				fuse_log(FUSE_LOG_ERR,
1d442b
-					"fuse: failed to allocate read buffer\n");
1d442b
-				return -ENOMEM;
1d442b
-			}
1d442b
-		}
1d442b
-		buf->size = se->bufsize;
1d442b
-		buf->flags = 0;
1d442b
-		dst.buf[0] = *buf;
1d442b
-
1d442b
-		res = fuse_buf_copy(&dst, &src, 0);
1d442b
-		if (res < 0) {
1d442b
-			fuse_log(FUSE_LOG_ERR, "fuse: copy from pipe: %s\n",
1d442b
-				strerror(-res));
1d442b
-			fuse_ll_clear_pipe(se);
1d442b
-			return res;
1d442b
-		}
1d442b
-		if (res < tmpbuf.size) {
1d442b
-			fuse_log(FUSE_LOG_ERR, "fuse: copy from pipe: short read\n");
1d442b
-			fuse_ll_clear_pipe(se);
1d442b
-			return -EIO;
1d442b
-		}
1d442b
-		assert(res == tmpbuf.size);
1d442b
-
1d442b
-	} else {
1d442b
-		/* Don't overwrite buf->mem, as that would cause a leak */
1d442b
-		buf->fd = tmpbuf.fd;
1d442b
-		buf->flags = tmpbuf.flags;
1d442b
-	}
1d442b
-	buf->size = tmpbuf.size;
1d442b
-
1d442b
-	return res;
1d442b
-
1d442b
-fallback:
1d442b
-#endif
1d442b
-	if (!buf->mem) {
1d442b
-		buf->mem = malloc(se->bufsize);
1d442b
-		if (!buf->mem) {
1d442b
-			fuse_log(FUSE_LOG_ERR,
1d442b
-				"fuse: failed to allocate read buffer\n");
1d442b
-			return -ENOMEM;
1d442b
-		}
1d442b
-	}
1d442b
-
1d442b
-restart:
1d442b
-	res = read(ch ? ch->fd : se->fd, buf->mem, se->bufsize);
1d442b
-	err = errno;
1d442b
-
1d442b
-	if (fuse_session_exited(se))
1d442b
-		return 0;
1d442b
-	if (res == -1) {
1d442b
-		/* ENOENT means the operation was interrupted, it's safe
1d442b
-		   to restart */
1d442b
-		if (err == ENOENT)
1d442b
-			goto restart;
1d442b
-
1d442b
-		if (err == ENODEV) {
1d442b
-			/* Filesystem was unmounted, or connection was aborted
1d442b
-			   via /sys/fs/fuse/connections */
1d442b
-			fuse_session_exit(se);
1d442b
-			return 0;
1d442b
-		}
1d442b
-		/* Errors occurring during normal operation: EINTR (read
1d442b
-		   interrupted), EAGAIN (nonblocking I/O), ENODEV (filesystem
1d442b
-		   umounted) */
1d442b
-		if (err != EINTR && err != EAGAIN)
1d442b
-			perror("fuse: reading device");
1d442b
-		return -err;
1d442b
-	}
1d442b
-	if ((size_t) res < sizeof(struct fuse_in_header)) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "short read on fuse device\n");
1d442b
-		return -EIO;
1d442b
-	}
1d442b
-
1d442b
-	buf->size = res;
1d442b
-
1d442b
-	return res;
1d442b
-}
1d442b
-
1d442b
 struct fuse_session *fuse_session_new(struct fuse_args *args,
1d442b
 				      const struct fuse_lowlevel_ops *op,
1d442b
 				      size_t op_size, void *userdata)
1d442b
 {
1d442b
-	int err;
1d442b
 	struct fuse_session *se;
1d442b
-	struct mount_opts *mo;
1d442b
 
1d442b
 	if (sizeof(struct fuse_lowlevel_ops) < op_size) {
1d442b
 		fuse_log(FUSE_LOG_ERR, "fuse: warning: library too old, some operations may not work\n");
1d442b
@@ -2913,20 +2286,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
1d442b
 	/* Parse options */
1d442b
 	if(fuse_opt_parse(args, se, fuse_ll_opts, NULL) == -1)
1d442b
 		goto out2;
1d442b
-	if(se->deny_others) {
1d442b
-		/* Allowing access only by root is done by instructing
1d442b
-		 * kernel to allow access by everyone, and then restricting
1d442b
-		 * access to root and mountpoint owner in libfuse.
1d442b
-		 */
1d442b
-		// We may be adding the option a second time, but
1d442b
-		// that doesn't hurt.
1d442b
-		if(fuse_opt_add_arg(args, "-oallow_other") == -1)
1d442b
-			goto out2;
1d442b
-	}
1d442b
-	mo = parse_mount_opts(args);
1d442b
-	if (mo == NULL)
1d442b
-		goto out3;
1d442b
-
1d442b
 	if(args->argc == 1 &&
1d442b
 	   args->argv[0][0] == '-') {
1d442b
 		fuse_log(FUSE_LOG_ERR, "fuse: warning: argv[0] looks like an option, but "
1d442b
@@ -2940,9 +2299,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
1d442b
 		goto out4;
1d442b
 	}
1d442b
 
1d442b
-	if (se->debug)
1d442b
-		fuse_log(FUSE_LOG_DEBUG, "FUSE library version: %s\n", PACKAGE_VERSION);
1d442b
-
1d442b
 	se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() +
1d442b
 		FUSE_BUFFER_HEADER_SIZE;
1d442b
 
1d442b
@@ -2952,26 +2308,14 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
1d442b
 	se->notify_ctr = 1;
1d442b
 	fuse_mutex_init(&se->lock);
1d442b
 
1d442b
-	err = pthread_key_create(&se->pipe_key, fuse_ll_pipe_destructor);
1d442b
-	if (err) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: failed to create thread specific key: %s\n",
1d442b
-			strerror(err));
1d442b
-		goto out5;
1d442b
-	}
1d442b
-
1d442b
 	memcpy(&se->op, op, op_size);
1d442b
 	se->owner = getuid();
1d442b
 	se->userdata = userdata;
1d442b
 
1d442b
-	se->mo = mo;
1d442b
 	return se;
1d442b
 
1d442b
-out5:
1d442b
-	pthread_mutex_destroy(&se->lock);
1d442b
 out4:
1d442b
 	fuse_opt_free_args(args);
1d442b
-out3:
1d442b
-	free(mo);
1d442b
 out2:
1d442b
 	free(se);
1d442b
 out1:
1d442b
@@ -3035,11 +2379,6 @@ int fuse_session_fd(struct fuse_session *se)
1d442b
 
1d442b
 void fuse_session_unmount(struct fuse_session *se)
1d442b
 {
1d442b
-	if (se->mountpoint != NULL) {
1d442b
-		fuse_kern_unmount(se->mountpoint, se->fd);
1d442b
-		free(se->mountpoint);
1d442b
-		se->mountpoint = NULL;
1d442b
-	}
1d442b
 }
1d442b
 
1d442b
 #ifdef linux
1d442b
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
1d442b
index 18c6363f07..6b1adfcfd1 100644
1d442b
--- a/tools/virtiofsd/fuse_lowlevel.h
1d442b
+++ b/tools/virtiofsd/fuse_lowlevel.h
1d442b
@@ -31,10 +31,6 @@
1d442b
 #include <sys/statvfs.h>
1d442b
 #include <sys/uio.h>
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-extern "C" {
1d442b
-#endif
1d442b
-
1d442b
 /* ----------------------------------------------------------- *
1d442b
  * Miscellaneous definitions				       *
1d442b
  * ----------------------------------------------------------- */
1d442b
@@ -1863,14 +1859,12 @@ void fuse_cmdline_help(void);
1d442b
  * ----------------------------------------------------------- */
1d442b
 
1d442b
 struct fuse_cmdline_opts {
1d442b
-	int singlethread;
1d442b
 	int foreground;
1d442b
 	int debug;
1d442b
 	int nodefault_subtype;
1d442b
 	char *mountpoint;
1d442b
 	int show_version;
1d442b
 	int show_help;
1d442b
-	int clone_fd;
1d442b
 	unsigned int max_idle_threads;
1d442b
 };
1d442b
 
1d442b
@@ -1961,24 +1955,6 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
1d442b
  */
1d442b
 int fuse_session_loop(struct fuse_session *se);
1d442b
 
1d442b
-/**
1d442b
- * Enter a multi-threaded event loop.
1d442b
- *
1d442b
- * For a description of the return value and the conditions when the
1d442b
- * event loop exits, refer to the documentation of
1d442b
- * fuse_session_loop().
1d442b
- *
1d442b
- * @param se the session
1d442b
- * @param config session loop configuration 
1d442b
- * @return see fuse_session_loop()
1d442b
- */
1d442b
-#if FUSE_USE_VERSION < 32
1d442b
-int fuse_session_loop_mt_31(struct fuse_session *se, int clone_fd);
1d442b
-#define fuse_session_loop_mt(se, clone_fd) fuse_session_loop_mt_31(se, clone_fd)
1d442b
-#else
1d442b
-int fuse_session_loop_mt(struct fuse_session *se, struct fuse_loop_config *config);
1d442b
-#endif
1d442b
-
1d442b
 /**
1d442b
  * Flag a session as terminated.
1d442b
  *
1d442b
@@ -2082,8 +2058,4 @@ void fuse_session_process_buf(struct fuse_session *se,
1d442b
  */
1d442b
 int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf);
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
 #endif /* FUSE_LOWLEVEL_H_ */
1d442b
diff --git a/tools/virtiofsd/fuse_opt.h b/tools/virtiofsd/fuse_opt.h
1d442b
index d8573e74fd..69102555be 100644
1d442b
--- a/tools/virtiofsd/fuse_opt.h
1d442b
+++ b/tools/virtiofsd/fuse_opt.h
1d442b
@@ -14,10 +14,6 @@
1d442b
  * This file defines the option parsing interface of FUSE
1d442b
  */
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-extern "C" {
1d442b
-#endif
1d442b
-
1d442b
 /**
1d442b
  * Option description
1d442b
  *
1d442b
@@ -264,8 +260,4 @@ void fuse_opt_free_args(struct fuse_args *args);
1d442b
  */
1d442b
 int fuse_opt_match(const struct fuse_opt opts[], const char *opt);
1d442b
 
1d442b
-#ifdef __cplusplus
1d442b
-}
1d442b
-#endif
1d442b
-
1d442b
 #endif /* FUSE_OPT_H_ */
1d442b
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
1d442b
index 64ff7ad6d5..5a2e64c6d0 100644
1d442b
--- a/tools/virtiofsd/helper.c
1d442b
+++ b/tools/virtiofsd/helper.c
1d442b
@@ -41,14 +41,10 @@ static const struct fuse_opt fuse_helper_opts[] = {
1d442b
 	FUSE_OPT_KEY("-d",		FUSE_OPT_KEY_KEEP),
1d442b
 	FUSE_OPT_KEY("debug",		FUSE_OPT_KEY_KEEP),
1d442b
 	FUSE_HELPER_OPT("-f",		foreground),
1d442b
-	FUSE_HELPER_OPT("-s",		singlethread),
1d442b
 	FUSE_HELPER_OPT("fsname=",	nodefault_subtype),
1d442b
 	FUSE_OPT_KEY("fsname=",		FUSE_OPT_KEY_KEEP),
1d442b
-#ifndef __FreeBSD__
1d442b
 	FUSE_HELPER_OPT("subtype=",	nodefault_subtype),
1d442b
 	FUSE_OPT_KEY("subtype=",	FUSE_OPT_KEY_KEEP),
1d442b
-#endif
1d442b
-	FUSE_HELPER_OPT("clone_fd",	clone_fd),
1d442b
 	FUSE_HELPER_OPT("max_idle_threads=%u", max_idle_threads),
1d442b
 	FUSE_OPT_END
1d442b
 };
1d442b
@@ -132,9 +128,6 @@ void fuse_cmdline_help(void)
1d442b
 	       "    -V   --version         print version\n"
1d442b
 	       "    -d   -o debug          enable debug output (implies -f)\n"
1d442b
 	       "    -f                     foreground operation\n"
1d442b
-	       "    -s                     disable multi-threaded operation\n"
1d442b
-	       "    -o clone_fd            use separate fuse device fd for each thread\n"
1d442b
-	       "                           (may improve performance)\n"
1d442b
 	       "    -o max_idle_threads    the maximum number of idle worker threads\n"
1d442b
 	       "                           allowed (default: 10)\n");
1d442b
 }
1d442b
@@ -171,34 +164,6 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key,
1d442b
 	}
1d442b
 }
1d442b
 
1d442b
-/* Under FreeBSD, there is no subtype option so this
1d442b
-   function actually sets the fsname */
1d442b
-static int add_default_subtype(const char *progname, struct fuse_args *args)
1d442b
-{
1d442b
-	int res;
1d442b
-	char *subtype_opt;
1d442b
-
1d442b
-	const char *basename = strrchr(progname, '/');
1d442b
-	if (basename == NULL)
1d442b
-		basename = progname;
1d442b
-	else if (basename[1] != '\0')
1d442b
-		basename++;
1d442b
-
1d442b
-	subtype_opt = (char *) malloc(strlen(basename) + 64);
1d442b
-	if (subtype_opt == NULL) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "fuse: memory allocation failed\n");
1d442b
-		return -1;
1d442b
-	}
1d442b
-#ifdef __FreeBSD__
1d442b
-	sprintf(subtype_opt, "-ofsname=%s", basename);
1d442b
-#else
1d442b
-	sprintf(subtype_opt, "-osubtype=%s", basename);
1d442b
-#endif
1d442b
-	res = fuse_opt_add_arg(args, subtype_opt);
1d442b
-	free(subtype_opt);
1d442b
-	return res;
1d442b
-}
1d442b
-
1d442b
 int fuse_parse_cmdline(struct fuse_args *args,
1d442b
 		       struct fuse_cmdline_opts *opts)
1d442b
 {
1d442b
@@ -210,14 +175,6 @@ int fuse_parse_cmdline(struct fuse_args *args,
1d442b
 			   fuse_helper_opt_proc) == -1)
1d442b
 		return -1;
1d442b
 
1d442b
-	/* *Linux*: if neither -o subtype nor -o fsname are specified,
1d442b
-	   set subtype to program's basename.
1d442b
-	   *FreeBSD*: if fsname is not specified, set to program's
1d442b
-	   basename. */
1d442b
-	if (!opts->nodefault_subtype)
1d442b
-		if (add_default_subtype(args->argv[0], args) == -1)
1d442b
-			return -1;
1d442b
-
1d442b
 	return 0;
1d442b
 }
1d442b
 
1d442b
@@ -276,88 +233,6 @@ int fuse_daemonize(int foreground)
1d442b
 	return 0;
1d442b
 }
1d442b
 
1d442b
-int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
1d442b
-		   size_t op_size, void *user_data)
1d442b
-{
1d442b
-	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
1d442b
-	struct fuse *fuse;
1d442b
-	struct fuse_cmdline_opts opts;
1d442b
-	int res;
1d442b
-
1d442b
-	if (fuse_parse_cmdline(&args, &opts) != 0)
1d442b
-		return 1;
1d442b
-
1d442b
-	if (opts.show_version) {
1d442b
-		printf("FUSE library version %s\n", PACKAGE_VERSION);
1d442b
-		fuse_lowlevel_version();
1d442b
-		res = 0;
1d442b
-		goto out1;
1d442b
-	}
1d442b
-
1d442b
-	if (opts.show_help) {
1d442b
-		if(args.argv[0][0] != '\0')
1d442b
-			printf("usage: %s [options] <mountpoint>\n\n",
1d442b
-			       args.argv[0]);
1d442b
-		printf("FUSE options:\n");
1d442b
-		fuse_cmdline_help();
1d442b
-		fuse_lib_help(&args);
1d442b
-		res = 0;
1d442b
-		goto out1;
1d442b
-	}
1d442b
-
1d442b
-	if (!opts.show_help &&
1d442b
-	    !opts.mountpoint) {
1d442b
-		fuse_log(FUSE_LOG_ERR, "error: no mountpoint specified\n");
1d442b
-		res = 2;
1d442b
-		goto out1;
1d442b
-	}
1d442b
-
1d442b
-
1d442b
-	fuse = fuse_new_31(&args, op, op_size, user_data);
1d442b
-	if (fuse == NULL) {
1d442b
-		res = 3;
1d442b
-		goto out1;
1d442b
-	}
1d442b
-
1d442b
-	if (fuse_mount(fuse,opts.mountpoint) != 0) {
1d442b
-		res = 4;
1d442b
-		goto out2;
1d442b
-	}
1d442b
-
1d442b
-	if (fuse_daemonize(opts.foreground) != 0) {
1d442b
-		res = 5;
1d442b
-		goto out3;
1d442b
-	}
1d442b
-
1d442b
-	struct fuse_session *se = fuse_get_session(fuse);
1d442b
-	if (fuse_set_signal_handlers(se) != 0) {
1d442b
-		res = 6;
1d442b
-		goto out3;
1d442b
-	}
1d442b
-
1d442b
-	if (opts.singlethread)
1d442b
-		res = fuse_loop(fuse);
1d442b
-	else {
1d442b
-		struct fuse_loop_config loop_config;
1d442b
-		loop_config.clone_fd = opts.clone_fd;
1d442b
-		loop_config.max_idle_threads = opts.max_idle_threads;
1d442b
-		res = fuse_loop_mt_32(fuse, &loop_config);
1d442b
-	}
1d442b
-	if (res)
1d442b
-		res = 7;
1d442b
-
1d442b
-	fuse_remove_signal_handlers(se);
1d442b
-out3:
1d442b
-	fuse_unmount(fuse);
1d442b
-out2:
1d442b
-	fuse_destroy(fuse);
1d442b
-out1:
1d442b
-	free(opts.mountpoint);
1d442b
-	fuse_opt_free_args(&args);
1d442b
-	return res;
1d442b
-}
1d442b
-
1d442b
-
1d442b
 void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
1d442b
 			       struct fuse_conn_info *conn)
1d442b
 {
1d442b
@@ -420,21 +295,3 @@ struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args)
1d442b
 	}
1d442b
 	return opts;
1d442b
 }
1d442b
-
1d442b
-int fuse_open_channel(const char *mountpoint, const char* options)
1d442b
-{
1d442b
-	struct mount_opts *opts = NULL;
1d442b
-	int fd = -1;
1d442b
-	const char *argv[] = { "", "-o", options };
1d442b
-	int argc = sizeof(argv) / sizeof(argv[0]);
1d442b
-	struct fuse_args args = FUSE_ARGS_INIT(argc, (char**) argv);
1d442b
-
1d442b
-	opts = parse_mount_opts(&args);
1d442b
-	if (opts == NULL)
1d442b
-		return -1;
1d442b
-
1d442b
-	fd = fuse_kern_mount(mountpoint, opts);
1d442b
-	destroy_mount_opts(opts);
1d442b
-
1d442b
-	return fd;
1d442b
-}
1d442b
diff --git a/tools/virtiofsd/passthrough_helpers.h b/tools/virtiofsd/passthrough_helpers.h
1d442b
index 6b77c33600..7c5f561fbc 100644
1d442b
--- a/tools/virtiofsd/passthrough_helpers.h
1d442b
+++ b/tools/virtiofsd/passthrough_helpers.h
1d442b
@@ -42,32 +42,6 @@ static int mknod_wrapper(int dirfd, const char *path, const char *link,
1d442b
 		res = symlinkat(link, dirfd, path);
1d442b
 	} else if (S_ISFIFO(mode)) {
1d442b
 		res = mkfifoat(dirfd, path, mode);
1d442b
-#ifdef __FreeBSD__
1d442b
-	} else if (S_ISSOCK(mode)) {
1d442b
-		struct sockaddr_un su;
1d442b
-		int fd;
1d442b
-
1d442b
-		if (strlen(path) >= sizeof(su.sun_path)) {
1d442b
-			errno = ENAMETOOLONG;
1d442b
-			return -1;
1d442b
-		}
1d442b
-		fd = socket(AF_UNIX, SOCK_STREAM, 0);
1d442b
-		if (fd >= 0) {
1d442b
-			/*
1d442b
-			 * We must bind the socket to the underlying file
1d442b
-			 * system to create the socket file, even though
1d442b
-			 * we'll never listen on this socket.
1d442b
-			 */
1d442b
-			su.sun_family = AF_UNIX;
1d442b
-			strncpy(su.sun_path, path, sizeof(su.sun_path));
1d442b
-			res = bindat(dirfd, fd, (struct sockaddr*)&su,
1d442b
-				sizeof(su));
1d442b
-			if (res == 0)
1d442b
-				close(fd);
1d442b
-		} else {
1d442b
-			res = -1;
1d442b
-		}
1d442b
-#endif
1d442b
 	} else {
1d442b
 		res = mknodat(dirfd, path, mode, rdev);
1d442b
 	}
1d442b
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
1d442b
index e1a605691a..e5f7115bc1 100644
1d442b
--- a/tools/virtiofsd/passthrough_ll.c
1d442b
+++ b/tools/virtiofsd/passthrough_ll.c
1d442b
@@ -1240,7 +1240,6 @@ int main(int argc, char *argv[])
1d442b
 		ret = 0;
1d442b
 		goto err_out1;
1d442b
 	} else if (opts.show_version) {
1d442b
-		printf("FUSE library version %s\n", fuse_pkgversion());
1d442b
 		fuse_lowlevel_version();
1d442b
 		ret = 0;
1d442b
 		goto err_out1;