]> wimlib.net Git - wimlib/blobdiff - src/wim.c
[EXPERIMENTAL, FOR BENCHMARKING ONLY] Zstandard compression support
[wimlib] / src / wim.c
index ca40e53a47a303b4dbe3cb44e2172e2976e91da5..853a71e531236e03343407e1d1cf40452ade44f4 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -78,6 +78,15 @@ static const struct {
                .default_nonsolid_chunk_size = 131072,
                .default_solid_chunk_size = 67108864,
        },
+#ifdef WITH_ZSTD
+       [WIMLIB_COMPRESSION_TYPE_ZSTD] = {
+               .name = T("Zstandard"),
+               .min_chunk_size = 4096,
+               .max_chunk_size = 268435456,
+               .default_nonsolid_chunk_size = 131072,
+               .default_solid_chunk_size = 131072,
+       },
+#endif
 };
 
 /* Is the specified compression type valid?  */
@@ -707,6 +716,10 @@ begin_read(WIMStruct *wim, const void *wim_filename_or_fd, int open_flags)
                        wim->compression_type = WIMLIB_COMPRESSION_TYPE_XPRESS;
                } else if (wim->hdr.flags & WIM_HDR_FLAG_COMPRESS_LZMS) {
                        wim->compression_type = WIMLIB_COMPRESSION_TYPE_LZMS;
+#ifdef WITH_ZSTD
+               } else if (wim->hdr.flags & WIM_HDR_FLAG_COMPRESS_ZSTD) {
+                       wim->compression_type = WIMLIB_COMPRESSION_TYPE_ZSTD;
+#endif
                } else {
                        return WIMLIB_ERR_INVALID_COMPRESSION_TYPE;
                }