Joao Marcos Costa | 29da374 | 2020-07-30 15:33:47 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Copyright (C) 2020 Bootlin |
| 4 | * |
| 5 | * Author: Joao Marcos Costa <joaomarcos.costa@bootlin.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef SQFS_DECOMPRESSOR_H |
| 9 | #define SQFS_DECOMPRESSOR_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #define SQFS_COMP_ZLIB 1 |
| 14 | #define SQFS_COMP_LZMA 2 |
| 15 | #define SQFS_COMP_LZO 3 |
| 16 | #define SQFS_COMP_XZ 4 |
| 17 | #define SQFS_COMP_LZ4 5 |
| 18 | #define SQFS_COMP_ZSTD 6 |
| 19 | |
| 20 | /* LZMA does not support any compression options */ |
| 21 | |
| 22 | struct squashfs_gzip_opts { |
| 23 | u32 compression_level; |
| 24 | u16 window_size; |
| 25 | u16 strategies; |
| 26 | }; |
| 27 | |
| 28 | struct squashfs_xz_opts { |
| 29 | u32 dictionary_size; |
| 30 | u32 executable_filters; |
| 31 | }; |
| 32 | |
| 33 | struct squashfs_lz4_opts { |
| 34 | u32 version; |
| 35 | u32 flags; |
| 36 | }; |
| 37 | |
| 38 | struct squashfs_zstd_opts { |
| 39 | u32 compression_level; |
| 40 | }; |
| 41 | |
| 42 | struct squashfs_lzo_opts { |
| 43 | u32 algorithm; |
| 44 | u32 level; |
| 45 | }; |
| 46 | |
| 47 | union squashfs_compression_opts { |
| 48 | struct squashfs_gzip_opts *gzip; |
| 49 | struct squashfs_xz_opts *xz; |
| 50 | struct squashfs_lz4_opts *lz4; |
| 51 | struct squashfs_zstd_opts *zstd; |
| 52 | struct squashfs_lzo_opts *lzo; |
| 53 | }; |
| 54 | |
| 55 | int sqfs_decompress(u16 comp_type, void *dest, unsigned long *dest_len, |
| 56 | void *source, u32 lenp); |
| 57 | |
| 58 | #endif /* SQFS_DECOMPRESSOR_H */ |