peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0025-virtiofsd-Add-options-for-virtio.patch

1d442b
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:00:54 +0000
1d442b
Subject: [PATCH] virtiofsd: Add options for virtio
1d442b
1d442b
Add options to specify parameters for virtio-fs paths, i.e.
1d442b
1d442b
   ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu
1d442b
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit 205de006aab8dcbe546a7e3a51d295c2d05e654b)
1d442b
---
1d442b
 tools/virtiofsd/fuse_i.h        |  1 +
1d442b
 tools/virtiofsd/fuse_lowlevel.c | 11 ++++++++---
1d442b
 tools/virtiofsd/helper.c        | 14 +++++++-------
1d442b
 3 files changed, 16 insertions(+), 10 deletions(-)
1d442b
1d442b
diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
1d442b
index bae06992e0..26b1a7da88 100644
1d442b
--- a/tools/virtiofsd/fuse_i.h
1d442b
+++ b/tools/virtiofsd/fuse_i.h
1d442b
@@ -63,6 +63,7 @@ struct fuse_session {
1d442b
     struct fuse_notify_req notify_list;
1d442b
     size_t bufsize;
1d442b
     int error;
1d442b
+    char *vu_socket_path;
1d442b
 };
1d442b
 
1d442b
 struct fuse_chan {
1d442b
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
1d442b
index 8552cfb8af..17e8718283 100644
1d442b
--- a/tools/virtiofsd/fuse_lowlevel.c
1d442b
+++ b/tools/virtiofsd/fuse_lowlevel.c
1d442b
@@ -2115,8 +2115,11 @@ reply_err:
1d442b
     }
1d442b
 
1d442b
 static const struct fuse_opt fuse_ll_opts[] = {
1d442b
-    LL_OPTION("debug", debug, 1), LL_OPTION("-d", debug, 1),
1d442b
-    LL_OPTION("--debug", debug, 1), LL_OPTION("allow_root", deny_others, 1),
1d442b
+    LL_OPTION("debug", debug, 1),
1d442b
+    LL_OPTION("-d", debug, 1),
1d442b
+    LL_OPTION("--debug", debug, 1),
1d442b
+    LL_OPTION("allow_root", deny_others, 1),
1d442b
+    LL_OPTION("--socket-path=%s", vu_socket_path, 0),
1d442b
     FUSE_OPT_END
1d442b
 };
1d442b
 
1d442b
@@ -2132,7 +2135,9 @@ 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
      */
1d442b
-    printf("    -o allow_root          allow access by root\n");
1d442b
+    printf(
1d442b
+        "    -o allow_root              allow access by root\n"
1d442b
+        "    --socket-path=PATH         path for the vhost-user socket\n");
1d442b
 }
1d442b
 
1d442b
 void fuse_session_destroy(struct fuse_session *se)
1d442b
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
1d442b
index 9333691525..676032e71f 100644
1d442b
--- a/tools/virtiofsd/helper.c
1d442b
+++ b/tools/virtiofsd/helper.c
1d442b
@@ -127,13 +127,13 @@ static const struct fuse_opt conn_info_opt_spec[] = {
1d442b
 
1d442b
 void fuse_cmdline_help(void)
1d442b
 {
1d442b
-    printf(
1d442b
-        "    -h   --help            print help\n"
1d442b
-        "    -V   --version         print version\n"
1d442b
-        "    -d   -o debug          enable debug output (implies -f)\n"
1d442b
-        "    -f                     foreground operation\n"
1d442b
-        "    -o max_idle_threads    the maximum number of idle worker threads\n"
1d442b
-        "                           allowed (default: 10)\n");
1d442b
+    printf("    -h   --help                print help\n"
1d442b
+           "    -V   --version             print version\n"
1d442b
+           "    -d   -o debug              enable debug output (implies -f)\n"
1d442b
+           "    -f                         foreground operation\n"
1d442b
+           "    -o max_idle_threads        the maximum number of idle worker "
1d442b
+           "threads\n"
1d442b
+           "                               allowed (default: 10)\n");
1d442b
 }
1d442b
 
1d442b
 static int fuse_helper_opt_proc(void *data, const char *arg, int key,