[Libguestfs] [PATCH v2 2/3] New API: btrfstune_enable_extended_inode_refs

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Sun Mar 1 07:20:48 UTC 2015


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

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index d2d4492..48693ce 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1957,3 +1957,27 @@ do_btrfstune_seeding (const char *device, int svalue)
 
   return 0;
 }
+
+int
+do_btrfstune_enable_extended_inode_refs (const char *device)
+{
+  const size_t MAX_ARGS = 64;
+  const char *argv[MAX_ARGS];
+  size_t i = 0;
+  CLEANUP_FREE char *err = NULL;
+  CLEANUP_FREE char *out = NULL;
+  int r;
+
+  ADD_ARG (argv, i, str_btrfstune);
+  ADD_ARG (argv, i, "-r");
+  ADD_ARG (argv, i, device);
+  ADD_ARG (argv, i, NULL);
+
+  r = commandv (&out, &err, argv);
+  if (r == -1) {
+    reply_with_error ("%s: %s", device, err);
+    return -1;
+  }
+
+  return 0;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index cb67fc5..bf02bdc 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12492,6 +12492,21 @@ Show status of running or finished scrub on a btrfs filesystem." };
 Enable seeding of a btrfs device, this will force a fs readonly
 so that you can use it tto build other filesystems." };
 
+  { defaults with
+    name = "btrfstune_enable_extended_inode_refs";
+    style = RErr, [Device "device"], [];
+    proc_nr = Some 451;
+    optional = Some "btrfs"; camel_name = "BTRFSTuneEnableExtendedInodeRefs";
+    tests = [
+      InitPartition, Always, TestRun (
+        [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
+         ["btrfstune_enable_extended_inode_refs"; "/dev/sda1"]]), []
+    ];
+
+    shortdesc = "enable extended inode refs";
+    longdesc = "\
+This will Enable extended inode refs." };
+
 ]
 
 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 29ba0df..4619a8a 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-450
+451
-- 
2.1.0




More information about the Libguestfs mailing list