[Pkg-libvirt-commits] [libguestfs] 181/384: New API: btrfs_scrub_cancel

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:56:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 55bfd127d4ef6a83e042db58369075e12ee668ef
Author: Hu Tao <hutao at cn.fujitsu.com>
Date:   Fri Jan 16 10:23:37 2015 +0800

    New API: btrfs_scrub_cancel
    
    Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
 daemon/btrfs.c       | 32 ++++++++++++++++++++++++++++++++
 generator/actions.ml | 10 ++++++++++
 src/MAX_PROC_NR      |  2 +-
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 752db9f..54b7bcb 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1399,3 +1399,35 @@ do_btrfs_scrub_start (const char *path)
 
   return 0;
 }
+
+int
+do_btrfs_scrub_cancel (const char *path)
+{
+  const size_t MAX_ARGS = 64;
+  const char *argv[MAX_ARGS];
+  size_t i = 0;
+  CLEANUP_FREE char *path_buf = NULL;
+  CLEANUP_FREE char *err = NULL;
+  CLEANUP_FREE char *out = NULL;
+  int r;
+
+  path_buf = sysroot_path (path);
+  if (path_buf == NULL) {
+    reply_with_perror ("malloc");
+    return -1;
+  }
+
+  ADD_ARG (argv, i, str_btrfs);
+  ADD_ARG (argv, i, "scrub");
+  ADD_ARG (argv, i, "cancel");
+  ADD_ARG (argv, i, path_buf);
+  ADD_ARG (argv, i, NULL);
+
+  r = commandv (&out, &err, argv);
+  if (r == -1) {
+    reply_with_error ("%s: %s", path, err);
+    return -1;
+  }
+
+  return 0;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index 329c7c9..408c23f 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12286,6 +12286,16 @@ Reads all the data and metadata on the filesystem, and uses checksums
 and the duplicate copies from RAID storage to identify and repair any
 corrupt data." };
 
+  { defaults with
+    name = "btrfs_scrub_cancel";
+    style = RErr, [Pathname "path"], [];
+    proc_nr = Some 436;
+    optional = Some "btrfs"; camel_name = "BTRFSScrubCancel";
+    test_excuse = "test disk isn't large enough that btrfs_scrub_start completes before we can cancel it";
+    shortdesc = "cancel a running scrub";
+    longdesc = "\
+Cancel a running scrub on a btrfs filesystem." };
+
 ]
 
 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 5910394..246662b 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-435
+436

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list