recipes: tools/tarlz: added version 0.10a
[dragora.git] / patches / squashfs / squashfs-tools-20180628_lzip-0.diff
blobd6d9e083b67a94de52eb668aba776b0f415204c3
1 diff -urdN squashfs-tools-master/INSTALL squashfs-tools-master.new/INSTALL
2 --- squashfs-tools-master/INSTALL 2018-06-12 06:07:02.000000000 +0200
3 +++ squashfs-tools-master.new/INSTALL 2018-07-10 13:27:23.000000000 +0200
4 @@ -26,5 +26,5 @@
6 By default the tools are built with GZIP compression and extended attribute
7 support. Read the Makefile in squashfs-tools/ for instructions on building
8 -LZO, LZ4 and XZ compression support, and for instructions on disabling GZIP
9 -and extended attribute support if desired.
10 +LZIP, LZO, LZ4 and XZ compression support, and for instructions on disabling
11 +GZIP and extended attribute support if desired.
12 diff -urdN squashfs-tools-master/RELEASE-README squashfs-tools-master.new/RELEASE-README
13 --- squashfs-tools-master/RELEASE-README 2018-06-12 06:07:02.000000000 +0200
14 +++ squashfs-tools-master.new/RELEASE-README 2018-07-10 13:27:23.000000000 +0200
15 @@ -8,7 +8,7 @@
16 for details of changes.
18 Squashfs is a highly compressed read-only filesystem for Linux.
19 -It uses either gzip/xz/lzo/lz4 compression to compress both files, inodes
20 +It uses either gzip/lzip/xz/lzo/lz4 compression to compress both files, inodes
21 and directories. Inodes in the system are very small and all blocks are
22 packed to minimise data overhead. Block sizes greater than 4K are supported
23 up to a maximum of 1Mbytes (default block size 128K).
24 @@ -39,7 +39,7 @@
26 6. File duplicates are detected and removed.
28 -7. Filesystems can be compressed with gzip, xz (lzma2), lzo or lz4
29 +7. Filesystems can be compressed with gzip, lzip, xz (lzma2), lzo or lz4
30 compression algorithms.
32 1.1 Extended attributes (xattrs)
33 @@ -103,6 +103,7 @@
34 -comp <comp> select <comp> compression
35 Compressors available:
36 gzip (default)
37 + lzip
38 lzo
39 lz4
41 @@ -181,6 +182,15 @@
42 and choose the best compression.
43 Available strategies: default, filtered, huffman_only,
44 run_length_encoded and fixed
45 + lzip
46 + -Xcompression-level <compression-level>
47 + <compression-level> should be 0 .. 9 (default 9)
48 + -Xdict-size <dict-size>
49 + Use <dict-size> as the LZIP dictionary size. The dictionary
50 + size can be specified as a percentage of the block size, or
51 + as an absolute value. The dictionary size must be less than
52 + or equal to the block size and 4096 bytes or larger.
53 + Example dict-sizes are 25%, 37.5% or 8K, 32K, etc.
54 lzo
55 -Xalgorithm <algorithm>
56 Where <algorithm> is one of:
57 @@ -279,7 +289,7 @@
58 algorithm. This algorithm offers a good trade-off between compression
59 ratio, and memory and time taken to decompress.
61 -Squashfs also supports LZ4, LZO and XZ (LZMA2) compression. LZO offers worse
62 +Squashfs also supports LZIP, LZ4, LZO and XZ compression. LZO offers worse
63 compression ratio than gzip, but is faster to decompress. XZ offers better
64 compression ratio than gzip, but at the expense of greater memory and time
65 to decompress (and significantly more time to compress). LZ4 is similar
66 @@ -304,6 +314,15 @@
67 and choose the best compression.
68 Available strategies: default, filtered, huffman_only,
69 run_length_encoded and fixed
70 + lzip
71 + -Xcompression-level <compression-level>
72 + <compression-level> should be 0 .. 9 (default 9)
73 + -Xdict-size <dict-size>
74 + Use <dict-size> as the LZIP dictionary size. The dictionary
75 + size can be specified as a percentage of the block size, or
76 + as an absolute value. The dictionary size must be less than
77 + or equal to the block size and 4096 bytes or larger.
78 + Example dict-sizes are 25%, 37.5% or 8K, 32K, etc.
79 lzo
80 -Xalgorithm <algorithm>
81 Where <algorithm> is one of:
82 @@ -340,7 +359,7 @@
83 web sites should be consulted to understand their behaviour. In general
84 the Mksquashfs compression defaults for each compressor are optimised to
85 give the best performance for each compressor, where what constitutes
86 -best depends on the compressor. For gzip/xz best means highest compression,
87 +best depends on the compressor. For gzip/lzip/xz best means highest compression,
88 for LZO/LZ4 best means a tradeoff between compression and (de)-compression
89 overhead (LZO/LZ4 by definition are intended for weaker processors).
91 @@ -767,6 +786,7 @@
93 Decompressors available:
94 gzip
95 + lzip
96 lzo
97 lz4
99 diff -urdN squashfs-tools-master/squashfs-tools/Makefile squashfs-tools-master.new/squashfs-tools/Makefile
100 --- squashfs-tools-master/squashfs-tools/Makefile 2018-06-12 06:07:02.000000000 +0200
101 +++ squashfs-tools-master.new/squashfs-tools/Makefile 2018-07-10 13:27:23.000000000 +0200
102 @@ -17,6 +17,15 @@
104 GZIP_SUPPORT = 1
106 +########### Building LZIP support #############
108 +# The lzlib library (http://www.nongnu.org/lzip/lzlib.html) is supported.
110 +# To build using lzlib - install the library and uncomment the
111 +# LZIP_SUPPORT line below.
113 +LZIP_SUPPORT = 1
115 ########### Building XZ support #############
117 # LZMA2 compression.
118 @@ -143,6 +152,14 @@
119 COMPRESSORS += gzip
120 endif
122 +ifeq ($(LZIP_SUPPORT),1)
123 +CFLAGS += -DLZIP_SUPPORT
124 +MKSQUASHFS_OBJS += lzip_wrapper.o
125 +UNSQUASHFS_OBJS += lzip_wrapper.o
126 +LIBS += -llz
127 +COMPRESSORS += lzip
128 +endif
130 ifeq ($(LZMA_SUPPORT),1)
131 LZMA_OBJS = $(LZMA_DIR)/C/Alloc.o $(LZMA_DIR)/C/LzFind.o \
132 $(LZMA_DIR)/C/LzmaDec.o $(LZMA_DIR)/C/LzmaEnc.o $(LZMA_DIR)/C/LzmaLib.o
133 @@ -229,8 +246,8 @@
134 # At least one compressor must have been selected
136 ifndef COMPRESSORS
137 -$(error "No compressor selected! Select one or more of GZIP, LZMA, XZ, LZO or \
138 - LZ4!")
139 +$(error "No compressor selected! Select one or more of GZIP, LZIP, LZMA, XZ, \
140 + LZO, LZ4 or ZSTD!")
141 endif
144 @@ -285,6 +302,8 @@
146 gzip_wrapper.o: gzip_wrapper.c squashfs_fs.h gzip_wrapper.h compressor.h
148 +lzip_wrapper.o: lzip_wrapper.c squashfs_fs.h lzip_wrapper.h compressor.h
150 lzma_wrapper.o: lzma_wrapper.c compressor.h squashfs_fs.h
152 lzma_xz_wrapper.o: lzma_xz_wrapper.c compressor.h squashfs_fs.h
153 diff -urdN squashfs-tools-master/squashfs-tools/compressor.c squashfs-tools-master.new/squashfs-tools/compressor.c
154 --- squashfs-tools-master/squashfs-tools/compressor.c 2018-06-12 06:07:02.000000000 +0200
155 +++ squashfs-tools-master.new/squashfs-tools/compressor.c 2018-07-10 13:27:23.000000000 +0200
156 @@ -33,6 +33,14 @@
157 extern struct compressor gzip_comp_ops;
158 #endif
160 +#ifndef LZIP_SUPPORT
161 +static struct compressor lzip_comp_ops = {
162 + LZIP_COMPRESSION, "lzip"
164 +#else
165 +extern struct compressor lzip_comp_ops;
166 +#endif
168 #ifndef LZMA_SUPPORT
169 static struct compressor lzma_comp_ops = {
170 LZMA_COMPRESSION, "lzma"
171 @@ -80,6 +88,7 @@
173 struct compressor *compressor[] = {
174 &gzip_comp_ops,
175 + &lzip_comp_ops,
176 &lzma_comp_ops,
177 &lzo_comp_ops,
178 &lz4_comp_ops,
179 diff -urdN squashfs-tools-master/squashfs-tools/lzip_wrapper.c squashfs-tools-master.new/squashfs-tools/lzip_wrapper.c
180 --- squashfs-tools-master/squashfs-tools/lzip_wrapper.c 1970-01-01 01:00:00.000000000 +0100
181 +++ squashfs-tools-master.new/squashfs-tools/lzip_wrapper.c 2018-07-10 14:57:57.000000000 +0200
182 @@ -0,0 +1,462 @@
184 + * Copyright (c) 2014
185 + * Phillip Lougher <phillip@squashfs.org.uk>
186 + * Copyright (C) 2018 Antonio Diaz Diaz
188 + * This program is free software; you can redistribute it and/or
189 + * modify it under the terms of the GNU General Public License
190 + * as published by the Free Software Foundation; either version 2,
191 + * or (at your option) any later version.
193 + * This program is distributed in the hope that it will be useful,
194 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
195 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
196 + * GNU General Public License for more details.
198 + * You should have received a copy of the GNU General Public License
199 + * along with this program; if not, write to the Free Software
200 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
202 + * lzip_wrapper.c
204 + * Support for LZIP compression using lzlib
205 + * http://www.nongnu.org/lzip/lzlib.html
206 + */
208 +#include <limits.h>
209 +#include <stdint.h>
210 +#include <stdio.h>
211 +#include <stdlib.h>
212 +#include <string.h>
213 +#include <lzlib.h>
215 +#include "squashfs_fs.h"
216 +#include "lzip_wrapper.h"
217 +#include "compressor.h"
219 +static int dictionary_size = 0;
220 +static float dictionary_percent = 0;
222 +/* default compression level */
223 +static int compression_level = LZIP_DEFAULT_COMPRESSION_LEVEL;
225 +/* match_len_limit of each compression level */
226 +const int match_len[] = { 16, 5, 6, 8, 12, 20, 36, 68, 132, 273 };
228 +static inline int isvalid_ds( const int dictionary_size )
230 + return (dictionary_size >= LZ_min_dictionary_size() &&
231 + dictionary_size <= LZ_max_dictionary_size());
235 + * This function is called by the options parsing code in mksquashfs.c
236 + * to parse any -X compressor option.
238 + * Two specific options are supported:
239 + * -Xcompression-level
240 + * -Xdict-size
242 + * This function returns:
243 + * >=0 (number of additional args parsed) on success
244 + * -1 if the option was unrecognised, or
245 + * -2 if the option was recognised, but otherwise bad in
246 + * some way (e.g. invalid parameter)
248 + * Note: this function sets internal compressor state, but does not
249 + * pass back the results of the parsing other than success/failure.
250 + * The lzip_dump_options() function is called later to get the options in
251 + * a format suitable for writing to the filesystem.
252 + */
253 +static int lzip_options(char *argv[], int argc)
255 + if(strcmp(argv[0], "-Xcompression-level") == 0) {
256 + if(argc < 2) {
257 + fprintf(stderr, "lzip: -Xcompression-level missing "
258 + "compression level\n");
259 + fprintf(stderr, "lzip: -Xcompression-level it "
260 + "should be 0 <= n <= 9\n");
261 + goto failed;
264 + compression_level = atoi(argv[1]);
265 + if(compression_level < 0 || compression_level > 9) {
266 + fprintf(stderr, "lzip: -Xcompression-level invalid, it "
267 + "should be 0 <= n <= 9\n");
268 + goto failed;
270 + if(compression_level == 0) {
271 + dictionary_size = 65535;
272 + dictionary_percent = 0;
275 + return 1;
276 + } else if(strcmp(argv[0], "-Xdict-size") == 0) {
277 + char *b;
278 + float size;
280 + if(argc < 2) {
281 + fprintf(stderr, "lzip: -Xdict-size missing dict-size\n");
282 + goto failed;
285 + size = strtof(argv[1], &b);
286 + if(*b == '%') {
287 + if(size <= 0 || size > 100) {
288 + fprintf(stderr, "lzip: -Xdict-size percentage "
289 + "should be 0%% < dict-size <= 100%%\n");
290 + goto failed;
293 + dictionary_size = 0;
294 + dictionary_percent = size;
295 + } else {
296 + if((float) ((int) size) != size) {
297 + fprintf(stderr, "lzip: -Xdict-size can't be "
298 + "fractional unless a percentage of the"
299 + " block size\n");
300 + goto failed;
303 + dictionary_size = (int) size;
304 + dictionary_percent = 0;
306 + if(*b == 'k' || *b == 'K')
307 + dictionary_size *= 1024;
308 + else if(*b == 'm' || *b == 'M')
309 + dictionary_size *= 1024 * 1024;
310 + else if(*b != '\0') {
311 + fprintf(stderr, "lzip: -Xdict-size invalid "
312 + "dict-size\n");
313 + goto failed;
315 + if(!isvalid_ds(dictionary_size)) {
316 + fprintf(stderr, "lzip: -Xdict-size invalid, it "
317 + "should be %d <= n <= %d\n",
318 + LZ_min_dictionary_size(),
319 + LZ_max_dictionary_size());
320 + goto failed;
324 + return 1;
327 + return -1;
329 +failed:
330 + return -2;
335 + * This function is called after all options have been parsed.
336 + * It is used to do post-processing on the compressor options using
337 + * values that were not expected to be known at option parse time.
339 + * In this case block_size may not be known until after -Xdict-size has
340 + * been processed (in the case where -b is specified after -Xdict-size)
342 + * This function returns 0 on successful post processing, or
343 + * -1 on error
344 + */
345 +static int lzip_options_post(int block_size)
347 + /*
348 + * if -Xdict-size has been specified use this to compute the datablock
349 + * dictionary size
350 + */
351 + if(dictionary_size || dictionary_percent) {
352 + if(dictionary_size) {
353 + if(dictionary_size > block_size) {
354 + fprintf(stderr, "lzip: -Xdict-size is larger than"
355 + " block_size\n");
356 + goto failed;
358 + } else
359 + dictionary_size = block_size * dictionary_percent / 100;
361 + if(dictionary_size < 4096) {
362 + fprintf(stderr, "lzip: -Xdict-size should be 4096 bytes "
363 + "or larger\n");
364 + goto failed;
367 + } else
368 + /* No -Xdict-size specified, use defaults */
369 + dictionary_size = block_size;
371 + return 0;
373 +failed:
374 + return -1;
379 + * This function is called by mksquashfs to dump the parsed
380 + * compressor options in a format suitable for writing to the
381 + * compressor options field in the filesystem (stored immediately
382 + * after the superblock).
384 + * This function returns a pointer to the compression options structure
385 + * to be stored (and the size), or NULL if there are no compression
386 + * options
387 + */
388 +static void *lzip_dump_options(int block_size, int *size)
390 + static struct lzip_comp_opts comp_opts;
392 + /*
393 + * don't store compressor specific options in file system if the
394 + * default options are being used - no compressor options in the
395 + * file system means the default options are always assumed
397 + * Defaults are:
398 + * compression_level: LZIP_DEFAULT_COMPRESSION_LEVEL
399 + * metadata dictionary size: SQUASHFS_METADATA_SIZE
400 + * datablock dictionary size: block_size
401 + */
402 + if(dictionary_size == block_size &&
403 + compression_level == LZIP_DEFAULT_COMPRESSION_LEVEL)
404 + return NULL;
406 + comp_opts.dictionary_size = dictionary_size;
407 + comp_opts.compression_level = compression_level;
409 + SQUASHFS_INSWAP_COMP_OPTS(&comp_opts);
411 + *size = sizeof(comp_opts);
412 + return &comp_opts;
416 +/* Check and swap options read from the filesystem. */
417 +static int lzip_check_options(struct lzip_comp_opts *comp_opts, int size)
419 + /* check passed comp opts struct is of the correct length */
420 + if(size != sizeof(struct lzip_comp_opts))
421 + goto failed;
423 + SQUASHFS_INSWAP_COMP_OPTS(comp_opts);
425 + /* Check comp_opts structure for correctness */
426 + if(!isvalid_ds(comp_opts->dictionary_size)) {
427 + fprintf(stderr, "lzip: bad dictionary size in "
428 + "compression options structure\n");
429 + goto failed;
432 + if(comp_opts->compression_level > 9) {
433 + fprintf(stderr, "lzip: bad compression level in "
434 + "compression options structure\n");
435 + goto failed;
438 + return 1;
440 +failed:
441 + fprintf(stderr, "lzip: error reading stored compressor options from "
442 + "filesystem!\n");
443 + return 0;
448 + * This function is a helper specifically for the append mode of
449 + * mksquashfs. Its purpose is to set the internal compressor state
450 + * to the stored compressor options in the passed compressor options
451 + * structure.
453 + * In effect this function sets up the compressor options
454 + * to the same state they were when the filesystem was originally
455 + * generated, this is to ensure on appending, the compressor uses
456 + * the same compression options that were used to generate the
457 + * original filesystem.
459 + * Note, even if there are no compressor options, this function is still
460 + * called with an empty compressor structure (size == 0), to explicitly
461 + * set the default options, this is to ensure any user supplied
462 + * -X options on the appending mksquashfs command line are over-ridden
464 + * This function returns 0 on sucessful extraction of options, and
465 + * -1 on error
466 + */
467 +static int lzip_extract_options(int block_size, void *buffer, int size)
469 + if(size == 0) {
470 + /* set defaults */
471 + dictionary_size = block_size;
472 + compression_level = LZIP_DEFAULT_COMPRESSION_LEVEL;
473 + } else {
474 + struct lzip_comp_opts *comp_opts = buffer;
475 + if(!lzip_check_options(comp_opts, size))
476 + return -1;
478 + dictionary_size = comp_opts->dictionary_size;
479 + compression_level = comp_opts->compression_level;
482 + return 0;
486 +static void lzip_display_options(void *buffer, int size)
488 + struct lzip_comp_opts *comp_opts = buffer;
489 + if(!lzip_check_options(comp_opts, size))
490 + return;
492 + printf("\tcompression-level %d\n", comp_opts->compression_level);
493 + printf("\tDictionary size %d\n", comp_opts->dictionary_size);
498 + * This function is called by mksquashfs to allocate and initialise
499 + * a lzip_stream struct, before compress() is called.
501 + * This function returns 0 on success, and
502 + * -1 on error
503 + */
504 +static int lzip_init(void **strm, int block_size, int datablock)
506 + struct lzip_stream * const stream = malloc(sizeof(struct lzip_stream));
508 + if(!stream)
509 + return -1;
511 + /* dict == 65535 and match_len == 16 choose fast encoder */
512 + stream->dictionary_size =
513 + (datablock || (compression_level == 0 && dictionary_size == 65535)) ?
514 + dictionary_size : SQUASHFS_METADATA_SIZE;
515 + stream->match_len_limit = match_len[compression_level];
516 + *strm = stream;
517 + return 0;
521 +/* Can be called multiple times after each call to lzip_init */
522 +static int lzip_compress(void *strm, void *dest, void *src, int size,
523 + int block_size, int *error)
525 + int ipos = 0, opos = 0;
526 + struct lzip_stream * const stream = strm;
527 + struct LZ_Encoder * const encoder =
528 + LZ_compress_open(stream->dictionary_size,
529 + stream->match_len_limit, LLONG_MAX);
531 + if(!encoder || LZ_compress_errno(encoder) != LZ_ok) {
532 + *error = LZ_mem_error;
533 + goto failed2;
536 + for(;;) {
537 + int rd = LZ_compress_write(encoder, src + ipos, size - ipos);
538 + if(rd < 0)
539 + goto failed;
540 + ipos += rd;
541 + if(ipos >= size)
542 + LZ_compress_finish(encoder);
543 + rd = LZ_compress_read(encoder, dest + opos, block_size - opos);
544 + if(rd < 0)
545 + goto failed;
546 + opos += rd;
547 + if(LZ_compress_finished(encoder) == 1)
548 + break;
549 + if(opos >= block_size) {
550 + /* Output buffer overflow. Return out of buffer space */
551 + opos = 0;
552 + break;
556 + LZ_compress_close(encoder);
557 + return opos;
559 +failed:
560 + /*
561 + * All other errors return failure, with the compressor
562 + * specific error code in *error
563 + */
564 + *error = LZ_compress_errno(encoder);
565 +failed2:
566 + LZ_compress_close(encoder);
567 + return -1;
571 +static int lzip_uncompress(void *dest, void *src, int size, int outsize,
572 + int *error)
574 + int ipos = 0, opos = 0;
575 + struct LZ_Decoder * const decoder = LZ_decompress_open();
577 + if(!decoder || LZ_decompress_errno(decoder) != LZ_ok) {
578 + *error = LZ_mem_error;
579 + goto failed2;
582 + for(;;) {
583 + int rd = LZ_decompress_write(decoder, src + ipos, size - ipos);
584 + if(rd < 0)
585 + goto failed;
586 + ipos += rd;
587 + if(ipos >= size)
588 + LZ_decompress_finish(decoder);
589 + rd = LZ_decompress_read(decoder, dest + opos, outsize - opos);
590 + if(rd < 0)
591 + goto failed;
592 + opos += rd;
593 + if(LZ_decompress_finished(decoder) == 1)
594 + break;
595 + if(opos >= outsize) {
596 + /* Output buffer overflow. Return out of buffer space */
597 + *error = LZ_mem_error;
598 + goto failed2;
602 + LZ_decompress_close(decoder);
603 + return opos;
605 +failed:
606 + /*
607 + * All other errors return failure, with the compressor
608 + * specific error code in *error
609 + */
610 + *error = LZ_decompress_errno(decoder);
611 +failed2:
612 + LZ_decompress_close(decoder);
613 + return -1;
617 +static void lzip_usage()
619 + fprintf(stderr, "\t -Xcompression-level <compression-level>\n"
620 + "\t\t<compression-level> should be 0 .. 9 (default %d)\n",
621 + LZIP_DEFAULT_COMPRESSION_LEVEL);
622 + fprintf(stderr, "\t -Xdict-size <dict-size>\n"
623 + "\t\tUse <dict-size> as the LZIP dictionary size. The dictionary\n"
624 + "\t\tsize can be specified as a percentage of the block size, or\n"
625 + "\t\tas an absolute value. The dictionary size must be less than\n"
626 + "\t\tor equal to the block size and 4096 bytes or larger.\n"
627 + "\t\tExample dict-sizes are 25%%, 37.5%% or 8K, 32K, etc.\n");
631 +struct compressor lzip_comp_ops = {
632 + .init = lzip_init,
633 + .compress = lzip_compress,
634 + .uncompress = lzip_uncompress,
635 + .options = lzip_options,
636 + .options_post = lzip_options_post,
637 + .dump_options = lzip_dump_options,
638 + .extract_options = lzip_extract_options,
639 + .display_options = lzip_display_options,
640 + .usage = lzip_usage,
641 + .id = LZIP_COMPRESSION,
642 + .name = "lzip",
643 + .supported = 1
645 diff -urdN squashfs-tools-master/squashfs-tools/lzip_wrapper.h squashfs-tools-master.new/squashfs-tools/lzip_wrapper.h
646 --- squashfs-tools-master/squashfs-tools/lzip_wrapper.h 1970-01-01 01:00:00.000000000 +0100
647 +++ squashfs-tools-master.new/squashfs-tools/lzip_wrapper.h 2018-06-10 11:22:39.000000000 +0200
648 @@ -0,0 +1,58 @@
649 +#ifndef LZIP_WRAPPER_H
650 +#define LZIP_WRAPPER_H
652 + * Squashfs
654 + * Copyright (c) 2014
655 + * Phillip Lougher <phillip@squashfs.org.uk>
656 + * Copyright (C) 2018 Antonio Diaz Diaz
658 + * This program is free software; you can redistribute it and/or
659 + * modify it under the terms of the GNU General Public License
660 + * as published by the Free Software Foundation; either version 2,
661 + * or (at your option) any later version.
663 + * This program is distributed in the hope that it will be useful,
664 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
665 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
666 + * GNU General Public License for more details.
668 + * You should have received a copy of the GNU General Public License
669 + * along with this program; if not, write to the Free Software
670 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
672 + * lzip_wrapper.h
674 + */
676 +#ifndef linux
677 +#define __BYTE_ORDER BYTE_ORDER
678 +#define __BIG_ENDIAN BIG_ENDIAN
679 +#define __LITTLE_ENDIAN LITTLE_ENDIAN
680 +#else
681 +#include <endian.h>
682 +#endif
684 +#if __BYTE_ORDER == __BIG_ENDIAN
685 +extern unsigned int inswap_le32(unsigned int);
687 +#define SQUASHFS_INSWAP_COMP_OPTS(s) { \
688 + (s)->dictionary_size = inswap_le32((s)->dictionary_size); \
690 +#else
691 +#define SQUASHFS_INSWAP_COMP_OPTS(s)
692 +#endif
694 +/* Default compression */
695 +#define LZIP_DEFAULT_COMPRESSION_LEVEL 9
697 +struct lzip_comp_opts {
698 + int32_t dictionary_size;
699 + uint8_t compression_level;
702 +struct lzip_stream {
703 + int dictionary_size;
704 + short match_len_limit;
706 +#endif
707 diff -urdN squashfs-tools-master/squashfs-tools/squashfs_fs.h squashfs-tools-master.new/squashfs-tools/squashfs_fs.h
708 --- squashfs-tools-master/squashfs-tools/squashfs_fs.h 2018-06-12 06:07:02.000000000 +0200
709 +++ squashfs-tools-master.new/squashfs-tools/squashfs_fs.h 2018-07-10 13:27:23.000000000 +0200
710 @@ -282,6 +282,7 @@
711 #define XZ_COMPRESSION 4
712 #define LZ4_COMPRESSION 5
713 #define ZSTD_COMPRESSION 6
714 +#define LZIP_COMPRESSION 7
716 struct squashfs_super_block {
717 unsigned int s_magic;