1 diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inode.c
2 --- linux-2.6.19.old/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
3 +++ linux-2.6.19.dev/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
5 * Copyright (c) 2002, 2003, 2004, 2005, 2006
6 * Phillip Lougher <phillip@lougher.org.uk>
8 + * LZMA decompressor support added by Oleg I. Vdovikin
9 + * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2,
18 +#define SQUASHFS_LZMA
19 #include <linux/types.h>
20 #include <linux/squashfs_fs.h>
21 #include <linux/module.h>
27 +#include <linux/LzmaDecode.h>
29 +/* default LZMA settings, should be in sync with mksquashfs */
34 +#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
35 + (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
39 static void squashfs_put_super(struct super_block *);
40 static int squashfs_statfs(struct dentry *, struct kstatfs *);
41 static int squashfs_symlink_readpage(struct file *file, struct page *page);
43 const char *, void *, struct vfsmount *);
47 +static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
49 static z_stream stream;
52 static struct file_system_type squashfs_fs_type = {
59 + if ((zlib_err = LzmaDecode(lzma_workspace,
60 + LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
61 + c_buffer, c_byte, buffer, msblk->read_size, &bytes)) != LZMA_RESULT_OK)
63 + ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
67 stream.next_in = c_buffer;
68 stream.avail_in = c_byte;
69 stream.next_out = buffer;
73 bytes = stream.total_out;
76 up(&msblk->read_data_mutex);
79 @@ -2045,15 +2075,19 @@
80 printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
83 +#ifndef SQUASHFS_LZMA
84 if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
85 ERROR("Failed to allocate zlib workspace\n");
92 if ((err = register_filesystem(&squashfs_fs_type))) {
93 +#ifndef SQUASHFS_LZMA
94 vfree(stream.workspace);
101 static void __exit exit_squashfs_fs(void)
103 +#ifndef SQUASHFS_LZMA
104 vfree(stream.workspace);
106 unregister_filesystem(&squashfs_fs_type);
107 destroy_inodecache();