yeahuh / rpms / qemu-kvm

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