On Mon, Jan 05, 2015 at 01:01:52PM +0100, Pino Toscano wrote:
In data venerdì 26 dicembre 2014 16:17:49, Hu Tao ha scritto:
> Signed-off-by: Hu Tao <hutao(a)cn.fujitsu.com>
> ---
> daemon/btrfs.c | 33 +++++++++++++++++++++++++++++++++
> generator/actions.ml | 16 ++++++++++++++++
> src/MAX_PROC_NR | 2 +-
> 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index 32b1b05..f9e35be 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -1463,3 +1463,36 @@ do_btrfs_filesystem_defragment (const char *path)
>
> return 0;
> }
> +
> +int
> +do_btrfs_filesystem_set_label (const char *path, const char *label)
> +{
> + 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, "filesystem");
> + ADD_ARG (argv, i, "label");
> + ADD_ARG (argv, i, path_buf);
> + ADD_ARG (argv, i, label);
> + ADD_ARG (argv, i, NULL);
> +
> + r = commandv (&out, &err, argv);
> + if (r == -1) {
> + reply_with_error ("%s: %s", path, err);
> + return -1;
> + }
> +
> + return 0;
> +}
Isn't this alredy covered by set_label?
Yes. This patch ban be dropped.
Regards,
Hu
> diff --git a/generator/actions.ml b/generator/actions.ml
> index 4b24f8a..7e1f3ed 100644
> --- a/generator/actions.ml
> +++ b/generator/actions.ml
> @@ -12316,6 +12316,22 @@ Get a btrfs filesystem's label." };
> longdesc = "\
> Defragment a file or directory." };
>
> + { defaults with
> + name = "btrfs_filesystem_set_label";
> + style = RErr, [Pathname "path"; String "label"], [];
> + proc_nr = Some 439;
> + optional = Some "btrfs"; camel_name =
"BTRFSFilesystemSetLabel";
> + tests = [
> + InitPartition, Always, TestResultString (
> + [["mkfs_btrfs"; "/dev/sda1"; "";
""; "NOARG"; ""; "NOARG"; "NOARG";
""; ""];
> + ["mount"; "/dev/sda1"; "/"];
> + ["btrfs_filesystem_set_label"; "/";
"newlabel"];
> + ["btrfs_filesystem_get_label"; "/"]],
"newlabel"), [];
> + ];
This test bit would be good to be added to the tests of set_label,
just with s/Always/IfAvailable "btrfs"/ so it is run only when btrfs
is available.
Thanks,
--
Pino Toscano
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs