[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 031/109] virtiofsd: add --print-capabilities option
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PATCH v2 031/109] virtiofsd: add --print-capabilities option |
Date: |
Tue, 21 Jan 2020 12:23:15 +0000 |
From: Stefan Hajnoczi <address@hidden>
Add the --print-capabilities option as per vhost-user.rst "Backend
programs conventions". Currently there are no advertised features.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
---
docs/interop/vhost-user.json | 4 +++-
tools/virtiofsd/fuse_lowlevel.h | 1 +
tools/virtiofsd/helper.c | 2 ++
tools/virtiofsd/passthrough_ll.c | 12 ++++++++++++
4 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
index ce0ef74db5..ef8ac5941f 100644
--- a/docs/interop/vhost-user.json
+++ b/docs/interop/vhost-user.json
@@ -31,6 +31,7 @@
# @rproc-serial: virtio remoteproc serial link
# @scsi: virtio scsi
# @vsock: virtio vsock transport
+# @fs: virtio fs (since 4.2)
#
# Since: 4.0
##
@@ -50,7 +51,8 @@
'rpmsg',
'rproc-serial',
'scsi',
- 'vsock'
+ 'vsock',
+ 'fs'
]
}
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
index 46c97edbe2..a95bc641fa 100644
--- a/tools/virtiofsd/fuse_lowlevel.h
+++ b/tools/virtiofsd/fuse_lowlevel.h
@@ -1826,6 +1826,7 @@ struct fuse_cmdline_opts {
int nodefault_subtype;
int show_version;
int show_help;
+ int print_capabilities;
unsigned int max_idle_threads;
};
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
index bb35b90e75..8d66be46f8 100644
--- a/tools/virtiofsd/helper.c
+++ b/tools/virtiofsd/helper.c
@@ -39,6 +39,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
FUSE_HELPER_OPT("--help", show_help),
FUSE_HELPER_OPT("-V", show_version),
FUSE_HELPER_OPT("--version", show_version),
+ FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
FUSE_HELPER_OPT("-d", debug),
FUSE_HELPER_OPT("debug", debug),
FUSE_HELPER_OPT("-d", foreground),
@@ -135,6 +136,7 @@ void fuse_cmdline_help(void)
{
printf(" -h --help print help\n"
" -V --version print version\n"
+ " --print-capabilities print vhost-user.json\n"
" -d -o debug enable debug output (implies -f)\n"
" -f foreground operation\n"
" --daemonize run in background\n"
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index fcb588f370..53ed56f2a9 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -1297,6 +1297,14 @@ static struct fuse_lowlevel_ops lo_oper = {
.lseek = lo_lseek,
};
+/* Print vhost-user.json backend program capabilities */
+static void print_capabilities(void)
+{
+ printf("{\n");
+ printf(" \"type\": \"fs\"\n");
+ printf("}\n");
+}
+
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -1327,6 +1335,10 @@ int main(int argc, char *argv[])
fuse_lowlevel_version();
ret = 0;
goto err_out1;
+ } else if (opts.print_capabilities) {
+ print_capabilities();
+ ret = 0;
+ goto err_out1;
}
if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) {
--
2.24.1
- [PATCH v2 022/109] virtiofsd: Poll kick_fd for queue, (continued)
- [PATCH v2 022/109] virtiofsd: Poll kick_fd for queue, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 021/109] virtiofsd: Start queue threads, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 023/109] virtiofsd: Start reading commands from queue, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 025/109] virtiofsd: Keep track of replies, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 024/109] virtiofsd: Send replies to messages, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 026/109] virtiofsd: Add Makefile wiring for virtiofsd contrib, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 027/109] virtiofsd: Fast path for virtio read, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 028/109] virtiofsd: add --fd=FDNUM fd passing option, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 029/109] virtiofsd: make -f (foreground) the default, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 030/109] virtiofsd: add vhost-user.json file, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 031/109] virtiofsd: add --print-capabilities option,
Dr. David Alan Gilbert (git) <=
- [PATCH v2 033/109] virtiofsd: passthrough_ll: create new files in caller's context, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 032/109] virtiofs: Add maintainers entry, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 034/109] virtiofsd: passthrough_ll: add lo_map for ino/fh indirection, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 035/109] virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 036/109] virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 037/109] virtiofsd: passthrough_ll: add fd_map to hide file descriptors, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 038/109] virtiofsd: passthrough_ll: add fallback for racy ops, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 039/109] virtiofsd: validate path components, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 040/109] virtiofsd: Plumb fuse_bufvec through to do_write_buf, Dr. David Alan Gilbert (git), 2020/01/21
- [PATCH v2 041/109] virtiofsd: Pass write iov's all the way through, Dr. David Alan Gilbert (git), 2020/01/21