162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci#ifndef DECOMPRESSOR_H
362306a36Sopenharmony_ci#define DECOMPRESSOR_H
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * Squashfs - a compressed read only filesystem for Linux
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
862306a36Sopenharmony_ci * Phillip Lougher <phillip@squashfs.org.uk>
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * decompressor.h
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/bio.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct squashfs_decompressor {
1662306a36Sopenharmony_ci	void	*(*init)(struct squashfs_sb_info *, void *);
1762306a36Sopenharmony_ci	void	*(*comp_opts)(struct squashfs_sb_info *, void *, int);
1862306a36Sopenharmony_ci	void	(*free)(void *);
1962306a36Sopenharmony_ci	int	(*decompress)(struct squashfs_sb_info *, void *,
2062306a36Sopenharmony_ci		struct bio *, int, int, struct squashfs_page_actor *);
2162306a36Sopenharmony_ci	int	id;
2262306a36Sopenharmony_ci	char	*name;
2362306a36Sopenharmony_ci	int	alloc_buffer;
2462306a36Sopenharmony_ci	int	supported;
2562306a36Sopenharmony_ci};
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistatic inline void *squashfs_comp_opts(struct squashfs_sb_info *msblk,
2862306a36Sopenharmony_ci							void *buff, int length)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	return msblk->decompressor->comp_opts ?
3162306a36Sopenharmony_ci		msblk->decompressor->comp_opts(msblk, buff, length) : NULL;
3262306a36Sopenharmony_ci}
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#ifdef CONFIG_SQUASHFS_XZ
3562306a36Sopenharmony_ciextern const struct squashfs_decompressor squashfs_xz_comp_ops;
3662306a36Sopenharmony_ci#endif
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#ifdef CONFIG_SQUASHFS_LZ4
3962306a36Sopenharmony_ciextern const struct squashfs_decompressor squashfs_lz4_comp_ops;
4062306a36Sopenharmony_ci#endif
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#ifdef CONFIG_SQUASHFS_LZO
4362306a36Sopenharmony_ciextern const struct squashfs_decompressor squashfs_lzo_comp_ops;
4462306a36Sopenharmony_ci#endif
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#ifdef CONFIG_SQUASHFS_ZLIB
4762306a36Sopenharmony_ciextern const struct squashfs_decompressor squashfs_zlib_comp_ops;
4862306a36Sopenharmony_ci#endif
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#ifdef CONFIG_SQUASHFS_ZSTD
5162306a36Sopenharmony_ciextern const struct squashfs_decompressor squashfs_zstd_comp_ops;
5262306a36Sopenharmony_ci#endif
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#endif
55