22c213
From 9c1bbe327cf8f88ffc78eed0fce8cdd6f3f006ef Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:00:54 +0100
22c213
Subject: [PATCH 023/116] virtiofsd: Add options for virtio
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Message-id: <20200127190227.40942-20-dgilbert@redhat.com>
22c213
Patchwork-id: 93473
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 019/112] virtiofsd: Add options for virtio
22c213
Bugzilla: 1694164
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
22c213
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
22c213
Add options to specify parameters for virtio-fs paths, i.e.
22c213
22c213
   ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu
22c213
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit 205de006aab8dcbe546a7e3a51d295c2d05e654b)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/fuse_i.h        |  1 +
22c213
 tools/virtiofsd/fuse_lowlevel.c | 11 ++++++++---
22c213
 tools/virtiofsd/helper.c        | 14 +++++++-------
22c213
 3 files changed, 16 insertions(+), 10 deletions(-)
22c213
22c213
diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
22c213
index bae0699..26b1a7d 100644
22c213
--- a/tools/virtiofsd/fuse_i.h
22c213
+++ b/tools/virtiofsd/fuse_i.h
22c213
@@ -63,6 +63,7 @@ struct fuse_session {
22c213
     struct fuse_notify_req notify_list;
22c213
     size_t bufsize;
22c213
     int error;
22c213
+    char *vu_socket_path;
22c213
 };
22c213
 
22c213
 struct fuse_chan {
22c213
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
22c213
index 8552cfb..17e8718 100644
22c213
--- a/tools/virtiofsd/fuse_lowlevel.c
22c213
+++ b/tools/virtiofsd/fuse_lowlevel.c
22c213
@@ -2115,8 +2115,11 @@ reply_err:
22c213
     }
22c213
 
22c213
 static const struct fuse_opt fuse_ll_opts[] = {
22c213
-    LL_OPTION("debug", debug, 1), LL_OPTION("-d", debug, 1),
22c213
-    LL_OPTION("--debug", debug, 1), LL_OPTION("allow_root", deny_others, 1),
22c213
+    LL_OPTION("debug", debug, 1),
22c213
+    LL_OPTION("-d", debug, 1),
22c213
+    LL_OPTION("--debug", debug, 1),
22c213
+    LL_OPTION("allow_root", deny_others, 1),
22c213
+    LL_OPTION("--socket-path=%s", vu_socket_path, 0),
22c213
     FUSE_OPT_END
22c213
 };
22c213
 
22c213
@@ -2132,7 +2135,9 @@ void fuse_lowlevel_help(void)
22c213
      * These are not all options, but the ones that are
22c213
      * potentially of interest to an end-user
22c213
      */
22c213
-    printf("    -o allow_root          allow access by root\n");
22c213
+    printf(
22c213
+        "    -o allow_root              allow access by root\n"
22c213
+        "    --socket-path=PATH         path for the vhost-user socket\n");
22c213
 }
22c213
 
22c213
 void fuse_session_destroy(struct fuse_session *se)
22c213
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
22c213
index 9333691..676032e 100644
22c213
--- a/tools/virtiofsd/helper.c
22c213
+++ b/tools/virtiofsd/helper.c
22c213
@@ -127,13 +127,13 @@ static const struct fuse_opt conn_info_opt_spec[] = {
22c213
 
22c213
 void fuse_cmdline_help(void)
22c213
 {
22c213
-    printf(
22c213
-        "    -h   --help            print help\n"
22c213
-        "    -V   --version         print version\n"
22c213
-        "    -d   -o debug          enable debug output (implies -f)\n"
22c213
-        "    -f                     foreground operation\n"
22c213
-        "    -o max_idle_threads    the maximum number of idle worker threads\n"
22c213
-        "                           allowed (default: 10)\n");
22c213
+    printf("    -h   --help                print help\n"
22c213
+           "    -V   --version             print version\n"
22c213
+           "    -d   -o debug              enable debug output (implies -f)\n"
22c213
+           "    -f                         foreground operation\n"
22c213
+           "    -o max_idle_threads        the maximum number of idle worker "
22c213
+           "threads\n"
22c213
+           "                               allowed (default: 10)\n");
22c213
 }
22c213
 
22c213
 static int fuse_helper_opt_proc(void *data, const char *arg, int key,
22c213
-- 
22c213
1.8.3.1
22c213