cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
22c213
From 7f2e1f79a3addb242c3018c7a80e2e57589119f0 Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:01:08 +0100
22c213
Subject: [PATCH 037/116] virtiofsd: make -f (foreground) the default
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-34-dgilbert@redhat.com>
22c213
Patchwork-id: 93489
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 033/112] virtiofsd: make -f (foreground) the default
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: Stefan Hajnoczi <stefanha@redhat.com>
22c213
22c213
According to vhost-user.rst "Backend program conventions", backend
22c213
programs should run in the foregound by default.  Follow the
22c213
conventions so libvirt and other management tools can control virtiofsd
22c213
in a standard way.
22c213
22c213
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit 0bbd31753714ac2899efda0f0de31e353e965789)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/helper.c | 8 ++++++++
22c213
 1 file changed, 8 insertions(+)
22c213
22c213
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
22c213
index 676032e..a3645fc 100644
22c213
--- a/tools/virtiofsd/helper.c
22c213
+++ b/tools/virtiofsd/helper.c
22c213
@@ -29,6 +29,11 @@
22c213
     {                                               \
22c213
         t, offsetof(struct fuse_cmdline_opts, p), 1 \
22c213
     }
22c213
+#define FUSE_HELPER_OPT_VALUE(t, p, v)              \
22c213
+    {                                               \
22c213
+        t, offsetof(struct fuse_cmdline_opts, p), v \
22c213
+    }
22c213
+
22c213
 
22c213
 static const struct fuse_opt fuse_helper_opts[] = {
22c213
     FUSE_HELPER_OPT("-h", show_help),
22c213
@@ -42,6 +47,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
22c213
     FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP),
22c213
     FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
22c213
     FUSE_HELPER_OPT("-f", foreground),
22c213
+    FUSE_HELPER_OPT_VALUE("--daemonize", foreground, 0),
22c213
     FUSE_HELPER_OPT("fsname=", nodefault_subtype),
22c213
     FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
22c213
     FUSE_HELPER_OPT("subtype=", nodefault_subtype),
22c213
@@ -131,6 +137,7 @@ void fuse_cmdline_help(void)
22c213
            "    -V   --version             print version\n"
22c213
            "    -d   -o debug              enable debug output (implies -f)\n"
22c213
            "    -f                         foreground operation\n"
22c213
+           "    --daemonize                run in background\n"
22c213
            "    -o max_idle_threads        the maximum number of idle worker "
22c213
            "threads\n"
22c213
            "                               allowed (default: 10)\n");
22c213
@@ -158,6 +165,7 @@ int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts)
22c213
     memset(opts, 0, sizeof(struct fuse_cmdline_opts));
22c213
 
22c213
     opts->max_idle_threads = 10;
22c213
+    opts->foreground = 1;
22c213
 
22c213
     if (fuse_opt_parse(args, opts, fuse_helper_opts, fuse_helper_opt_proc) ==
22c213
         -1) {
22c213
-- 
22c213
1.8.3.1
22c213