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