Add support for zstd compression

* configure.ac (zstd): Register compression program.
* doc/tar.1: Mention --zstd.
* doc/tar.texi: Document zstd support.
* src/buffer.c: Register zstd compression.
* src/suffix.c: Add suffixes zst and tzst.
* src/tar.c: New compression option --zstd.
This commit is contained in:
Adam Borowski
2018-03-18 10:24:13 +02:00
committed by Sergey Poznyakoff
parent 64b43fdf70
commit 3d45373d3b
7 changed files with 44 additions and 10 deletions
+4 -1
View File
@@ -281,7 +281,8 @@ enum compress_type {
ct_lzip,
ct_lzma,
ct_lzop,
ct_xz
ct_xz,
ct_zstd
};
static enum compress_type archive_compression_type = ct_none;
@@ -310,6 +311,7 @@ static struct zip_magic const magic[] = {
{ ct_lzma, 6, "\xFFLZMA" },
{ ct_lzop, 4, "\211LZO" },
{ ct_xz, 6, "\xFD" "7zXZ" },
{ ct_zstd, 4, "\x28\xB5\x2F\xFD" },
};
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
@@ -325,6 +327,7 @@ static struct zip_program zip_program[] = {
{ ct_lzma, XZ_PROGRAM, "-J" },
{ ct_lzop, LZOP_PROGRAM, "--lzop" },
{ ct_xz, XZ_PROGRAM, "-J" },
{ ct_zstd, ZSTD_PROGRAM, "--zstd" },
{ ct_none }
};
+2
View File
@@ -46,6 +46,8 @@ static struct compression_suffix compression_suffixes[] = {
{ S(lzo, LZOP) },
{ S(xz, XZ) },
{ S(txz, XZ) }, /* Slackware */
{ S(zst, ZSTD) },
{ S(tzst, ZSTD) },
{ NULL }
#undef S
#undef __CAT2__
+11 -1
View File
@@ -348,7 +348,8 @@ enum
WARNING_OPTION,
XATTR_OPTION,
XATTR_EXCLUDE,
XATTR_INCLUDE
XATTR_INCLUDE,
ZSTD_OPTION,
};
static char const doc[] = N_("\
@@ -682,6 +683,7 @@ static struct argp_option options[] = {
{"lzma", LZMA_OPTION, 0, 0, NULL, GRID+1 },
{"lzop", LZOP_OPTION, 0, 0, NULL, GRID+1 },
{"xz", 'J', 0, 0, NULL, GRID+1 },
{"zstd", ZSTD_OPTION, 0, 0, NULL, GRID+1 },
#undef GRID
#define GRID 100
@@ -1129,6 +1131,10 @@ tar_help_filter (int key, const char *text, void *input)
s = xasprintf (_("filter the archive through %s"), XZ_PROGRAM);
break;
case ZSTD_OPTION:
s = xasprintf (_("filter the archive through %s"), ZSTD_PROGRAM);
break;
case ARGP_KEY_HELP_EXTRA:
{
const char *tstr;
@@ -1650,6 +1656,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
set_use_compress_program_option (COMPRESS_PROGRAM, args->loc);
break;
case ZSTD_OPTION:
set_use_compress_program_option (ZSTD_PROGRAM, args->loc);
break;
case ATIME_PRESERVE_OPTION:
atime_preserve_option =
(arg