On Sat, Apr 29, 2023 at 05:24:39PM +0200, Zixun LI wrote:
> Add support for lzma, zstd and auto detection of compression methods.
> 
> Signed-off-by: Zixun LI <ad...@hifiphile.com>
> ---
>  daemon/tar.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/daemon/tar.c b/daemon/tar.c
> index 57b5b37ff..347add341 100644
> --- a/daemon/tar.c
> +++ b/daemon/tar.c
> @@ -159,6 +159,12 @@ 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 if (STREQ (compress, "auto"))
> +      filter = " --auto-compress";
>      else {
>        reply_with_error ("unknown compression type: %s", compress);
>        return -1;
> @@ -312,6 +318,12 @@ 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 if (STREQ (compress, "auto"))
> +      filter = " --auto-compress";
>      else {
>        reply_with_error ("unknown compression type: %s", compress);
>        return -1;

Patch is partly fine.

'--auto-compress' seems to have some magic.  I do not think it is a
good idea to include that part.

Also it needs to update this documentation:

https://libguestfs.org/guestfs.3.html#guestfs_tar_in_opts
https://libguestfs.org/guestfs.3.html#guestfs_tar_out_opts

You can do this by patching the following file in these two places:

https://github.com/libguestfs/libguestfs/blob/d0d8e6738477148a7b752348f9364a3b8faed67f/generator/actions_core.ml#L2713
https://github.com/libguestfs/libguestfs/blob/d0d8e6738477148a7b752348f9364a3b8faed67f/generator/actions_core.ml#L2748

So I would remove the "auto" setting, and update the docs for the two
additional formats.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to