Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
daemon/btrfs.c | 25 +++++++++++++++++++++++++
generator/actions.ml | 16 ++++++++++++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index d84c28e..c94c11a 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -2090,3 +2090,28 @@ do_btrfs_inspect_internal_logical_resolve (int64_t logical, const
char *fs)
return out;
}
+
+int
+do_btrfstune_S_enable (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, "-S");
+ ADD_ARG (argv, i, "1");
+ 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 7b7655d..6dccb5c 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12531,6 +12531,22 @@ Get path on a btrfs filesystem for the given inode." };
longdesc = "\
Get path on a btrfs filesystem for the logical address." };
+ { defaults with
+ name = "btrfstune_S_enable";
+ style = RErr, [Device "device"], [];
+ proc_nr = Some 454;
+ optional = Some "btrfs"; camel_name = "BTRFSTuneSEnable";
+ tests = [
+ InitPartition, Always, TestRun (
+ [["mkfs_btrfs"; "/dev/sda1"; ""; "";
"NOARG"; ""; "NOARG"; "NOARG"; "";
""];
+ ["btrfstune_S_enable"; "/dev/sda1"]]), []
+ ];
+
+ shortdesc = "enable seeding of a btrfs device";
+ longdesc = "\
+Enable seeding of a btrfs device, this will force a fs readonly
+so that you can use it tto build other filesystems." };
+
]
(* 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