]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtiofsd: add --print-capabilities option
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 27 Aug 2019 09:54:35 +0000 (10:54 +0100)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 23 Jan 2020 16:41:36 +0000 (16:41 +0000)
Add the --print-capabilities option as per vhost-user.rst "Backend
programs conventions".  Currently there are no advertised features.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
docs/interop/vhost-user.json
tools/virtiofsd/fuse_lowlevel.h
tools/virtiofsd/helper.c
tools/virtiofsd/passthrough_ll.c

index ce0ef74db5a4d4baf94e2091990e1285dc2b6671..ef8ac5941f5c8d14402566a984a0a0876d768c19 100644 (file)
@@ -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'
   ]
 }
 
index f6b34700af02b1f07839efcb6ee515a44b194df7..0d61df8110d74b492597f4640e6ebd466cb2d351 100644 (file)
@@ -1794,6 +1794,7 @@ struct fuse_cmdline_opts {
     int nodefault_subtype;
     int show_version;
     int show_help;
+    int print_capabilities;
     unsigned int max_idle_threads;
 };
 
index a3645fc807c744e588d9800148b55eb365f053ca..b8ec5ac8dcf99b53e84fde9925b275ac34bab8a8 100644 (file)
@@ -40,6 +40,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"
index 037c5d7b2601ae040ad4a43be03417eee898d27e..cd27c09f595b37697ef771ee6749a95c4aa5d341 100644 (file)
@@ -1298,6 +1298,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);
@@ -1328,6 +1336,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) {