Signed-off-by: Hu Tao <hu...@cn.fujitsu.com> --- daemon/btrfs.c | 32 ++++++++++++++++++++++++++++++++ generator/actions.ml | 17 +++++++++++++++++ gobject/Makefile.inc | 2 +- java/Makefile.inc | 2 +- src/MAX_PROC_NR | 2 +- 5 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 150c089..f215cc4 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1343,3 +1343,35 @@ do_btrfs_qgroup_remove (const char *src, const char *dst, const char *path) return 0; } + +int +do_btrfs_scrub_start (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, "start"); + 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 a6a6dad..11b8425 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -12250,6 +12250,23 @@ several qgroups into a parent qgroup to share common limit." }; longdesc = "\ Remove qgroup C<src> from the parent qgroup C<dst>." }; + { defaults with + name = "btrfs_scrub_start"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 435; + optional = Some "btrfs"; camel_name = "BTRFSScrubStart"; + tests = [ + InitPartition, Always, TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["mount"; "/dev/sda1"; "/"]; + ["btrfs_scrub_start"; "/"]]), []; + ]; + shortdesc = "read all data from all disks and verify checksums"; + longdesc = "\ +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." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc index 91c4ea6..15bbd21 100644 --- a/gobject/Makefile.inc +++ b/gobject/Makefile.inc @@ -3,7 +3,7 @@ # generator/ *.ml # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST. # -# Copyright (C) 2009-2014 Red Hat Inc. +# Copyright (C) 2009-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/java/Makefile.inc b/java/Makefile.inc index 34938fb..103010f 100644 --- a/java/Makefile.inc +++ b/java/Makefile.inc @@ -3,7 +3,7 @@ # generator/ *.ml # ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST. # -# Copyright (C) 2009-2014 Red Hat Inc. +# Copyright (C) 2009-2015 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index e828e5d..5910394 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -434 +435 -- 2.1.0 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs