xref: /openbmc/linux/fs/squashfs/decompressor.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
168252eb5SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
24c0f0bb2SPhillip Lougher #ifndef DECOMPRESSOR_H
34c0f0bb2SPhillip Lougher #define DECOMPRESSOR_H
44c0f0bb2SPhillip Lougher /*
54c0f0bb2SPhillip Lougher  * Squashfs - a compressed read only filesystem for Linux
64c0f0bb2SPhillip Lougher  *
74c0f0bb2SPhillip Lougher  * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
8d7f2ff67SPhillip Lougher  * Phillip Lougher <phillip@squashfs.org.uk>
94c0f0bb2SPhillip Lougher  *
104c0f0bb2SPhillip Lougher  * decompressor.h
114c0f0bb2SPhillip Lougher  */
124c0f0bb2SPhillip Lougher 
1393e72b3cSPhilippe Liard #include <linux/bio.h>
1493e72b3cSPhilippe Liard 
154c0f0bb2SPhillip Lougher struct squashfs_decompressor {
169508c6b9SPhillip Lougher 	void	*(*init)(struct squashfs_sb_info *, void *);
179508c6b9SPhillip Lougher 	void	*(*comp_opts)(struct squashfs_sb_info *, void *, int);
184c0f0bb2SPhillip Lougher 	void	(*free)(void *);
19846b730eSPhillip Lougher 	int	(*decompress)(struct squashfs_sb_info *, void *,
2093e72b3cSPhilippe Liard 		struct bio *, int, int, struct squashfs_page_actor *);
214c0f0bb2SPhillip Lougher 	int	id;
224c0f0bb2SPhillip Lougher 	char	*name;
23*f268eeddSPhillip Lougher 	int	alloc_buffer;
244c0f0bb2SPhillip Lougher 	int	supported;
254c0f0bb2SPhillip Lougher };
264c0f0bb2SPhillip Lougher 
squashfs_comp_opts(struct squashfs_sb_info * msblk,void * buff,int length)279508c6b9SPhillip Lougher static inline void *squashfs_comp_opts(struct squashfs_sb_info *msblk,
289508c6b9SPhillip Lougher 							void *buff, int length)
294c0f0bb2SPhillip Lougher {
309508c6b9SPhillip Lougher 	return msblk->decompressor->comp_opts ?
319508c6b9SPhillip Lougher 		msblk->decompressor->comp_opts(msblk, buff, length) : NULL;
324c0f0bb2SPhillip Lougher }
337a43ae52SPhillip Lougher 
347a43ae52SPhillip Lougher #ifdef CONFIG_SQUASHFS_XZ
357a43ae52SPhillip Lougher extern const struct squashfs_decompressor squashfs_xz_comp_ops;
367a43ae52SPhillip Lougher #endif
377a43ae52SPhillip Lougher 
3862421645SPhillip Lougher #ifdef CONFIG_SQUASHFS_LZ4
3962421645SPhillip Lougher extern const struct squashfs_decompressor squashfs_lz4_comp_ops;
4062421645SPhillip Lougher #endif
4162421645SPhillip Lougher 
4201a678c5SPhillip Lougher #ifdef CONFIG_SQUASHFS_LZO
4301a678c5SPhillip Lougher extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
4401a678c5SPhillip Lougher #endif
4501a678c5SPhillip Lougher 
46cc6d3497SPhillip Lougher #ifdef CONFIG_SQUASHFS_ZLIB
47cc6d3497SPhillip Lougher extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
48cc6d3497SPhillip Lougher #endif
49cc6d3497SPhillip Lougher 
5087bf54bbSSean Purcell #ifdef CONFIG_SQUASHFS_ZSTD
5187bf54bbSSean Purcell extern const struct squashfs_decompressor squashfs_zstd_comp_ops;
5287bf54bbSSean Purcell #endif
5387bf54bbSSean Purcell 
544c0f0bb2SPhillip Lougher #endif
55