kernel: reorganize 2.6.37 patches
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.37 / 520-squashfs_revert_to_2.6.35.patch
1 --- a/fs/squashfs/decompressor.c
2 +++ b/fs/squashfs/decompressor.c
3 @@ -40,11 +40,9 @@ static const struct squashfs_decompresso
4 NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0
5 };
6
7 -#ifndef CONFIG_SQUASHFS_LZO
8 static const struct squashfs_decompressor squashfs_lzo_unsupported_comp_ops = {
9 NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0
10 };
11 -#endif
12
13 static const struct squashfs_decompressor squashfs_unknown_comp_ops = {
14 NULL, NULL, NULL, 0, "unknown", 0
15 @@ -53,11 +51,7 @@ static const struct squashfs_decompresso
16 static const struct squashfs_decompressor *decompressor[] = {
17 &squashfs_zlib_comp_ops,
18 &squashfs_lzma_unsupported_comp_ops,
19 -#ifdef CONFIG_SQUASHFS_LZO
20 - &squashfs_lzo_comp_ops,
21 -#else
22 &squashfs_lzo_unsupported_comp_ops,
23 -#endif
24 &squashfs_unknown_comp_ops
25 };
26
27 --- a/fs/squashfs/Kconfig
28 +++ b/fs/squashfs/Kconfig
29 @@ -5,13 +5,13 @@ config SQUASHFS
30 help
31 Saying Y here includes support for SquashFS 4.0 (a Compressed
32 Read-Only File System). Squashfs is a highly compressed read-only
33 - filesystem for Linux. It uses zlib/lzo compression to compress both
34 + filesystem for Linux. It uses zlib compression to compress both
35 files, inodes and directories. Inodes in the system are very small
36 and all blocks are packed to minimise data overhead. Block sizes
37 greater than 4K are supported up to a maximum of 1 Mbytes (default
38 block size 128K). SquashFS 4.0 supports 64 bit filesystems and files
39 (larger than 4GB), full uid/gid information, hard links and
40 - timestamps.
41 + timestamps.
42
43 Squashfs is intended for general read-only filesystem use, for
44 archival use (i.e. in cases where a .tar.gz file may be used), and in
45 @@ -26,7 +26,7 @@ config SQUASHFS
46
47 If unsure, say N.
48
49 -config SQUASHFS_XATTR
50 +config SQUASHFS_XATTRS
51 bool "Squashfs XATTR support"
52 depends on SQUASHFS
53 default n
54 @@ -37,24 +37,9 @@ config SQUASHFS_XATTR
55
56 If unsure, say N.
57
58 -config SQUASHFS_LZO
59 - bool "Include support for LZO compressed file systems"
60 - depends on SQUASHFS
61 - default n
62 - select LZO_DECOMPRESS
63 - help
64 - Saying Y here includes support for reading Squashfs file systems
65 - compressed with LZO compresssion. LZO compression is mainly
66 - aimed at embedded systems with slower CPUs where the overheads
67 - of zlib are too high.
68 -
69 - LZO is not the standard compression used in Squashfs and so most
70 - file systems will be readable without selecting this option.
71 -
72 - If unsure, say N.
73 -
74 config SQUASHFS_EMBEDDED
75 - bool "Additional option for memory-constrained systems"
76 +
77 + bool "Additional option for memory-constrained systems"
78 depends on SQUASHFS
79 default n
80 help
81 --- a/fs/squashfs/lzo_wrapper.c
82 +++ /dev/null
83 @@ -1,136 +0,0 @@
84 -/*
85 - * Squashfs - a compressed read only filesystem for Linux
86 - *
87 - * Copyright (c) 2010 LG Electronics
88 - * Chan Jeong <chan.jeong@lge.com>
89 - *
90 - * This program is free software; you can redistribute it and/or
91 - * modify it under the terms of the GNU General Public License
92 - * as published by the Free Software Foundation; either version 2,
93 - * or (at your option) any later version.
94 - *
95 - * This program is distributed in the hope that it will be useful,
96 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
97 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 - * GNU General Public License for more details.
99 - *
100 - * You should have received a copy of the GNU General Public License
101 - * along with this program; if not, write to the Free Software
102 - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
103 - *
104 - * lzo_wrapper.c
105 - */
106 -
107 -#include <linux/mutex.h>
108 -#include <linux/buffer_head.h>
109 -#include <linux/slab.h>
110 -#include <linux/vmalloc.h>
111 -#include <linux/lzo.h>
112 -
113 -#include "squashfs_fs.h"
114 -#include "squashfs_fs_sb.h"
115 -#include "squashfs_fs_i.h"
116 -#include "squashfs.h"
117 -#include "decompressor.h"
118 -
119 -struct squashfs_lzo {
120 - void *input;
121 - void *output;
122 -};
123 -
124 -static void *lzo_init(struct squashfs_sb_info *msblk)
125 -{
126 - int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
127 -
128 - struct squashfs_lzo *stream = kzalloc(sizeof(*stream), GFP_KERNEL);
129 - if (stream == NULL)
130 - goto failed;
131 - stream->input = vmalloc(block_size);
132 - if (stream->input == NULL)
133 - goto failed;
134 - stream->output = vmalloc(block_size);
135 - if (stream->output == NULL)
136 - goto failed2;
137 -
138 - return stream;
139 -
140 -failed2:
141 - vfree(stream->input);
142 -failed:
143 - ERROR("Failed to allocate lzo workspace\n");
144 - kfree(stream);
145 - return NULL;
146 -}
147 -
148 -
149 -static void lzo_free(void *strm)
150 -{
151 - struct squashfs_lzo *stream = strm;
152 -
153 - if (stream) {
154 - vfree(stream->input);
155 - vfree(stream->output);
156 - }
157 - kfree(stream);
158 -}
159 -
160 -
161 -static int lzo_uncompress(struct squashfs_sb_info *msblk, void **buffer,
162 - struct buffer_head **bh, int b, int offset, int length, int srclength,
163 - int pages)
164 -{
165 - struct squashfs_lzo *stream = msblk->stream;
166 - void *buff = stream->input;
167 - int avail, i, bytes = length, res;
168 - size_t out_len = srclength;
169 -
170 - mutex_lock(&msblk->read_data_mutex);
171 -
172 - for (i = 0; i < b; i++) {
173 - wait_on_buffer(bh[i]);
174 - if (!buffer_uptodate(bh[i]))
175 - goto block_release;
176 -
177 - avail = min(bytes, msblk->devblksize - offset);
178 - memcpy(buff, bh[i]->b_data + offset, avail);
179 - buff += avail;
180 - bytes -= avail;
181 - offset = 0;
182 - put_bh(bh[i]);
183 - }
184 -
185 - res = lzo1x_decompress_safe(stream->input, (size_t)length,
186 - stream->output, &out_len);
187 - if (res != LZO_E_OK)
188 - goto failed;
189 -
190 - res = bytes = (int)out_len;
191 - for (i = 0, buff = stream->output; bytes && i < pages; i++) {
192 - avail = min_t(int, bytes, PAGE_CACHE_SIZE);
193 - memcpy(buffer[i], buff, avail);
194 - buff += avail;
195 - bytes -= avail;
196 - }
197 -
198 - mutex_unlock(&msblk->read_data_mutex);
199 - return res;
200 -
201 -block_release:
202 - for (; i < b; i++)
203 - put_bh(bh[i]);
204 -
205 -failed:
206 - mutex_unlock(&msblk->read_data_mutex);
207 -
208 - ERROR("lzo decompression failed, data probably corrupt\n");
209 - return -EIO;
210 -}
211 -
212 -const struct squashfs_decompressor squashfs_lzo_comp_ops = {
213 - .init = lzo_init,
214 - .free = lzo_free,
215 - .decompress = lzo_uncompress,
216 - .id = LZO_COMPRESSION,
217 - .name = "lzo",
218 - .supported = 1
219 -};
220 --- a/fs/squashfs/Makefile
221 +++ b/fs/squashfs/Makefile
222 @@ -5,5 +5,5 @@
223 obj-$(CONFIG_SQUASHFS) += squashfs.o
224 squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
225 squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
226 -squashfs-$(CONFIG_SQUASHFS_XATTR) += xattr.o xattr_id.o
227 -squashfs-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
228 +squashfs-$(CONFIG_SQUASHFS_XATTRS) += xattr.o xattr_id.o
229 +
230 --- a/fs/squashfs/squashfs.h
231 +++ b/fs/squashfs/squashfs.h
232 @@ -104,6 +104,3 @@ extern const struct xattr_handler *squas
233
234 /* zlib_wrapper.c */
235 extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
236 -
237 -/* lzo_wrapper.c */
238 -extern const struct squashfs_decompressor squashfs_lzo_comp_ops;
239 --- a/fs/squashfs/xattr.h
240 +++ b/fs/squashfs/xattr.h
241 @@ -21,7 +21,7 @@
242 * xattr.h
243 */
244
245 -#ifdef CONFIG_SQUASHFS_XATTR
246 +#ifdef CONFIG_SQUASHFS_XATTRS
247 extern __le64 *squashfs_read_xattr_id_table(struct super_block *, u64,
248 u64 *, int *);
249 extern int squashfs_xattr_lookup(struct super_block *, unsigned int, int *,