dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0039-virtiofsd-make-f-foreground-the-default.patch

1d442b
From: Stefan Hajnoczi <stefanha@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:01:08 +0000
1d442b
Subject: [PATCH] virtiofsd: make -f (foreground) the default
1d442b
MIME-Version: 1.0
1d442b
Content-Type: text/plain; charset=UTF-8
1d442b
Content-Transfer-Encoding: 8bit
1d442b
1d442b
According to vhost-user.rst "Backend program conventions", backend
1d442b
programs should run in the foregound by default.  Follow the
1d442b
conventions so libvirt and other management tools can control virtiofsd
1d442b
in a standard way.
1d442b
1d442b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1d442b
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit 0bbd31753714ac2899efda0f0de31e353e965789)
1d442b
---
1d442b
 tools/virtiofsd/helper.c | 8 ++++++++
1d442b
 1 file changed, 8 insertions(+)
1d442b
1d442b
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
1d442b
index 676032e71f..a3645fc807 100644
1d442b
--- a/tools/virtiofsd/helper.c
1d442b
+++ b/tools/virtiofsd/helper.c
1d442b
@@ -29,6 +29,11 @@
1d442b
     {                                               \
1d442b
         t, offsetof(struct fuse_cmdline_opts, p), 1 \
1d442b
     }
1d442b
+#define FUSE_HELPER_OPT_VALUE(t, p, v)              \
1d442b
+    {                                               \
1d442b
+        t, offsetof(struct fuse_cmdline_opts, p), v \
1d442b
+    }
1d442b
+
1d442b
 
1d442b
 static const struct fuse_opt fuse_helper_opts[] = {
1d442b
     FUSE_HELPER_OPT("-h", show_help),
1d442b
@@ -42,6 +47,7 @@ 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_VALUE("--daemonize", foreground, 0),
1d442b
     FUSE_HELPER_OPT("fsname=", nodefault_subtype),
1d442b
     FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
1d442b
     FUSE_HELPER_OPT("subtype=", nodefault_subtype),
1d442b
@@ -131,6 +137,7 @@ 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
+           "    --daemonize                run in background\n"
1d442b
            "    -o max_idle_threads        the maximum number of idle worker "
1d442b
            "threads\n"
1d442b
            "                               allowed (default: 10)\n");
1d442b
@@ -158,6 +165,7 @@ int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts)
1d442b
     memset(opts, 0, sizeof(struct fuse_cmdline_opts));
1d442b
 
1d442b
     opts->max_idle_threads = 10;
1d442b
+    opts->foreground = 1;
1d442b
 
1d442b
     if (fuse_opt_parse(args, opts, fuse_helper_opts, fuse_helper_opt_proc) ==
1d442b
         -1) {