mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
New API: btrfs_scrub_cancel
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
This commit is contained in:
committed by
Richard W.M. Jones
parent
a4d6cc525a
commit
55bfd127d4
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
435
|
||||
436
|
||||
|
||||
Reference in New Issue
Block a user