summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/zlib_wrapper.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2009-10-06 04:04:15 +0100
committerPhillip Lougher <phillip@lougher.demon.co.uk>2010-01-20 21:47:47 +0000
commit4c0f0bb2351bee3de8dd7715ee199454a59f1230 (patch)
treec552993587a8e87f7ebc0fe0955efdde94cc8884 /fs/squashfs/zlib_wrapper.c
parentf1a40359f8d8ba073257ed31a513e492621bcbc5 (diff)
downloadlinux-4c0f0bb2351bee3de8dd7715ee199454a59f1230.tar.gz
linux-4c0f0bb2351bee3de8dd7715ee199454a59f1230.tar.bz2
linux-4c0f0bb2351bee3de8dd7715ee199454a59f1230.zip
Squashfs: add a decompressor framework
This adds a decompressor framework which allows multiple compression algorithms to be cleanly supported. Also update zlib wrapper and other code to use the new framework. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'fs/squashfs/zlib_wrapper.c')
-rw-r--r--fs/squashfs/zlib_wrapper.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
index c814594d522e..4dd70e04333b 100644
--- a/fs/squashfs/zlib_wrapper.c
+++ b/fs/squashfs/zlib_wrapper.c
@@ -30,8 +30,9 @@
#include "squashfs_fs_sb.h"
#include "squashfs_fs_i.h"
#include "squashfs.h"
+#include "decompressor.h"
-void *squashfs_zlib_init()
+static void *zlib_init(struct squashfs_sb_info *dummy)
{
z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
if (stream == NULL)
@@ -50,7 +51,7 @@ failed:
}
-void squashfs_zlib_free(void *strm)
+static void zlib_free(void *strm)
{
z_stream *stream = strm;
@@ -60,7 +61,7 @@ void squashfs_zlib_free(void *strm)
}
-int squashfs_zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
+static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
struct buffer_head **bh, int b, int offset, int length, int srclength,
int pages)
{
@@ -137,3 +138,13 @@ release_mutex:
return -EIO;
}
+
+const struct squashfs_decompressor squashfs_zlib_comp_ops = {
+ .init = zlib_init,
+ .free = zlib_free,
+ .decompress = zlib_uncompress,
+ .id = ZLIB_COMPRESSION,
+ .name = "zlib",
+ .supported = 1
+};
+