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