diff options
author | Phillip Lougher <phillip@lougher.demon.co.uk> | 2009-10-05 23:04:15 -0400 |
---|---|---|
committer | Phillip Lougher <phillip@lougher.demon.co.uk> | 2010-01-20 16:47:47 -0500 |
commit | 4c0f0bb2351bee3de8dd7715ee199454a59f1230 (patch) | |
tree | c552993587a8e87f7ebc0fe0955efdde94cc8884 /fs/squashfs/zlib_wrapper.c | |
parent | f1a40359f8d8ba073257ed31a513e492621bcbc5 (diff) |
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.c | 17 |
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 @@ | |||
30 | #include "squashfs_fs_sb.h" | 30 | #include "squashfs_fs_sb.h" |
31 | #include "squashfs_fs_i.h" | 31 | #include "squashfs_fs_i.h" |
32 | #include "squashfs.h" | 32 | #include "squashfs.h" |
33 | #include "decompressor.h" | ||
33 | 34 | ||
34 | void *squashfs_zlib_init() | 35 | static void *zlib_init(struct squashfs_sb_info *dummy) |
35 | { | 36 | { |
36 | z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); | 37 | z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL); |
37 | if (stream == NULL) | 38 | if (stream == NULL) |
@@ -50,7 +51,7 @@ failed: | |||
50 | } | 51 | } |
51 | 52 | ||
52 | 53 | ||
53 | void squashfs_zlib_free(void *strm) | 54 | static void zlib_free(void *strm) |
54 | { | 55 | { |
55 | z_stream *stream = strm; | 56 | z_stream *stream = strm; |
56 | 57 | ||
@@ -60,7 +61,7 @@ void squashfs_zlib_free(void *strm) | |||
60 | } | 61 | } |
61 | 62 | ||
62 | 63 | ||
63 | int squashfs_zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, | 64 | static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, |
64 | struct buffer_head **bh, int b, int offset, int length, int srclength, | 65 | struct buffer_head **bh, int b, int offset, int length, int srclength, |
65 | int pages) | 66 | int pages) |
66 | { | 67 | { |
@@ -137,3 +138,13 @@ release_mutex: | |||
137 | 138 | ||
138 | return -EIO; | 139 | return -EIO; |
139 | } | 140 | } |
141 | |||
142 | const struct squashfs_decompressor squashfs_zlib_comp_ops = { | ||
143 | .init = zlib_init, | ||
144 | .free = zlib_free, | ||
145 | .decompress = zlib_uncompress, | ||
146 | .id = ZLIB_COMPRESSION, | ||
147 | .name = "zlib", | ||
148 | .supported = 1 | ||
149 | }; | ||
150 | |||