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