|
|
ddf19c |
From 23d81ee7564084f29e32fedaed5196ae1a5a3240 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ddf19c |
Date: Mon, 27 Jan 2020 19:01:10 +0100
|
|
|
ddf19c |
Subject: [PATCH 039/116] virtiofsd: add --print-capabilities option
|
|
|
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-36-dgilbert@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93486
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 035/112] virtiofsd: add --print-capabilities option
|
|
|
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 |
Add the --print-capabilities option as per vhost-user.rst "Backend
|
|
|
ddf19c |
programs conventions". Currently there are no advertised features.
|
|
|
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 45018fbb0a73ce66fd3dd87ecd2872b45658add4)
|
|
|
ddf19c |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
docs/interop/vhost-user.json | 4 +++-
|
|
|
ddf19c |
tools/virtiofsd/fuse_lowlevel.h | 1 +
|
|
|
ddf19c |
tools/virtiofsd/helper.c | 2 ++
|
|
|
ddf19c |
tools/virtiofsd/passthrough_ll.c | 12 ++++++++++++
|
|
|
ddf19c |
4 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
|
|
|
ddf19c |
index da6aaf5..d4ea1f7 100644
|
|
|
ddf19c |
--- a/docs/interop/vhost-user.json
|
|
|
ddf19c |
+++ b/docs/interop/vhost-user.json
|
|
|
ddf19c |
@@ -31,6 +31,7 @@
|
|
|
ddf19c |
# @rproc-serial: virtio remoteproc serial link
|
|
|
ddf19c |
# @scsi: virtio scsi
|
|
|
ddf19c |
# @vsock: virtio vsock transport
|
|
|
ddf19c |
+# @fs: virtio fs (since 4.2)
|
|
|
ddf19c |
#
|
|
|
ddf19c |
# Since: 4.0
|
|
|
ddf19c |
##
|
|
|
ddf19c |
@@ -50,7 +51,8 @@
|
|
|
ddf19c |
'rpmsg',
|
|
|
ddf19c |
'rproc-serial',
|
|
|
ddf19c |
'scsi',
|
|
|
ddf19c |
- 'vsock'
|
|
|
ddf19c |
+ 'vsock',
|
|
|
ddf19c |
+ 'fs'
|
|
|
ddf19c |
]
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
|
|
|
ddf19c |
index f6b3470..0d61df8 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/fuse_lowlevel.h
|
|
|
ddf19c |
+++ b/tools/virtiofsd/fuse_lowlevel.h
|
|
|
ddf19c |
@@ -1794,6 +1794,7 @@ struct fuse_cmdline_opts {
|
|
|
ddf19c |
int nodefault_subtype;
|
|
|
ddf19c |
int show_version;
|
|
|
ddf19c |
int show_help;
|
|
|
ddf19c |
+ int print_capabilities;
|
|
|
ddf19c |
unsigned int max_idle_threads;
|
|
|
ddf19c |
};
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
|
|
|
ddf19c |
index a3645fc..b8ec5ac 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/helper.c
|
|
|
ddf19c |
+++ b/tools/virtiofsd/helper.c
|
|
|
ddf19c |
@@ -40,6 +40,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
|
|
|
ddf19c |
FUSE_HELPER_OPT("--help", show_help),
|
|
|
ddf19c |
FUSE_HELPER_OPT("-V", show_version),
|
|
|
ddf19c |
FUSE_HELPER_OPT("--version", show_version),
|
|
|
ddf19c |
+ FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
|
|
|
ddf19c |
FUSE_HELPER_OPT("-d", debug),
|
|
|
ddf19c |
FUSE_HELPER_OPT("debug", debug),
|
|
|
ddf19c |
FUSE_HELPER_OPT("-d", foreground),
|
|
|
ddf19c |
@@ -135,6 +136,7 @@ void fuse_cmdline_help(void)
|
|
|
ddf19c |
{
|
|
|
ddf19c |
printf(" -h --help print help\n"
|
|
|
ddf19c |
" -V --version print version\n"
|
|
|
ddf19c |
+ " --print-capabilities print vhost-user.json\n"
|
|
|
ddf19c |
" -d -o debug enable debug output (implies -f)\n"
|
|
|
ddf19c |
" -f foreground operation\n"
|
|
|
ddf19c |
" --daemonize run in background\n"
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
index 037c5d7..cd27c09 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
+++ b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
@@ -1298,6 +1298,14 @@ static struct fuse_lowlevel_ops lo_oper = {
|
|
|
ddf19c |
.lseek = lo_lseek,
|
|
|
ddf19c |
};
|
|
|
ddf19c |
|
|
|
ddf19c |
+/* Print vhost-user.json backend program capabilities */
|
|
|
ddf19c |
+static void print_capabilities(void)
|
|
|
ddf19c |
+{
|
|
|
ddf19c |
+ printf("{\n");
|
|
|
ddf19c |
+ printf(" \"type\": \"fs\"\n");
|
|
|
ddf19c |
+ printf("}\n");
|
|
|
ddf19c |
+}
|
|
|
ddf19c |
+
|
|
|
ddf19c |
int main(int argc, char *argv[])
|
|
|
ddf19c |
{
|
|
|
ddf19c |
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
|
|
ddf19c |
@@ -1328,6 +1336,10 @@ int main(int argc, char *argv[])
|
|
|
ddf19c |
fuse_lowlevel_version();
|
|
|
ddf19c |
ret = 0;
|
|
|
ddf19c |
goto err_out1;
|
|
|
ddf19c |
+ } else if (opts.print_capabilities) {
|
|
|
ddf19c |
+ print_capabilities();
|
|
|
ddf19c |
+ ret = 0;
|
|
|
ddf19c |
+ goto err_out1;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) {
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|