20#ifndef SQFS_COMPRESSOR_H
21#define SQFS_COMPRESSOR_H
93 sqfs_u32 size, sqfs_u8 *out, sqfs_u32 outsize);
232 SQFS_COMP_FLAG_LZ4_ALL = 0x0001,
243 SQFS_COMP_FLAG_LZMA_ALL = 0x0001,
280 SQFS_COMP_FLAG_XZ_ALL = 0x013F,
306 SQFS_COMP_FLAG_GZIP_ALL = 0x001F,
313 SQFS_COMP_FLAG_GENERIC_ALL = 0x8000,
329#define SQFS_GZIP_DEFAULT_LEVEL (9)
330#define SQFS_GZIP_DEFAULT_WINDOW (15)
332#define SQFS_LZO_DEFAULT_ALG SQFS_LZO1X_999
333#define SQFS_LZO_DEFAULT_LEVEL (8)
335#define SQFS_ZSTD_DEFAULT_LEVEL (15)
337#define SQFS_GZIP_MIN_LEVEL (1)
338#define SQFS_GZIP_MAX_LEVEL (9)
340#define SQFS_LZO_MIN_LEVEL (0)
341#define SQFS_LZO_MAX_LEVEL (9)
343#define SQFS_ZSTD_MIN_LEVEL (1)
344#define SQFS_ZSTD_MAX_LEVEL (22)
346#define SQFS_GZIP_MIN_WINDOW (8)
347#define SQFS_GZIP_MAX_WINDOW (15)
349#define SQFS_XZ_MIN_LEVEL (0)
350#define SQFS_XZ_MAX_LEVEL (9)
351#define SQFS_XZ_DEFAULT_LEVEL (6)
353#define SQFS_XZ_MIN_LC 0
354#define SQFS_XZ_MAX_LC 4
355#define SQFS_XZ_DEFAULT_LC 3
357#define SQFS_XZ_MIN_LP 0
358#define SQFS_XZ_MAX_LP 4
359#define SQFS_XZ_DEFAULT_LP 0
361#define SQFS_XZ_MIN_PB 0
362#define SQFS_XZ_MAX_PB 4
363#define SQFS_XZ_DEFAULT_PB 2
365#define SQFS_LZMA_MIN_LEVEL (0)
366#define SQFS_LZMA_MAX_LEVEL (9)
367#define SQFS_LZMA_DEFAULT_LEVEL (5)
369#define SQFS_LZMA_MIN_LC 0
370#define SQFS_LZMA_MAX_LC 4
371#define SQFS_LZMA_DEFAULT_LC 3
373#define SQFS_LZMA_MIN_LP 0
374#define SQFS_LZMA_MAX_LP 4
375#define SQFS_LZMA_DEFAULT_LP 0
377#define SQFS_LZMA_MIN_PB 0
378#define SQFS_LZMA_MAX_PB 4
379#define SQFS_LZMA_DEFAULT_PB 2
381#define SQFS_LZMA_MIN_DICT_SIZE SQFS_META_BLOCK_SIZE
382#define SQFS_LZMA_MAX_DICT_SIZE SQFS_MAX_BLOCK_SIZE
384#define SQFS_XZ_MIN_DICT_SIZE SQFS_META_BLOCK_SIZE
385#define SQFS_XZ_MAX_DICT_SIZE SQFS_MAX_BLOCK_SIZE
407 size_t block_size, sqfs_u16 flags);
SQFS_COMP_FLAG
Flags for configuring the compressor.
@ SQFS_COMP_FLAG_XZ_SPARC
For XZ, set this to select the Sparc BCJ filter.
@ SQFS_COMP_FLAG_UNCOMPRESS
Set this if the compressor should actually extract instead of compress data.
@ SQFS_COMP_FLAG_LZMA_EXTREME
Tell the LZMAv1 compressor to try the "extreme" option.
@ SQFS_COMP_FLAG_GZIP_HUFFMAN
For zlib deflate, set this to try the huffman only strategy.
@ SQFS_COMP_FLAG_GZIP_DEFAULT
For zlib deflate, set this to try the default strategy.
@ SQFS_COMP_FLAG_GZIP_FILTERED
For zlib deflate, set this to try the "filtered" strategy.
@ SQFS_COMP_FLAG_XZ_POWERPC
For XZ, set this to select the PowerPC BCJ filter.
@ SQFS_COMP_FLAG_XZ_ARM
For XZ, set this to select the ARM BCJ filter.
@ SQFS_COMP_FLAG_GZIP_RLE
For zlib deflate, set this to try the RLE strategy.
@ SQFS_COMP_FLAG_XZ_IA64
For XZ, set this to select the Itanium BCJ filter.
@ SQFS_COMP_FLAG_XZ_X86
For XZ, set this to select the x86 BCJ filter.
@ SQFS_COMP_FLAG_GZIP_FIXED
For zlib deflate, set this to try the fixed strategy.
@ SQFS_COMP_FLAG_LZ4_HC
For LZ4, set this to use high compression mode.
@ SQFS_COMP_FLAG_XZ_EXTREME
Tell the XZ compressor to try the "extreme" option.
@ SQFS_COMP_FLAG_XZ_ARMTHUMB
For XZ, set this to select the ARM Thumb BCJ filter.
SQFS_API int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg, SQFS_COMPRESSOR id, size_t block_size, sqfs_u16 flags)
Initialize a compressor configuration.
SQFS_API int sqfs_compressor_id_from_name(const char *name)
Get the compressor ID using just the name of the backend.
SQFS_LZO_ALGORITHM
The available LZO algorithms.
SQFS_API int sqfs_compressor_create(const sqfs_compressor_config_t *cfg, sqfs_compressor_t **out)
Create an instance of a compressor implementation.
SQFS_API const char * sqfs_compressor_name_from_id(SQFS_COMPRESSOR id)
Get the name of a compressor backend from its ID.
Includes forward declarations of data structures, macros and integer types.
Configuration parameters for instantiating a compressor backend.
sqfs_u16 algorithm
Which variant of lzo should be used.
struct sqfs_compressor_config_t::@0::@1 gzip
Options for the zlib compressor.
sqfs_u32 dict_size
LZMA dictionary size.
sqfs_u16 window_size
Deflate window size. Value between 8 and 15.
struct sqfs_compressor_config_t::@0::@3 xz
Options for the LZMA and XZ (LZMA v2) compressors.
struct sqfs_compressor_config_t::@0::@2 lzo
Options for the lzo compressor.
sqfs_u8 pb
Number of position bits.
sqfs_u16 flags
A combination of SQFS_COMP_FLAG flags.
sqfs_u8 lp
Number of literal position bits.
sqfs_u32 level
Compression level.
sqfs_u8 lc
Number of literal context bits.
sqfs_u16 id
An SQFS_COMPRESSOR identifier.
sqfs_u32 block_size
The intended data block size.
union sqfs_compressor_config_t::@0 opt
Backend specific options for fine tuing.
Encapsultes a compressor with a simple interface to compress or extract chunks of data.
sqfs_s32(* do_block)(sqfs_compressor_t *cmp, const sqfs_u8 *in, sqfs_u32 size, sqfs_u8 *out, sqfs_u32 outsize)
Compress or uncompress a chunk of data.
int(* read_options)(sqfs_compressor_t *cmp, sqfs_file_t *file)
Read compressor options from disk.
void(* get_configuration)(const sqfs_compressor_t *cmp, sqfs_compressor_config_t *cfg)
Get the current compressor configuration.
int(* write_options)(sqfs_compressor_t *cmp, sqfs_file_t *file)
Write compressor options to disk if non-default settings have been used.
Abstracts file I/O to make it easy to embedd SquashFS.
Base interface for all libsquashfs in-memory data structures.
Contains on-disk data structures, identifiers and functions for the SquashFS super block.
SQFS_COMPRESSOR
Set in sqfs_super_t to identify the compresser used by the filesystem.