1 Index: linux-2.6.23-rc6/fs/squashfs/inode.c
2 ===================================================================
3 --- linux-2.6.23-rc6.orig/fs/squashfs/inode.c 2007-09-21 16:23:55.000000000 +0800
4 +++ linux-2.6.23-rc6/fs/squashfs/inode.c 2007-09-21 16:23:56.000000000 +0800
6 * Copyright (c) 2002, 2003, 2004, 2005, 2006
7 * Phillip Lougher <phillip@lougher.org.uk>
9 + * LZMA decompressor support added by Oleg I. Vdovikin
10 + * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2,
19 +#define SQUASHFS_LZMA
20 #include <linux/types.h>
21 #include <linux/squashfs_fs.h>
22 #include <linux/module.h>
28 +#include <linux/LzmaDecode.h>
30 +/* default LZMA settings, should be in sync with mksquashfs */
35 +#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
36 + (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
40 static void squashfs_put_super(struct super_block *);
41 static int squashfs_statfs(struct dentry *, struct kstatfs *);
42 static int squashfs_symlink_readpage(struct file *file, struct page *page);
44 const char *, void *, struct vfsmount *);
48 +static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
50 static z_stream stream;
53 static struct file_system_type squashfs_fs_type = {
60 + if ((zlib_err = LzmaDecode(lzma_workspace,
61 + LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
62 + c_buffer, c_byte, buffer, msblk->read_size, &bytes)) != LZMA_RESULT_OK)
64 + ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
68 stream.next_in = c_buffer;
69 stream.avail_in = c_byte;
70 stream.next_out = buffer;
74 bytes = stream.total_out;
77 up(&msblk->read_data_mutex);
80 @@ -2045,15 +2075,19 @@
81 printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
84 +#ifndef SQUASHFS_LZMA
85 if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
86 ERROR("Failed to allocate zlib workspace\n");
93 if ((err = register_filesystem(&squashfs_fs_type))) {
94 +#ifndef SQUASHFS_LZMA
95 vfree(stream.workspace);
100 @@ -2064,7 +2098,9 @@
102 static void __exit exit_squashfs_fs(void)
104 +#ifndef SQUASHFS_LZMA
105 vfree(stream.workspace);
107 unregister_filesystem(&squashfs_fs_type);
108 destroy_inodecache();