patch-2.4.14 linux/fs/cramfs/uncompress.c
Next file: linux/fs/devfs/base.c
Previous file: linux/fs/cramfs/inode.c
Back to the patch index
Back to the overall index
- Lines: 59
- Date:
Thu Oct 25 13:53:53 2001
- Orig file:
v2.4.13/linux/fs/cramfs/uncompress.c
- Orig date:
Sun Oct 1 20:35:16 2000
diff -u --recursive --new-file v2.4.13/linux/fs/cramfs/uncompress.c linux/fs/cramfs/uncompress.c
@@ -16,8 +16,9 @@
*/
#include <linux/kernel.h>
-
-#include "inflate/zlib.h"
+#include <linux/errno.h>
+#include <linux/vmalloc.h>
+#include <linux/zlib_fs.h>
static z_stream stream;
static int initialized;
@@ -33,14 +34,14 @@
stream.next_out = dst;
stream.avail_out = dstlen;
- err = cramfs_inflateReset(&stream);
+ err = zlib_fs_inflateReset(&stream);
if (err != Z_OK) {
- printk("cramfs_inflateReset error %d\n", err);
- cramfs_inflateEnd(&stream);
- cramfs_inflateInit(&stream);
+ printk("zlib_fs_inflateReset error %d\n", err);
+ zlib_fs_inflateEnd(&stream);
+ zlib_fs_inflateInit(&stream);
}
- err = cramfs_inflate(&stream, Z_FINISH);
+ err = zlib_fs_inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END)
goto err;
return stream.total_out;
@@ -54,16 +55,23 @@
int cramfs_uncompress_init(void)
{
if (!initialized++) {
+ stream.workspace = vmalloc(zlib_fs_inflate_workspacesize());
+ if ( !stream.workspace ) {
+ initialized = 0;
+ return -ENOMEM;
+ }
stream.next_in = NULL;
stream.avail_in = 0;
- cramfs_inflateInit(&stream);
+ zlib_fs_inflateInit(&stream);
}
return 0;
}
int cramfs_uncompress_exit(void)
{
- if (!--initialized)
- cramfs_inflateEnd(&stream);
+ if (!--initialized) {
+ zlib_fs_inflateEnd(&stream);
+ vfree(stream.workspace);
+ }
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)