diff mbox series

[RFC,07/19] tools/vhost-user-rpmb: implement --print-capabilities

Message ID 20200925125147.26943-8-alex.bennee@linaro.org
State New
Headers show
Series vhost-user-rpmb (Replay Protected Memory Block) | expand

Commit Message

Alex Bennée Sept. 25, 2020, 12:51 p.m. UTC
A very simple capabilities dump.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tools/vhost-user-rpmb/main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/tools/vhost-user-rpmb/main.c b/tools/vhost-user-rpmb/main.c
index a40a680a74ca..6b1989125bd6 100644
--- a/tools/vhost-user-rpmb/main.c
+++ b/tools/vhost-user-rpmb/main.c
@@ -7,6 +7,7 @@ 
  */
 
 #include <glib.h>
+#include <stdio.h>
 
 static gchar *socket_path;
 static gint socket_fd;
@@ -20,6 +21,14 @@  static GOptionEntry options[] =
     { NULL }
 };
 
+/* Print vhost-user.json backend program capabilities */
+static void print_capabilities(void)
+{
+    printf("{\n");
+    printf("  \"type\": \"block\"\n");
+    printf("}\n");
+}
+
 int main (int argc, char *argv[])
 {
     GError *error = NULL;
@@ -33,5 +42,9 @@  int main (int argc, char *argv[])
         exit (1);
     }
 
+    if (print_cap) {
+        print_capabilities();
+        exit(0);
+    }
 
 }