Thomas Gleixner | 68252eb | 2019-05-20 19:08:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 2 | #ifndef DECOMPRESSOR_H |
| 3 | #define DECOMPRESSOR_H |
| 4 | /* |
| 5 | * Squashfs - a compressed read only filesystem for Linux |
| 6 | * |
| 7 | * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
Phillip Lougher | d7f2ff6 | 2011-05-26 10:39:56 +0100 | [diff] [blame] | 8 | * Phillip Lougher <phillip@squashfs.org.uk> |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 9 | * |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 10 | * decompressor.h |
| 11 | */ |
| 12 | |
| 13 | struct squashfs_decompressor { |
Phillip Lougher | 9508c6b | 2013-11-13 02:56:26 +0000 | [diff] [blame] | 14 | void *(*init)(struct squashfs_sb_info *, void *); |
| 15 | void *(*comp_opts)(struct squashfs_sb_info *, void *, int); |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 16 | void (*free)(void *); |
Phillip Lougher | 846b730 | 2013-11-18 02:59:12 +0000 | [diff] [blame] | 17 | int (*decompress)(struct squashfs_sb_info *, void *, |
| 18 | struct buffer_head **, int, int, int, |
| 19 | struct squashfs_page_actor *); |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 20 | int id; |
| 21 | char *name; |
| 22 | int supported; |
| 23 | }; |
| 24 | |
Phillip Lougher | 9508c6b | 2013-11-13 02:56:26 +0000 | [diff] [blame] | 25 | static inline void *squashfs_comp_opts(struct squashfs_sb_info *msblk, |
| 26 | void *buff, int length) |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 27 | { |
Phillip Lougher | 9508c6b | 2013-11-13 02:56:26 +0000 | [diff] [blame] | 28 | return msblk->decompressor->comp_opts ? |
| 29 | msblk->decompressor->comp_opts(msblk, buff, length) : NULL; |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 30 | } |
Phillip Lougher | 7a43ae5 | 2010-12-09 02:08:31 +0000 | [diff] [blame] | 31 | |
| 32 | #ifdef CONFIG_SQUASHFS_XZ |
| 33 | extern const struct squashfs_decompressor squashfs_xz_comp_ops; |
| 34 | #endif |
| 35 | |
Phillip Lougher | 6242164 | 2014-11-27 18:48:44 +0000 | [diff] [blame] | 36 | #ifdef CONFIG_SQUASHFS_LZ4 |
| 37 | extern const struct squashfs_decompressor squashfs_lz4_comp_ops; |
| 38 | #endif |
| 39 | |
Phillip Lougher | 01a678c | 2011-01-05 18:23:53 +0000 | [diff] [blame] | 40 | #ifdef CONFIG_SQUASHFS_LZO |
| 41 | extern const struct squashfs_decompressor squashfs_lzo_comp_ops; |
| 42 | #endif |
| 43 | |
Phillip Lougher | cc6d349 | 2011-07-22 03:01:28 +0100 | [diff] [blame] | 44 | #ifdef CONFIG_SQUASHFS_ZLIB |
| 45 | extern const struct squashfs_decompressor squashfs_zlib_comp_ops; |
| 46 | #endif |
| 47 | |
Sean Purcell | 87bf54b | 2017-08-09 19:42:36 -0700 | [diff] [blame] | 48 | #ifdef CONFIG_SQUASHFS_ZSTD |
| 49 | extern const struct squashfs_decompressor squashfs_zstd_comp_ops; |
| 50 | #endif |
| 51 | |
Phillip Lougher | 4c0f0bb | 2009-10-06 04:04:15 +0100 | [diff] [blame] | 52 | #endif |