blob: 330073e29029950238da75d90fbd86a9dc8c881a [file] [log] [blame]
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +01001#ifndef DECOMPRESSOR_H
2#define DECOMPRESSOR_H
3/*
4 * Squashfs - a compressed read only filesystem for Linux
5 *
6 * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Phillip Lougherd7f2ff62011-05-26 10:39:56 +01007 * Phillip Lougher <phillip@squashfs.org.uk>
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +01008 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2,
12 * or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 *
23 * decompressor.h
24 */
25
26struct squashfs_decompressor {
Phillip Lougherb7fc0ff2011-02-28 01:45:42 +000027 void *(*init)(struct squashfs_sb_info *, void *, int);
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010028 void (*free)(void *);
29 int (*decompress)(struct squashfs_sb_info *, void **,
30 struct buffer_head **, int, int, int, int, int);
31 int id;
32 char *name;
33 int supported;
34};
35
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010036static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk,
37 void *s)
38{
39 if (msblk->decompressor)
40 msblk->decompressor->free(s);
41}
42
43static inline int squashfs_decompress(struct squashfs_sb_info *msblk,
44 void **buffer, struct buffer_head **bh, int b, int offset, int length,
45 int srclength, int pages)
46{
47 return msblk->decompressor->decompress(msblk, buffer, bh, b, offset,
48 length, srclength, pages);
49}
Phillip Lougher7a43ae52010-12-09 02:08:31 +000050
51#ifdef CONFIG_SQUASHFS_XZ
52extern const struct squashfs_decompressor squashfs_xz_comp_ops;
53#endif
54
Phillip Lougher01a678c2011-01-05 18:23:53 +000055#ifdef CONFIG_SQUASHFS_LZO
56extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
57#endif
58
Phillip Loughercc6d3492011-07-22 03:01:28 +010059#ifdef CONFIG_SQUASHFS_ZLIB
60extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
61#endif
62
Phillip Lougher4c0f0bb2009-10-06 04:04:15 +010063#endif