mmc: msm: fix compile error on MSM7x30
[safe/jmp/linux-2.6] / fs / squashfs / zlib_wrapper.c
index c814594..7a60387 100644 (file)
 
 #include <linux/mutex.h>
 #include <linux/buffer_head.h>
+#include <linux/slab.h>
 #include <linux/zlib.h>
 
 #include "squashfs_fs.h"
 #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 +52,7 @@ failed:
 }
 
 
-void squashfs_zlib_free(void *strm)
+static void zlib_free(void *strm)
 {
        z_stream *stream = strm;
 
@@ -60,7 +62,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)
 {
@@ -126,8 +128,9 @@ int squashfs_zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
                goto release_mutex;
        }
 
+       length = stream->total_out;
        mutex_unlock(&msblk->read_data_mutex);
-       return stream->total_out;
+       return length;
 
 release_mutex:
        mutex_unlock(&msblk->read_data_mutex);
@@ -137,3 +140,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
+};
+