blob: 1b9ccfd0aa519bff549d9da24cd04d7a130e3e12 [file] [log] [blame]
Thomas Gleixner68252eb2019-05-20 19:08:00 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +01002#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 Lougherd7f2ff62011-05-26 10:39:56 +01008 * Phillip Lougher <phillip@squashfs.org.uk>
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +01009 *
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010010 * decompressor.h
11 */
12
Philippe Liard93e72b32020-06-01 21:45:23 -070013#include <linux/bio.h>
14
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010015struct squashfs_decompressor {
Phillip Lougher9508c6b2013-11-13 02:56:26 +000016 void *(*init)(struct squashfs_sb_info *, void *);
17 void *(*comp_opts)(struct squashfs_sb_info *, void *, int);
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010018 void (*free)(void *);
Phillip Lougher846b7302013-11-18 02:59:12 +000019 int (*decompress)(struct squashfs_sb_info *, void *,
Philippe Liard93e72b32020-06-01 21:45:23 -070020 struct bio *, int, int, struct squashfs_page_actor *);
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010021 int id;
22 char *name;
23 int supported;
24};
25
Phillip Lougher9508c6b2013-11-13 02:56:26 +000026static inline void *squashfs_comp_opts(struct squashfs_sb_info *msblk,
27 void *buff, int length)
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010028{
Phillip Lougher9508c6b2013-11-13 02:56:26 +000029 return msblk->decompressor->comp_opts ?
30 msblk->decompressor->comp_opts(msblk, buff, length) : NULL;
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010031}
Phillip Lougher7a43ae52010-12-09 02:08:31 +000032
33#ifdef CONFIG_SQUASHFS_XZ
34extern const struct squashfs_decompressor squashfs_xz_comp_ops;
35#endif
36
Phillip Lougher62421642014-11-27 18:48:44 +000037#ifdef CONFIG_SQUASHFS_LZ4
38extern const struct squashfs_decompressor squashfs_lz4_comp_ops;
39#endif
40
Phillip Lougher01a678c2011-01-05 18:23:53 +000041#ifdef CONFIG_SQUASHFS_LZO
42extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
43#endif
44
Phillip Loughercc6d3492011-07-22 03:01:28 +010045#ifdef CONFIG_SQUASHFS_ZLIB
46extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
47#endif
48
Sean Purcell87bf54b2017-08-09 19:42:36 -070049#ifdef CONFIG_SQUASHFS_ZSTD
50extern const struct squashfs_decompressor squashfs_zstd_comp_ops;
51#endif
52
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010053#endif