From 692802bf96e0c76363d26d78a105fb79ada736de Mon Sep 17 00:00:00 2001 From: Zixun LI Date: Sat, 29 Apr 2023 22:18:12 +0200 Subject: [PATCH] daemon/tar: support more compression methods. Add support for lzma and zstd compression methods. Signed-off-by: Zixun LI Reviewed-by: Richard W.M. Jones --- daemon/tar.c | 8 ++++++++ generator/actions_core.ml | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/daemon/tar.c b/daemon/tar.c index 57b5b37ff..ff29fe500 100644 --- a/daemon/tar.c +++ b/daemon/tar.c @@ -159,6 +159,10 @@ do_tar_in (const char *dir, const char *compress, int xattrs, int selinux, int a filter = " --xz"; else if (STREQ (compress, "lzop")) filter = " --lzop"; + else if (STREQ (compress, "lzma")) + filter = " --lzma"; + else if (STREQ (compress, "zstd")) + filter = " --zstd"; else { reply_with_error ("unknown compression type: %s", compress); return -1; @@ -312,6 +316,10 @@ do_tar_out (const char *dir, const char *compress, int numericowner, filter = " --xz"; else if (STREQ (compress, "lzop")) filter = " --lzop"; + else if (STREQ (compress, "lzma")) + filter = " --lzma"; + else if (STREQ (compress, "zstd")) + filter = " --zstd"; else { reply_with_error ("unknown compression type: %s", compress); return -1; diff --git a/generator/actions_core.ml b/generator/actions_core.ml index c8d9949ba..addbe4ec1 100644 --- a/generator/actions_core.ml +++ b/generator/actions_core.ml @@ -2710,9 +2710,9 @@ This command uploads and unpacks local file C into F. The optional C flag controls compression. If not given, then the input should be an uncompressed tar file. Otherwise one of the following strings may be given to select the compression -type of the input file: C, C, C, C, C. -(Note that not all builds of libguestfs will support all of these -compression types). +type of the input file: C, C, C, C, C, +C, C. (Note that not all builds of libguestfs will support +all of these compression types). The other optional arguments are: @@ -2745,9 +2745,9 @@ it to local file C. The optional C flag controls compression. If not given, then the output will be an uncompressed tar file. Otherwise one of the following strings may be given to select the compression -type of the output file: C, C, C, C, C. -(Note that not all builds of libguestfs will support all of these -compression types). +type of the output file: C, C, C, C, C, +C, C. (Note that not all builds of libguestfs will support +all of these compression types). The other optional arguments are: