[Libguestfs] [PATCH 2/2] New API: btrfs_filesystem_show_all

Chen Hanxiao
Thu, 05 Mar 2015 06:10:47 -0000

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
---
 daemon/btrfs.c       | 25 +++++++++++++++++++++++++
 generator/actions.ml | 11 +++++++++++
 src/MAX_PROC_NR      |  2 +-
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index df2fbf6..1c040a4 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1634,6 +1634,31 @@ do_btrfs_filesystem_show (const char *device)
   return out;
 }

+char *
+do_btrfs_filesystem_show_all (void)
+{
+  const size_t MAX_ARGS = 64;
+  const char *argv[MAX_ARGS];
+  size_t i = 0;
+  CLEANUP_FREE char *err = NULL;
+  char *out = NULL;
+  int r;
+
+  ADD_ARG (argv, i, str_btrfs);
+  ADD_ARG (argv, i, "filesystem");
+  ADD_ARG (argv, i, "show");
+  ADD_ARG (argv, i, NULL);
+
+  r = commandv (&out, &err, argv);
+  if (r == -1) {
+    reply_with_error ("%s", err);
+    free(out);
+    return NULL;
+  }
+
+  return out;
+}
+
 int
 do_btrfs_rescue_chunk_recover (const char *device)
 {
diff --git a/generator/actions.ml b/generator/actions.ml
index e6cd8f2..db20875 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12532,6 +12532,17 @@ This enable skinny metadata extent refs." };
     longdesc = "\
 This show btrfs filesystem with some additional info." };

+  { defaults with
+    name = "btrfs_filesystem_show_all";
+    style = RString "output", [], [];
+    (*style = RString "output", [], [OString "device"];*)
+    proc_nr = Some 454;
+    optional = Some "btrfs"; camel_name =
"BTRFSFilesystemShowAll";
+    test_excuse = "can't be tested becasue output will vary from each
mkfs.btrfs";
+    shortdesc = "show all devices run btrfs filesystem with some
additional info";
+    longdesc = "\
+This show all devices run btrfs filesystem with some additional info." };
+
 ]

 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 534b992..515f19a 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-453
+454
--
2.1.0