]> git.pld-linux.org Git - packages/kernel.git/blob - 2.6.0-t1-squashfs.patch
- added description of djurban's branch
[packages/kernel.git] / 2.6.0-t1-squashfs.patch
1 diff -Naur linux-2.6.0-test1-ac2/fs/Kconfig linux-2.6.0-test1-ac2-sfs/fs/Kconfig
2 --- linux-2.6.0-test1-ac2/fs/Kconfig    2003-07-10 13:10:54.000000000 -0700
3 +++ linux-2.6.0-test1-ac2-sfs/fs/Kconfig        2003-07-20 01:36:53.000000000 -0700
4 @@ -1114,6 +1114,26 @@
5  
6           If unsure, say N.
7  
8 +config SQUASHFS
9 +       tristate "Squashfs file system support"
10 +       help
11 +         Saying Y here includes support for Squashfs.  Squashfs is a
12 +         highly compressed read-only filesystem for Linux. It uses zlib
13 +         compression to compress both files, inodes and directories.
14 +         Inodes in the system are very small and all blocks are packed
15 +         to minimise data overhead. Block sizes greater than 4K are
16 +         supported up to a maximum of 32K.
17 +
18 +         See <http://squashfs.sourceforge.net/> for further information.
19 +
20 +         If you want to compile this as a module ( = code which can be
21 +         inserted in and removed from the running kernel whenever you want),
22 +         say M here and read <file:Documentation/modules.txt>.  The module
23 +         will be called squashfs.  Note that the root file system (the one
24 +         containing the directory /) cannot be compiled as a module.
25 +
26 +         If unsure, say N.
27 +
28  config VXFS_FS
29         tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
30         help
31 diff -Naur linux-2.6.0-test1-ac2/fs/Makefile linux-2.6.0-test1-ac2-sfs/fs/Makefile
32 --- linux-2.6.0-test1-ac2/fs/Makefile   2003-07-10 13:10:55.000000000 -0700
33 +++ linux-2.6.0-test1-ac2-sfs/fs/Makefile       2003-07-16 13:45:34.000000000 -0700
34 @@ -53,6 +53,7 @@
35  obj-$(CONFIG_JBD)              += jbd/
36  obj-$(CONFIG_EXT2_FS)          += ext2/
37  obj-$(CONFIG_CRAMFS)           += cramfs/
38 +obj-$(CONFIG_SQUASHFS)         += squashfs/
39  obj-$(CONFIG_RAMFS)            += ramfs/
40  obj-$(CONFIG_HUGETLBFS)                += hugetlbfs/
41  obj-$(CONFIG_CODA_FS)          += coda/
42 diff -Naur linux-2.6.0-test1-ac2/fs/squashfs/Makefile linux-2.6.0-test1-ac2-sfs/fs/squashfs/Makefile
43 --- linux-2.6.0-test1-ac2/fs/squashfs/Makefile  1969-12-31 16:00:00.000000000 -0800
44 +++ linux-2.6.0-test1-ac2-sfs/fs/squashfs/Makefile      2003-07-15 12:17:43.000000000 -0700
45 @@ -0,0 +1,8 @@
46 +#
47 +# Makefile for the linux squashfs routines.
48 +#
49 +
50 +obj-$(CONFIG_SQUASHFS) += squashfs.o
51 +
52 +squashfs-objs := inode.o
53 +
54 diff -Naur linux-2.6.0-test1-ac2/fs/squashfs/inode.c linux-2.6.0-test1-ac2-sfs/fs/squashfs/inode.c
55 --- linux-2.6.0-test1-ac2/fs/squashfs/inode.c   1969-12-31 16:00:00.000000000 -0800
56 +++ linux-2.6.0-test1-ac2-sfs/fs/squashfs/inode.c       2003-07-20 02:08:01.000000000 -0700
57 @@ -0,0 +1,1045 @@
58 +/*
59 + * Squashfs - a compressed read only filesystem for Linux
60 + *
61 + * Copyright (c) 2002 Phillip Lougher <phillip@lougher.demon.co.uk>
62 + *
63 + * This program is free software; you can redistribute it and/or
64 + * modify it under the terms of the GNU General Public License
65 + * as published by the Free Software Foundation; either version
66 + * 2 of the License, or (at your option) any later version.
67 + *
68 + * inode.c
69 + */
70 +
71 +#include <linux/types.h>
72 +#include <linux/module.h>
73 +#include <linux/errno.h>
74 +#include <linux/slab.h>
75 +#include <linux/fs.h>
76 +#include <linux/init.h>
77 +#include <linux/dcache.h>
78 +#include <asm/uaccess.h>
79 +#include <linux/wait.h>
80 +#include <asm/semaphore.h>
81 +#include <linux/zlib.h>
82 +#include <linux/blkdev.h>
83 +#include <linux/vmalloc.h>
84 +#include <linux/smp_lock.h>
85 +#include <linux/buffer_head.h>
86 +#include <linux/squashfs_fs_sb.h>
87 +#include <linux/vfs.h>
88 +
89 +#ifdef SQUASHFS_TRACE
90 +#define TRACE(s, args...)                              printk(KERN_NOTICE "SQUASHFS: "s, ## args)
91 +#else
92 +#define TRACE(s, args...)                              {}
93 +#endif
94 +
95 +#define ERROR(s, args...)                              printk(KERN_ERR "SQUASHFS error: "s, ## args)
96 +
97 +#define SERROR(s, args...)                             if(!silent) printk(KERN_ERR "SQUASHFS error: "s, ## args)
98 +#define WARNING(s, args...)                            printk(KERN_WARNING "SQUASHFS: "s, ## args)
99 +
100 +typedef struct squashfs_inode_info {
101 +       unsigned int    start_block;
102 +       unsigned int    block_list_start;
103 +       unsigned int    offset;
104 +
105 +       struct inode    vfs_inode;
106 +} squashfs_inode_info;
107 +
108 +static inline struct squashfs_inode_info *SQUASH_I(struct inode *inode)
109 +{
110 +       return container_of(inode, struct squashfs_inode_info, vfs_inode);
111 +}
112 +
113 +static int squashfs_fill_super(struct super_block *, void *, int);
114 +static void squashfs_put_super(struct super_block *);
115 +static int squashfs_statfs(struct super_block *, struct kstatfs *);
116 +static int squashfs_symlink_readpage(struct file *file, struct page *page);
117 +static int squashfs_readpage(struct file *file, struct page *page);
118 +static int squashfs_readdir(struct file *, void *, filldir_t);
119 +static struct dentry *squashfs_lookup(struct inode *, struct dentry *, struct nameidata *);
120 +static unsigned int read_data(struct super_block *s, char *buffer,
121 +               unsigned int index, int length, unsigned int *next_index);
122 +static int squashfs_get_cached_block(struct super_block *s, char *buffer,
123 +               unsigned int block, unsigned int offset, int length,
124 +               unsigned int *next_block, unsigned int *next_offset);
125 +static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode);
126 +static void squashfs_put_super(struct super_block *s);
127 +static struct super_block *squashfs_get_sb(struct file_system_type *, int, const char *, void *);
128 +static struct inode *squashfs_alloc_inode(struct super_block *);
129 +static void squashfs_destroy_inode(struct inode *);
130 +
131 +DECLARE_MUTEX(read_data_mutex);
132 +
133 +static z_stream stream;
134 +
135 +static unsigned char squashfs_filetype_table[] = {
136 +       DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR
137 +};
138 +
139 +static struct super_operations squashfs_ops = {
140 +       .alloc_inode    = squashfs_alloc_inode,
141 +       .destroy_inode  = squashfs_destroy_inode,
142 +       .statfs         = squashfs_statfs,
143 +       .put_super      = squashfs_put_super,
144 +};
145 +
146 +static struct address_space_operations squashfs_symlink_aops = {
147 +       .readpage       = squashfs_symlink_readpage
148 +};
149 +
150 +static struct address_space_operations squashfs_aops = {
151 +       .readpage       = squashfs_readpage
152 +};
153 +
154 +static struct file_operations squashfs_dir_ops = {
155 +       .read           = generic_read_dir,
156 +       .readdir        = squashfs_readdir
157 +};
158 +
159 +static struct inode_operations squashfs_dir_inode_ops = {
160 +       .lookup         = squashfs_lookup
161 +};
162 +
163 +static struct file_system_type squashfs_fs_type = {
164 +       .owner          = THIS_MODULE,
165 +       .name           = "squashfs",
166 +       .get_sb         = squashfs_get_sb,
167 +       .kill_sb        = kill_block_super,
168 +       .fs_flags       = FS_REQUIRES_DEV,
169 +};
170 +
171 +static unsigned int read_data(struct super_block *s, char *buffer,
172 +               unsigned int index, int length, unsigned int *next_index)
173 +{
174 +       squashfs_sb_info *msBlk = s->s_fs_info;
175 +       struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >> msBlk->devblksize_log2) + 2];
176 +       unsigned short c_byte;
177 +       unsigned int offset = index & ((1 << msBlk->devblksize_log2) - 1);
178 +       unsigned int cur_index = index >> msBlk->devblksize_log2;
179 +       int bytes, avail_bytes, b, k;
180 +       char *c_buffer;
181 +       unsigned int compressed;
182 +
183 +       if(!(bh[0] = sb_bread(s, cur_index)))
184 +               goto read_failure;
185 +
186 +       if(length)
187 +               c_byte = length;
188 +       else {
189 +               if(msBlk->devblksize - offset == 1) {
190 +                       if(msBlk->swap)
191 +                               ((unsigned char *) &c_byte)[1] = *((unsigned char *) (bh[0]->b_data + offset));
192 +                       else
193 +                               ((unsigned char *) &c_byte)[0] = *((unsigned char *) (bh[0]->b_data + offset));
194 +                       brelse(bh[0]);
195 +                       if(!(bh[0] = sb_bread(s, ++cur_index)))
196 +                               goto read_failure;
197 +                       if(msBlk->swap)
198 +                               ((unsigned char *) &c_byte)[0] = *((unsigned char *) bh[0]->b_data); 
199 +                       else
200 +                               ((unsigned char *) &c_byte)[1] = *((unsigned char *) bh[0]->b_data); 
201 +                       offset = 1;
202 +               }
203 +               else {
204 +                       if(msBlk->swap) {
205 +                               ((unsigned char *) &c_byte)[1] = *((unsigned char *) (bh[0]->b_data + offset));
206 +                               ((unsigned char *) &c_byte)[0] = *((unsigned char *) (bh[0]->b_data + offset + 1)); 
207 +                       } else
208 +                               c_byte = *((unsigned short *) (bh[0]->b_data + offset));
209 +                       offset += 2;
210 +               }
211 +               if(SQUASHFS_CHECK_DATA(msBlk->sBlk.flags)) {
212 +                       if(offset == msBlk->devblksize) {
213 +                               brelse(bh[0]);
214 +                               if(!(bh[0] = sb_bread(s, ++cur_index)))
215 +                                       goto read_failure;
216 +                               offset = 0;
217 +                       }
218 +                       if(*((unsigned char *) (bh[0]->b_data + offset)) != SQUASHFS_MARKER_BYTE) {
219 +                               ERROR("Metadata block marker corrupt @ %x\n", index);
220 +                               brelse(bh[0]);
221 +                               return 0;
222 +                       }
223 +                       offset ++;
224 +               }
225 +       }
226 +
227 +       bytes = msBlk->devblksize - offset;
228 +       c_buffer = (compressed = SQUASHFS_COMPRESSED(c_byte)) ? msBlk->read_data : buffer;
229 +       c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte);
230 +
231 +       TRACE("Block @ 0x%x, %scompressed size %d\n", index, compressed ? "" : "un", (unsigned int) c_byte);
232 +
233 +       for(b = 1; bytes < c_byte; b++) {
234 +               if(!(bh[b] = sb_bread(s, ++cur_index)))
235 +                       goto block_release;
236 +               bytes += msBlk->devblksize;
237 +       }
238 +
239 +       if(compressed)
240 +               down(&read_data_mutex);
241 +
242 +       for(bytes = 0, k = 0; k < b; k++) {
243 +               avail_bytes = (c_byte - bytes) > (msBlk->devblksize - offset) ? msBlk->devblksize - offset : c_byte - bytes;
244 +               memcpy(c_buffer + bytes, bh[k]->b_data + offset, avail_bytes);
245 +               bytes += avail_bytes;
246 +               offset = 0;
247 +               brelse(bh[k]);
248 +       }
249 +
250 +       /*
251 +        * uncompress block
252 +        */
253 +       if(compressed) {
254 +               int zlib_err;
255 +
256 +               stream.next_in = c_buffer;
257 +               stream.avail_in = c_byte;
258 +               stream.next_out = buffer;
259 +               stream.avail_out = msBlk->read_size;
260 +               if(((zlib_err = zlib_inflateInit(&stream)) != Z_OK) ||
261 +                               ((zlib_err = zlib_inflate(&stream, Z_FINISH)) != Z_STREAM_END) ||
262 +                               ((zlib_err = zlib_inflateEnd(&stream)) != Z_OK)) {
263 +                       ERROR("zlib_fs returned unexpected result 0x%x\n", zlib_err);
264 +                       bytes = 0;
265 +               } else
266 +                       bytes = stream.total_out;
267 +               up(&read_data_mutex);
268 +       }
269 +
270 +       if(next_index)
271 +               *next_index = index + c_byte + (length ? 0 : (SQUASHFS_CHECK_DATA(msBlk->sBlk.flags) ? 3 : 2));
272 +
273 +       return bytes;
274 +
275 +block_release:
276 +       while(--b >= 0) brelse(bh[b]);
277 +
278 +read_failure:
279 +       ERROR("sb_bread failed reading block 0x%x\n", cur_index);
280 +       return 0;
281 +}
282 +
283 +
284 +static int squashfs_get_cached_block(struct super_block *s, char *buffer,
285 +               unsigned int block, unsigned int offset, int length,
286 +               unsigned int *next_block, unsigned int *next_offset)
287 +{
288 +       squashfs_sb_info *msBlk = s->s_fs_info;
289 +       int n, i, bytes, return_length = length;
290 +       unsigned int next_index;
291 +
292 +       TRACE("Entered squashfs_get_cached_block [%x:%x]\n", block, offset);
293 +
294 +       for(;;) {
295 +               for(i = 0; i < SQUASHFS_CACHED_BLKS; i++) 
296 +                       if(msBlk->block_cache[i].block == block)
297 +                               break; 
298 +               
299 +               down(&msBlk->block_cache_mutex);
300 +               if(i == SQUASHFS_CACHED_BLKS) {
301 +                       /* read inode header block */
302 +                       for(i = msBlk->next_cache, n = SQUASHFS_CACHED_BLKS; n ; n --, i = (i + 1) % SQUASHFS_CACHED_BLKS)
303 +                               if(msBlk->block_cache[i].block != SQUASHFS_USED_BLK)
304 +                                       break;
305 +                       if(n == 0) {
306 +                               up(&msBlk->block_cache_mutex);
307 +                               sleep_on(&msBlk->waitq);
308 +                               continue;
309 +                       }
310 +                       msBlk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS;
311 +
312 +                       if(msBlk->block_cache[i].block == SQUASHFS_INVALID_BLK) {
313 +                               if(!(msBlk->block_cache[i].data = (unsigned char *)
314 +                                                       kmalloc(SQUASHFS_METADATA_SIZE, GFP_KERNEL))) {
315 +                                       ERROR("Failed to allocate cache block\n");
316 +                                       up(&msBlk->block_cache_mutex);
317 +                                       return 0;
318 +                               }
319 +                       }
320 +       
321 +                       msBlk->block_cache[i].block = SQUASHFS_USED_BLK;
322 +                       up(&msBlk->block_cache_mutex);
323 +                       if(!(msBlk->block_cache[i].length = read_data(s, msBlk->block_cache[i].data, block, 0,
324 +                                                       &next_index))) {
325 +                               ERROR("Unable to read cache block [%x:%x]\n", block, offset);
326 +                               return 0;
327 +                       }
328 +                       down(&msBlk->block_cache_mutex);
329 +                       wake_up(&msBlk->waitq);
330 +                       msBlk->block_cache[i].block = block;
331 +                       msBlk->block_cache[i].next_index = next_index;
332 +                       TRACE("Read cache block [%x:%x]\n", block, offset);
333 +               }
334 +
335 +               if(msBlk->block_cache[i].block != block) {
336 +                       up(&msBlk->block_cache_mutex);
337 +                       continue;
338 +               }
339 +
340 +               if((bytes = msBlk->block_cache[i].length - offset) >= length) {
341 +                       memcpy(buffer, msBlk->block_cache[i].data + offset, length);
342 +                       if(msBlk->block_cache[i].length - offset == length) {
343 +                               *next_block = msBlk->block_cache[i].next_index;
344 +                               *next_offset = 0;
345 +                       } else {
346 +                               *next_block = block;
347 +                               *next_offset = offset + length;
348 +                       }
349 +       
350 +                       up(&msBlk->block_cache_mutex);
351 +                       return return_length;
352 +               } else {
353 +                       memcpy(buffer, msBlk->block_cache[i].data + offset, bytes);
354 +                       block = msBlk->block_cache[i].next_index;
355 +                       up(&msBlk->block_cache_mutex);
356 +                       length -= bytes;
357 +                       offset = 0;
358 +                       buffer += bytes;
359 +               }
360 +       }
361 +}
362 +
363 +
364 +static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode)
365 +{
366 +       struct inode *i = new_inode(s);
367 +       struct squashfs_inode_info *sqi = SQUASH_I(i);
368 +       squashfs_sb_info *msBlk = s->s_fs_info;
369 +       squashfs_super_block *sBlk = &msBlk->sBlk;
370 +       unsigned int block = SQUASHFS_INODE_BLK(inode) + sBlk->inode_table_start;
371 +       unsigned int offset = SQUASHFS_INODE_OFFSET(inode);
372 +       unsigned int next_block, next_offset;
373 +       squashfs_base_inode_header inodeb;
374 +
375 +       TRACE("Entered squashfs_iget\n");
376 +
377 +       if(msBlk->swap) {
378 +               squashfs_base_inode_header sinodeb;
379 +
380 +               if(!squashfs_get_cached_block(s, (char *) &sinodeb, block,  offset,
381 +                                       sizeof(sinodeb), &next_block, &next_offset))
382 +                       goto failed_read;
383 +               SQUASHFS_SWAP_BASE_INODE_HEADER(&inodeb, &sinodeb, sizeof(sinodeb));
384 +       } else
385 +               if(!squashfs_get_cached_block(s, (char *) &inodeb, block,  offset,
386 +                                       sizeof(inodeb), &next_block, &next_offset))
387 +                       goto failed_read;
388 +
389 +       i->i_nlink = 1;
390 +
391 +       i->i_mtime.tv_sec = sBlk->mkfs_time;
392 +       i->i_atime.tv_sec = sBlk->mkfs_time;
393 +       i->i_ctime.tv_sec = sBlk->mkfs_time;
394 +       i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0;
395 +       i->i_uid = msBlk->uid[((inodeb.inode_type - 1) / SQUASHFS_TYPES) * 16 + inodeb.uid];
396 +       i->i_ino = SQUASHFS_MK_VFS_INODE(block - sBlk->inode_table_start, offset);
397 +
398 +       if(inodeb.guid == SQUASHFS_GUIDS)
399 +               i->i_gid = i->i_uid;
400 +       else
401 +               i->i_gid = msBlk->guid[inodeb.guid];
402 +
403 +       i->i_mode = inodeb.mode;
404 +
405 +       switch((inodeb.inode_type - 1) % SQUASHFS_TYPES + 1) {
406 +               case SQUASHFS_FILE_TYPE: {
407 +                       squashfs_reg_inode_header inodep;
408 +
409 +                       if(msBlk->swap) {
410 +                               squashfs_reg_inode_header sinodep;
411 +
412 +                               if(!squashfs_get_cached_block(s, (char *) &sinodep, block,  offset, sizeof(sinodep),
413 +                                                       &next_block, &next_offset))
414 +                                       goto failed_read;
415 +                               SQUASHFS_SWAP_REG_INODE_HEADER(&inodep, &sinodep);
416 +                       } else
417 +                               if(!squashfs_get_cached_block(s, (char *) &inodep, block,  offset, sizeof(inodep),
418 +                                                       &next_block, &next_offset))
419 +                                       goto failed_read;
420 +
421 +                       i->i_size = inodep.file_size;
422 +                       i->i_fop = &generic_ro_fops;
423 +                       i->i_data.a_ops = &squashfs_aops;
424 +                       i->i_mode |= S_IFREG;
425 +
426 +                       i->i_mtime.tv_sec = inodep.mtime;
427 +                       i->i_atime.tv_sec = inodep.mtime;
428 +                       i->i_ctime.tv_sec = inodep.mtime;
429 +                       i->i_mtime.tv_nsec = i->i_atime.tv_nsec =
430 +                               i->i_ctime.tv_nsec = 0;
431 +                       sqi->start_block = inodep.start_block;
432 +                       sqi->block_list_start = next_block;
433 +                       sqi->offset = next_offset;
434 +                       TRACE("File inode %x:%x, start_block %x, block_list_start %x, offset %x\n",
435 +                                       SQUASHFS_INODE_BLK(inode), offset, inodep.start_block, next_block, next_offset);
436 +                       break;
437 +               }
438 +               case SQUASHFS_DIR_TYPE: {
439 +                       squashfs_dir_inode_header inodep;
440 +
441 +                       if(msBlk->swap) {
442 +                               squashfs_dir_inode_header sinodep;
443 +
444 +                               if(!squashfs_get_cached_block(s, (char *) &sinodep, block,  offset, sizeof(sinodep),
445 +                                                       &next_block, &next_offset))
446 +                                       goto failed_read;
447 +                               SQUASHFS_SWAP_DIR_INODE_HEADER(&inodep, &sinodep);
448 +                       } else
449 +                               if(!squashfs_get_cached_block(s, (char *) &inodep, block,  offset, sizeof(inodep),
450 +                                                       &next_block, &next_offset))
451 +                                       goto failed_read;
452 +
453 +                       i->i_size = inodep.file_size;
454 +                       i->i_op = &squashfs_dir_inode_ops;
455 +                       i->i_fop = &squashfs_dir_ops;
456 +                       i->i_mode |= S_IFDIR;
457 +                       i->i_mtime.tv_sec = inodep.mtime;
458 +                       i->i_atime.tv_sec = inodep.mtime;
459 +                       i->i_ctime.tv_sec = inodep.mtime;
460 +                       i->i_mtime.tv_nsec = i->i_atime.tv_nsec =
461 +                               i->i_ctime.tv_nsec = 0;
462 +                       sqi->start_block = inodep.start_block;
463 +                       sqi->offset = inodep.offset;
464 +                       TRACE("Directory inode %x:%x, start_block %x, offset %x\n", SQUASHFS_INODE_BLK(inode), offset,
465 +                                       inodep.start_block, inodep.offset);
466 +                       break;
467 +               }
468 +               case SQUASHFS_SYMLINK_TYPE: {
469 +                       squashfs_symlink_inode_header inodep;
470 +       
471 +                       if(msBlk->swap) {
472 +                               squashfs_symlink_inode_header sinodep;
473 +
474 +                               if(!squashfs_get_cached_block(s, (char *) &sinodep, block,  offset, sizeof(sinodep),
475 +                                                       &next_block, &next_offset))
476 +                                       goto failed_read;
477 +                               SQUASHFS_SWAP_SYMLINK_INODE_HEADER(&inodep, &sinodep);
478 +                       } else
479 +                               if(!squashfs_get_cached_block(s, (char *) &inodep, block,  offset, sizeof(inodep),
480 +                                                       &next_block, &next_offset))
481 +                                       goto failed_read;
482 +
483 +                       i->i_size = inodep.symlink_size;
484 +                       i->i_op = &page_symlink_inode_operations;
485 +                       i->i_data.a_ops = &squashfs_symlink_aops;
486 +                       i->i_mode |= S_IFLNK;
487 +                       sqi->start_block = next_block;
488 +                       sqi->offset = next_offset;
489 +                       TRACE("Symbolic link inode %x:%x, start_block %x, offset %x\n",
490 +                               SQUASHFS_INODE_BLK(inode), offset, next_block, next_offset);
491 +                       break;
492 +                }
493 +                case SQUASHFS_BLKDEV_TYPE:
494 +                case SQUASHFS_CHRDEV_TYPE: {
495 +                       squashfs_dev_inode_header inodep;
496 +
497 +                       if(msBlk->swap) {
498 +                               squashfs_dev_inode_header sinodep;
499 +
500 +                               if(!squashfs_get_cached_block(s, (char *) &sinodep, block,  offset, sizeof(sinodep),
501 +                                                       &next_block, &next_offset))
502 +                                       goto failed_read;
503 +                               SQUASHFS_SWAP_DEV_INODE_HEADER(&inodep, &sinodep);
504 +                       } else  
505 +                               if(!squashfs_get_cached_block(s, (char *) &inodep, block,  offset, sizeof(inodep),
506 +                                                       &next_block, &next_offset))
507 +                                       goto failed_read;
508 +
509 +                       i->i_size = 0;
510 +                       i->i_mode |= (inodeb.inode_type == SQUASHFS_CHRDEV_TYPE) ? S_IFCHR : S_IFBLK;
511 +                       init_special_inode(i, i->i_mode, inodep.rdev);
512 +                       TRACE("Device inode %x:%x, rdev %x\n", SQUASHFS_INODE_BLK(inode), offset, inodep.rdev);
513 +                       break;
514 +                }
515 +                default:
516 +                       ERROR("Unknown inode type %d in squashfs_iget!\n", inodeb.inode_type);
517 +                               goto failed_read1;
518 +       }
519 +       
520 +       return i;
521 +
522 +failed_read:
523 +       ERROR("Unable to read inode [%x:%x]\n", block, offset);
524 +
525 +failed_read1:
526 +       return NULL;
527 +}
528 +
529 +
530 +static int squashfs_fill_super(struct super_block *s, void *data, int silent)
531 +{
532 +       char bbuf[BDEVNAME_SIZE];
533 +       squashfs_sb_info *msBlk;
534 +       squashfs_super_block *sBlk;
535 +       int i;
536 +
537 +       TRACE("Entered squashfs_fill_super\n");
538 +
539 +       msBlk = kmalloc(sizeof(squashfs_sb_info), GFP_KERNEL);
540 +       if (!msBlk)
541 +               return -ENOMEM;
542 +       s->s_fs_info = msBlk;
543 +       sBlk = &(msBlk->sBlk);
544 +       memset(msBlk, 0, sizeof(squashfs_sb_info));
545 +
546 +       msBlk->devblksize = sb_min_blocksize(s, BLOCK_SIZE);
547 +       msBlk->devblksize_log2 = ffz(~msBlk->devblksize);
548 +
549 +       init_MUTEX(&msBlk->read_page_mutex);
550 +       init_MUTEX(&msBlk->block_cache_mutex);
551 +       
552 +       init_waitqueue_head(&msBlk->waitq);
553 +
554 +       if(!read_data(s, (char *) sBlk, SQUASHFS_START, sizeof(squashfs_super_block) | SQUASHFS_COMPRESSED_BIT, NULL)) {
555 +               SERROR("unable to read superblock\n");
556 +               goto failed_mount;
557 +       }
558 +
559 +       /* Check it is a SQUASHFS superblock */
560 +       msBlk->swap = 0;
561 +       if((s->s_magic = sBlk->s_magic) != SQUASHFS_MAGIC) {
562 +               if(sBlk->s_magic == SQUASHFS_MAGIC_SWAP) {
563 +                       squashfs_super_block sblk;
564 +                       WARNING("Mounting a different endian SQUASHFS filesystem on %s\n", __bdevname(s->s_dev, bbuf));
565 +                       SQUASHFS_SWAP_SUPER_BLOCK(&sblk, sBlk);
566 +                       memcpy(sBlk, &sblk, sizeof(squashfs_super_block));
567 +                       msBlk->swap = 1;
568 +               } else  {
569 +                       SERROR("Can't find a SQUASHFS superblock on %s\n", __bdevname(s->s_dev, bbuf));
570 +                       goto failed_mount;
571 +               }
572 +       }
573 +
574 +       /* Check the MAJOR & MINOR versions */
575 +       if(sBlk->s_major != SQUASHFS_MAJOR || sBlk->s_minor > SQUASHFS_MINOR) {
576 +               SERROR("Major/Minor mismatch, filesystem is (%d:%d), I support (%d: <= %d)\n",
577 +                               sBlk->s_major, sBlk->s_minor, SQUASHFS_MAJOR, SQUASHFS_MINOR);
578 +               goto failed_mount;
579 +       }
580 +
581 +       TRACE("Found valid superblock on %s\n", __bdevname(s->s_dev, bbuf));
582 +       TRACE("Inodes are %scompressed\n", SQUASHFS_UNCOMPRESSED_INODES(sBlk->flags) ? "un" : "");
583 +       TRACE("Data is %scompressed\n", SQUASHFS_UNCOMPRESSED_DATA(sBlk->flags) ? "un" : "");
584 +       TRACE("Check data is %s present in the filesystem\n", SQUASHFS_CHECK_DATA(sBlk->flags) ? "" : "not");
585 +       TRACE("Filesystem size %d bytes\n", sBlk->bytes_used);
586 +       TRACE("Block size %d\n", sBlk->block_size);
587 +       TRACE("Number of inodes %d\n", sBlk->inodes);
588 +       TRACE("Number of uids %d\n", sBlk->no_uids);
589 +       TRACE("Number of gids %d\n", sBlk->no_guids);
590 +       TRACE("sBlk->inode_table_start %x\n", sBlk->inode_table_start);
591 +       TRACE("sBlk->directory_table_start %x\n", sBlk->directory_table_start);
592 +       TRACE("sBlk->uid_start %x\n", sBlk->uid_start);
593 +
594 +       s->s_flags |= MS_RDONLY;
595 +       s->s_op = &squashfs_ops;
596 +
597 +       /* Init inode_table block pointer array */
598 +       if(!(msBlk->block_cache = (squashfs_cache *) kmalloc(sizeof(squashfs_cache) * SQUASHFS_CACHED_BLKS, GFP_KERNEL))) {
599 +               ERROR("Failed to allocate block cache\n");
600 +               goto failed_mount;
601 +       }
602 +
603 +       for(i = 0; i < SQUASHFS_CACHED_BLKS; i++)
604 +               msBlk->block_cache[i].block = SQUASHFS_INVALID_BLK;
605 +
606 +       msBlk->next_cache = 0;
607 +
608 +       /* Allocate read_data block */
609 +       msBlk->read_size = (sBlk->block_size < SQUASHFS_METADATA_SIZE) ? SQUASHFS_METADATA_SIZE : sBlk->block_size;
610 +       if(!(msBlk->read_data = (char *) kmalloc(msBlk->read_size, GFP_KERNEL))) {
611 +               ERROR("Failed to allocate read_data block\n");
612 +               goto failed_mount1;
613 +       }
614 +
615 +       /* Allocate read_page block */
616 +       if(sBlk->block_size > PAGE_CACHE_SIZE && 
617 +          !(msBlk->read_page = (char *) kmalloc(sBlk->block_size, GFP_KERNEL))) {
618 +               ERROR("Failed to allocate read_page block\n");
619 +               goto failed_mount2;
620 +       }
621 +
622 +       /* Allocate uid and gid tables */
623 +       if(!(msBlk->uid = (squashfs_uid *) kmalloc((sBlk->no_uids +
624 +               sBlk->no_guids) * sizeof(squashfs_uid), GFP_KERNEL))) {
625 +               ERROR("Failed to allocate uid/gid table\n");
626 +               goto failed_mount3;
627 +       }
628 +       msBlk->guid = msBlk->uid + sBlk->no_uids;
629 +   
630 +       if(msBlk->swap) {
631 +               squashfs_uid suid[sBlk->no_uids + sBlk->no_guids];
632 +
633 +               if(!read_data(s, (char *) &suid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) *
634 +                               sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT, NULL)) {
635 +                       SERROR("unable to read uid/gid table\n");
636 +                       goto failed_mount4;
637 +               }
638 +               SQUASHFS_SWAP_DATA(msBlk->uid, suid, (sBlk->no_uids + sBlk->no_guids), (sizeof(squashfs_uid) * 8));
639 +       } else
640 +               if(!read_data(s, (char *) msBlk->uid, sBlk->uid_start, ((sBlk->no_uids + sBlk->no_guids) *
641 +                               sizeof(squashfs_uid)) | SQUASHFS_COMPRESSED_BIT, NULL)) {
642 +                       SERROR("unable to read uid/gid table\n");
643 +                       goto failed_mount4;
644 +               }
645 +
646 +       if(!(s->s_root = d_alloc_root(squashfs_iget(s, sBlk->root_inode)))) {
647 +               ERROR("Root inode create failed\n");
648 +               goto failed_mount4;
649 +       }
650 +
651 +       TRACE("Leaving squashfs_fill_super\n");
652 +       return 0;
653 +
654 +failed_mount4:
655 +       kfree(msBlk->uid);
656 +failed_mount3:
657 +       kfree(msBlk->read_page);
658 +failed_mount2:
659 +       kfree(msBlk->read_data);
660 +failed_mount1:
661 +       kfree(msBlk->block_cache);
662 +failed_mount:
663 +       kfree(msBlk);
664 +       s->s_fs_info = NULL;
665 +       return -EINVAL;
666 +}
667 +
668 +
669 +static int squashfs_statfs(struct super_block *s, struct kstatfs *buf)
670 +{
671 +       squashfs_super_block *sBlk = &((squashfs_sb_info*)(s->s_fs_info))->sBlk;
672 +
673 +       TRACE("Entered squashfs_statfs\n");
674 +       buf->f_type = SQUASHFS_MAGIC;
675 +       buf->f_bsize = sBlk->block_size;
676 +       buf->f_blocks = ((sBlk->bytes_used - 1) >> sBlk->block_log) + 1;
677 +       buf->f_bfree = buf->f_bavail = 0;
678 +       buf->f_files = sBlk->inodes;
679 +       buf->f_ffree = 0;
680 +       buf->f_namelen = SQUASHFS_NAME_LEN;
681 +       return 0;
682 +}
683 +
684 +
685 +static int squashfs_symlink_readpage(struct file *file, struct page *page)
686 +{
687 +       struct inode *inode = page->mapping->host;
688 +       struct squashfs_inode_info *sqi = SQUASH_I(inode);
689 +       int index = page->index << PAGE_CACHE_SHIFT, length = 0, bytes;
690 +       int block = sqi->start_block;
691 +       int offset = sqi->offset;
692 +       char *buffer;
693 +
694 +       TRACE("Entered squashfs_symlink_readpage, page index %d, start block %x, offset %x\n",
695 +               page->index, sqi->start_block, sqi->offset);
696 +
697 +       if (! (buffer = kmalloc(PAGE_CACHE_SIZE, GFP_KERNEL))) {
698 +               ERROR("Failed to allocate symblic link buffer\n");
699 +               return 0;
700 +       }
701 +
702 +       while(length < index) {
703 +               if(length += bytes = squashfs_get_cached_block(inode->i_sb, buffer, block, offset,
704 +                                       PAGE_CACHE_SIZE, &block, &offset), !bytes) {
705 +                       ERROR("Unable to read symbolic link [%x:%x]\n", block, offset);
706 +                       goto skip_read;
707 +               }
708 +       }
709 +
710 +       if(length != index) {
711 +               ERROR("(squashfs_symlink_readpage) length != index\n");
712 +               kfree(buffer);
713 +               return 0;
714 +       }
715 +
716 +       bytes = (inode->i_size - length) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : inode->i_size - length;
717 +       if(!squashfs_get_cached_block(inode->i_sb, page_address(page), block, offset, bytes, &block, &offset))
718 +               ERROR("Unable to read symbolic link [%x:%x]\n", block, offset);
719 +
720 +skip_read:
721 +       kfree(buffer);
722 +       memset(page_address(page) + bytes, 0, PAGE_CACHE_SIZE - bytes);
723 +       flush_dcache_page(page);
724 +       SetPageUptodate(page);
725 +       unlock_page(page);
726 +
727 +       return 0;
728 +}
729 +
730 +
731 +#define SIZE 1024
732 +static int squashfs_readpage(struct file *file, struct page *page)
733 +{
734 +       struct inode *inode = page->mapping->host;
735 +       struct squashfs_inode_info *sqi = SQUASH_I(inode);
736 +       squashfs_sb_info *msBlk = inode->i_sb->s_fs_info;
737 +       squashfs_super_block *sBlk = &msBlk->sBlk;
738 +       unsigned short *block_listp;
739 +       int index = sBlk->block_log > PAGE_CACHE_SHIFT ?
740 +               page->index >> (sBlk->block_log - PAGE_CACHE_SHIFT) :
741 +               page->index << (PAGE_CACHE_SHIFT - sBlk->block_log);
742 +       int block = sqi->start_block, i = 0;
743 +       int bytes = sqi->block_list_start;
744 +       int offset = sqi->offset;
745 +       int file_blocks = ((inode->i_size - 1) >> sBlk->block_log) + 1;
746 +       char *block_list;
747 +       char *sblock_list;
748 +       
749 +       TRACE("Entered squashfs_readpage, page index %d, start block %x\n", page->index,
750 +               sqi->start_block);
751 +
752 +       if (msBlk->swap) {
753 +               block_list = kmalloc(SIZE, GFP_KERNEL);
754 +               sblock_list = kmalloc(SIZE, GFP_KERNEL);
755 +               if (! (block_list && sblock_list)) {
756 +                       ERROR("Unable to allocate readpage buffer\n");
757 +                       goto skip_read;
758 +               }
759 +       }
760 +       else {
761 +               sblock_list = 0;
762 +               if (! (block_list = kmalloc(SIZE, GFP_KERNEL))) {
763 +                       ERROR("Unable to allocate readpage buffer\n");
764 +                       goto skip_read;
765 +               }
766 +       }
767 +
768 +       if(index > file_blocks)
769 +               goto skip_read;
770 +
771 +       for(;;) {
772 +               int blocks = (index + 1 - i) > (SIZE >> 1) ? SIZE >> 1 : (index + 1 - i);
773 +               if(msBlk->swap) {
774 +                       if(!squashfs_get_cached_block(inode->i_sb, sblock_list, bytes, offset, blocks << 1, &bytes, &offset)) {
775 +                               ERROR("Unable to read block list [%d:%x]\n", bytes, offset);
776 +                               goto skip_read;
777 +                       }
778 +                       SQUASHFS_SWAP_SHORTS(((unsigned short *)block_list), ((unsigned short *)sblock_list), blocks);
779 +               } else
780 +                       if(!squashfs_get_cached_block(inode->i_sb, block_list, bytes, offset, blocks << 1, &bytes, &offset)) {
781 +                               ERROR("Unable to read block list [%d:%x]\n", bytes, offset);
782 +                               goto skip_read;
783 +                       }
784 +               for(block_listp = (unsigned short *) block_list; i < index && blocks; i ++, block_listp ++, blocks --)
785 +                       block += SQUASHFS_COMPRESSED_SIZE(*block_listp);
786 +               if(blocks)
787 +                       break;
788 +       }
789 +
790 +       if(sBlk->block_log > PAGE_CACHE_SHIFT) {
791 +               int mask = (1 << (sBlk->block_log - PAGE_CACHE_SHIFT)) - 1;
792 +               int start_index = page->index & ~mask;
793 +               int end_index = start_index | mask;
794 +               int byte_offset = 0;
795 +
796 +               down(&msBlk->read_page_mutex);
797 +               if(!(bytes = read_data(inode->i_sb, msBlk->read_page, block, *block_listp, NULL))) {
798 +                       ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp);
799 +                       goto skip_read;
800 +               }
801 +
802 +               for(i = start_index; i <= end_index && byte_offset < bytes; i++, byte_offset += PAGE_CACHE_SIZE) {
803 +                       int available_bytes = (bytes - byte_offset) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE : bytes - byte_offset;
804 +
805 +                       TRACE("bytes %d, i %d, byte_offset %d, available_bytes %d\n", bytes, i, byte_offset, available_bytes);
806 +
807 +                       if(i == page->index)  {
808 +                               memcpy(page_address(page), msBlk->read_page + byte_offset, available_bytes);
809 +                               memset(page_address(page) + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes);
810 +                               flush_dcache_page(page);
811 +                               SetPageUptodate(page);
812 +                               unlock_page(page);
813 +                       }  else {
814 +                               struct page *push_page;
815 +
816 +                               if((push_page = grab_cache_page_nowait(page->mapping, i))) {
817 +                                       memcpy(page_address(push_page), msBlk->read_page + byte_offset, available_bytes);
818 +                                       memset(page_address(push_page) + available_bytes, 0, PAGE_CACHE_SIZE - available_bytes);
819 +                                       flush_dcache_page(push_page);
820 +                                       SetPageUptodate(push_page);
821 +                                       unlock_page(push_page);
822 +                                       page_cache_release(push_page);
823 +                               }
824 +                       }
825 +               }
826 +               up( &msBlk->read_page_mutex);
827 +               kfree(block_list);
828 +               kfree(sblock_list);
829 +               return 0;
830 +
831 +       } else if(sBlk->block_log == PAGE_CACHE_SHIFT) {
832 +               if(!(bytes = read_data(inode->i_sb, page_address(page), block, *block_listp, NULL)))
833 +                       ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp);
834 +
835 +       } else {
836 +               int i_end = index + (1 << (PAGE_CACHE_SHIFT - sBlk->block_log));
837 +               char *p = (char *) page_address(page);
838 +               int byte;
839 +
840 +               if(i_end > file_blocks)
841 +                       i_end = file_blocks;
842 +
843 +               while(index < i_end) {
844 +                       if(!(byte = read_data(inode->i_sb, p, block, *block_listp, NULL))) {
845 +                               ERROR("Unable to read page, block %x, size %x\n", block, (int) *block_listp);
846 +                               goto skip_read;
847 +                       }
848 +                       block += SQUASHFS_COMPRESSED_SIZE(*block_listp);
849 +                       p += byte;
850 +                       bytes += byte;
851 +                       index ++;
852 +                       block_listp ++;
853 +               }
854 +       }
855 +
856 +skip_read:
857 +       kfree(block_list);
858 +       kfree(sblock_list);
859 +       memset(page_address(page) + bytes, 0, PAGE_CACHE_SIZE - bytes);
860 +       flush_dcache_page(page);
861 +       SetPageUptodate(page);
862 +       unlock_page(page);
863 +
864 +       return 0;
865 +}
866 +
867 +
868 +static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
869 +{
870 +       struct inode *i = file->f_dentry->d_inode;
871 +       struct squashfs_inode_info *sqi = SQUASH_I(i);
872 +       squashfs_sb_info *msBlk = i->i_sb->s_fs_info;
873 +       squashfs_super_block *sBlk = &msBlk->sBlk;
874 +       int next_block = sqi->start_block + sBlk->directory_table_start, next_offset =
875 +               sqi->offset, length = 0, dirs_read = 0, dir_count, bytes;
876 +       squashfs_dir_header dirh;
877 +       char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1];
878 +       squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer;
879 +
880 +       TRACE("Entered squashfs_readdir [%x:%x]\n", next_block, next_offset);
881 +
882 +       lock_kernel();
883 +
884 +       while(length < i->i_size) {
885 +               /* read directory header */
886 +               if(msBlk->swap) {
887 +                       squashfs_dir_header sdirh;
888 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &sdirh, next_block,
889 +                                               next_offset, sizeof(sdirh), &next_block, &next_offset), !bytes)
890 +                               goto failed_read;
891 +                       SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
892 +               } else
893 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &dirh, next_block,
894 +                                               next_offset, sizeof(dirh), &next_block, &next_offset), !bytes)
895 +                               goto failed_read;
896 +
897 +               dir_count = dirh.count + 1;
898 +               while(dir_count--) {
899 +                       if(msBlk->swap) {
900 +                               squashfs_dir_entry sdire;
901 +                               if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &sdire, next_block,
902 +                                                       next_offset, sizeof(sdire), &next_block, &next_offset), !bytes)
903 +                                       goto failed_read;
904 +                               SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
905 +                       } else
906 +                               if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) dire, next_block,
907 +                                                       next_offset, sizeof(*dire), &next_block, &next_offset), !bytes)
908 +                                       goto failed_read;
909 +
910 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, dire->name, next_block,
911 +                                               next_offset, dire->size + 1, &next_block, &next_offset), !bytes)
912 +                               goto failed_read;
913 +
914 +                       if(file->f_pos >= length)
915 +                               continue;
916 +
917 +                       dire->name[dire->size + 1] = '\0';
918 +
919 +                       TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d)\n", dirent,
920 +                       dire->name, dire->size + 1, (int) file->f_pos,
921 +                       dirh.start_block, dire->offset, squashfs_filetype_table[dire->type]);
922 +
923 +                       if(filldir(dirent, dire->name, dire->size + 1, file->f_pos, SQUASHFS_MK_VFS_INODE(dirh.start_block,
924 +                                                       dire->offset), squashfs_filetype_table[dire->type]) < 0) {
925 +                               TRACE("Filldir returned less than 0\n");
926 +                               unlock_kernel();
927 +                               return dirs_read;
928 +                       }
929 +
930 +                       file->f_pos = length;
931 +                       dirs_read ++;
932 +               }
933 +       }
934 +       unlock_kernel();
935 +       return dirs_read;
936 +
937 +failed_read:
938 +       ERROR("Unable to read directory block [%x:%x]\n", next_block, next_offset);
939 +       unlock_kernel();
940 +       return 0;
941 +}
942 +
943 +
944 +static struct dentry *squashfs_lookup(struct inode *i, struct dentry *dentry,
945 +                                     struct nameidata *nd)
946 +{
947 +       const char *name =dentry->d_name.name;
948 +       int len = dentry->d_name.len;
949 +       struct inode *inode = NULL;
950 +       struct squashfs_inode_info *sqi = SQUASH_I(i);
951 +       squashfs_sb_info *msBlk = i->i_sb->s_fs_info;
952 +       squashfs_super_block *sBlk = &msBlk->sBlk;
953 +       int next_block = sqi->start_block + sBlk->directory_table_start, next_offset =
954 +               sqi->offset, length = 0, dir_count, bytes;
955 +       squashfs_dir_header dirh;
956 +       char buffer[sizeof(squashfs_dir_entry) + SQUASHFS_NAME_LEN];
957 +       squashfs_dir_entry *dire = (squashfs_dir_entry *) buffer;
958 +
959 +       TRACE("Entered squashfs_lookup [%x:%x]\n", next_block, next_offset);
960 +
961 +       while(length < i->i_size) {
962 +               /* read directory header */
963 +               if(msBlk->swap) {
964 +                       squashfs_dir_header sdirh;
965 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &sdirh, next_block, next_offset,
966 +                                               sizeof(sdirh), &next_block, &next_offset), !bytes)
967 +                               goto failed_read;
968 +                       SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
969 +               } else
970 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &dirh, next_block, next_offset,
971 +                                               sizeof(dirh), &next_block, &next_offset), !bytes)
972 +                               goto failed_read;
973 +
974 +               dir_count = dirh.count + 1;
975 +               while(dir_count--) {
976 +                       if(msBlk->swap) {
977 +                               squashfs_dir_entry sdire;
978 +                               if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) &sdire,
979 +                                                       next_block,next_offset, sizeof(sdire), &next_block, &next_offset), !bytes)
980 +                                       goto failed_read;
981 +                               SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
982 +                       } else
983 +                               if(length += bytes = squashfs_get_cached_block(i->i_sb, (char *) dire,
984 +                                                       next_block,next_offset, sizeof(*dire), &next_block, &next_offset), !bytes)
985 +                                       goto failed_read;
986 +
987 +                       if(length += bytes = squashfs_get_cached_block(i->i_sb, dire->name,
988 +                                               next_block, next_offset, dire->size + 1, &next_block, &next_offset), !bytes)
989 +                               goto failed_read;
990 +
991 +                       if((len == dire->size + 1) && !strncmp(name, dire->name, len)) {
992 +                               squashfs_inode ino = SQUASHFS_MKINODE(dirh.start_block, dire->offset);
993 +
994 +                               TRACE("calling squashfs_iget for directory entry %s, inode %x:%x\n",
995 +                                               name, dirh.start_block, dire->offset);
996 +
997 +                               inode = squashfs_iget(i->i_sb, ino);
998 +
999 +                               goto exit_loop;
1000 +                       }
1001 +               }
1002 +       }
1003 +
1004 +exit_loop:
1005 +       d_add(dentry, inode);
1006 +       return ERR_PTR(0);
1007 +
1008 +failed_read:
1009 +       ERROR("Unable to read directory block [%x:%x]\n", next_block, next_offset);
1010 +       goto exit_loop;
1011 +}
1012 +
1013 +
1014 +static void squashfs_put_super(struct super_block *s)
1015 +{
1016 +       squashfs_sb_info *msBlk = s->s_fs_info;
1017 +       kfree(msBlk->block_cache);
1018 +       kfree(msBlk->read_data);
1019 +       kfree(msBlk->read_page);
1020 +       kfree(msBlk->uid);
1021 +       kfree(msBlk);
1022 +       s->s_fs_info = NULL;
1023 +}
1024 +
1025 +static struct super_block *squashfs_get_sb(struct file_system_type *fs_type,
1026 +       int flags, const char *dev_name, void *data)
1027 +{
1028 +       return get_sb_bdev(fs_type, flags, dev_name, data,
1029 +                          squashfs_fill_super);
1030 +}
1031 +
1032 +static kmem_cache_t * squashfs_inode_cachep;
1033 +
1034 +static struct inode *squashfs_alloc_inode(struct super_block *sb)
1035 +{
1036 +       struct squashfs_inode_info *ii;
1037 +       ii = (struct squashfs_inode_info *)
1038 +               kmem_cache_alloc(squashfs_inode_cachep, SLAB_KERNEL);
1039 +       if (!ii)
1040 +               return NULL;
1041 +       ii->vfs_inode.i_version = 1;
1042 +       return &ii->vfs_inode;
1043 +}
1044 +
1045 +static void squashfs_destroy_inode(struct inode *inode)
1046 +{
1047 +       kmem_cache_free(squashfs_inode_cachep, SQUASH_I(inode));
1048 +}
1049 +
1050 +static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
1051 +{
1052 +       struct squashfs_inode_info *sqi = (struct squashfs_inode_info *) foo;
1053 +
1054 +       if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
1055 +           SLAB_CTOR_CONSTRUCTOR) {
1056 +               inode_init_once(&sqi->vfs_inode);
1057 +       }
1058 +}
1059 +
1060 +static int init_inodecache(void)
1061 +{
1062 +       squashfs_inode_cachep =
1063 +               kmem_cache_create("squashfs_inode_cache",
1064 +                                 sizeof(struct squashfs_inode_info),
1065 +                                 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
1066 +                                 init_once, NULL);
1067 +       if (squashfs_inode_cachep == NULL)
1068 +               return -ENOMEM;
1069 +       return 0;
1070 +}
1071 +
1072 +static void destroy_inodecache(void)
1073 +{
1074 +       kmem_cache_destroy(squashfs_inode_cachep);
1075 +}
1076 +
1077 +static int __init init_squashfs_fs(void)
1078 +{
1079 +
1080 +       if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) {
1081 +               ERROR("Failed to allocate zlib workspace\n");
1082 +               return -ENOMEM;
1083 +       }
1084 +       if (init_inodecache())
1085 +               return -ENOMEM;
1086 +       return register_filesystem(&squashfs_fs_type);
1087 +}
1088 +
1089 +
1090 +static void __exit exit_squashfs_fs(void)
1091 +{
1092 +       destroy_inodecache();
1093 +       vfree(stream.workspace);
1094 +       unregister_filesystem(&squashfs_fs_type);
1095 +}
1096 +
1097 +
1098 +module_init(init_squashfs_fs);
1099 +module_exit(exit_squashfs_fs);
1100 +MODULE_DESCRIPTION("squashfs, a compressed read-only filesystem");
1101 +MODULE_AUTHOR("Phillip Lougher <phillip@lougher.demon.co.uk>");
1102 +MODULE_LICENSE("GPL");
1103 diff -Naur linux-2.6.0-test1-ac2/include/linux/squashfs_fs.h linux-2.6.0-test1-ac2-sfs/include/linux/squashfs_fs.h
1104 --- linux-2.6.0-test1-ac2/include/linux/squashfs_fs.h   1969-12-31 16:00:00.000000000 -0800
1105 +++ linux-2.6.0-test1-ac2-sfs/include/linux/squashfs_fs.h       2003-07-18 16:12:47.000000000 -0700
1106 @@ -0,0 +1,304 @@
1107 +#ifndef SQUASHFS_FS
1108 +#define SQUASHFS_FS
1109 +/*
1110 + * Squashfs
1111 + *
1112 + * Copyright (c) 2002 Phillip Lougher <phillip@lougher.demon.co.uk>
1113 + *
1114 + * This program is free software; you can redistribute it and/or
1115 + * modify it under the terms of the GNU General Public License
1116 + * as published by the Free Software Foundation; either version
1117 + * 2 of the License, or (at your option) any later version.
1118 + *
1119 + * squashfs_fs.h
1120 + */
1121 +
1122 +#define SQUASHFS_MAJOR                 1
1123 +#define SQUASHFS_MINOR                 0
1124 +#define SQUASHFS_MAGIC                 0x73717368
1125 +#define SQUASHFS_MAGIC_SWAP            0x68737173
1126 +#define SQUASHFS_START                 0
1127 +
1128 +/* size of metadata (inode and directory) blocks */
1129 +#define SQUASHFS_METADATA_SIZE         8192
1130 +#define SQUASHFS_METADATA_LOG          13
1131 +
1132 +/* default size of data blocks */
1133 +#define SQUASHFS_FILE_SIZE             32768
1134 +#define SQUASHFS_FILE_LOG              15
1135 +
1136 +#define SQUASHFS_FILE_MAX_SIZE         32768
1137 +
1138 +/* Max number of uids and gids */
1139 +#define SQUASHFS_UIDS                  48
1140 +#define SQUASHFS_GUIDS                 15
1141 +
1142 +/* Max length of filename (not 255) */
1143 +#define SQUASHFS_NAME_LEN              256
1144 +
1145 +#define SQUASHFS_INVALID               ((long long) 0xffffffffffff)
1146 +#define SQUASHFS_INVALID_BLK           ((long long) 0xffffffff)
1147 +#define SQUASHFS_USED_BLK              ((long long) 0xfffffffe)
1148 +
1149 +/* Filesystem flags */
1150 +#define SQUASHFS_NOI                   1
1151 +#define SQUASHFS_NOD                   2
1152 +#define SQUASHFS_CHECK                 4
1153 +#define SQUASHFS_UNCOMPRESSED_INODES(flags)    (flags & SQUASHFS_NOI)
1154 +#define SQUASHFS_UNCOMPRESSED_DATA(flags)      (flags & SQUASHFS_NOD)
1155 +#define SQUASHFS_CHECK_DATA(flags)             (flags & SQUASHFS_CHECK)
1156 +#define SQUASHFS_MKFLAGS(noi, nod, check_data) (noi | (nod << 1) | (check_data << 2))
1157 +
1158 +/* Max number of types and file types */
1159 +#define SQUASHFS_TYPES                 5
1160 +#define SQUASHFS_DIR_TYPE              1
1161 +#define SQUASHFS_FILE_TYPE             2
1162 +#define SQUASHFS_SYMLINK_TYPE          3
1163 +#define SQUASHFS_BLKDEV_TYPE           4
1164 +#define SQUASHFS_CHRDEV_TYPE           5
1165 +
1166 +/* Flag whether block is compressed or uncompressed, bit is set if block is uncompressed */
1167 +#define SQUASHFS_COMPRESSED_BIT                (1 << 15)
1168 +#define SQUASHFS_COMPRESSED_SIZE(B)    (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \
1169 +                                       (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT)
1170 +
1171 +#define SQUASHFS_COMPRESSED(B)         (!((B) & SQUASHFS_COMPRESSED_BIT))
1172 +
1173 +/*
1174 + * Inode number ops.  Inodes consist of a compressed block number, and an uncompressed
1175 + * offset within that block
1176 + */
1177 +#define SQUASHFS_INODE_BLK(a)          ((unsigned int) ((a) >> 16))
1178 +#define SQUASHFS_INODE_OFFSET(a)       ((unsigned int) ((a) & 0xffff))
1179 +#define SQUASHFS_MKINODE(A, B)         ((squashfs_inode)(((squashfs_inode) (A) << 16)\
1180 +                                       + (B)))
1181 +
1182 +/* Compute 32 bit VFS inode number from squashfs inode number */
1183 +#define SQUASHFS_MK_VFS_INODE(a, b)    ((unsigned int) (((a) << 8) + ((b) >> 2) + 1))
1184 +
1185 +/* Translate between VFS mode and squashfs mode */
1186 +#define SQUASHFS_MODE(a)               ((a) & 0xfff)
1187 +
1188 +/* cached data constants for filesystem */
1189 +#define SQUASHFS_CACHED_BLKS           8
1190 +
1191 +#define SQUASHFS_MAX_FILE_SIZE_LOG     32
1192 +#define SQUASHFS_MAX_FILE_SIZE         ((long long) 1 << SQUASHFS_MAX_FILE_SIZE_LOG - 1)
1193 +
1194 +#define SQUASHFS_MARKER_BYTE           0xff
1195 +
1196 +/*
1197 + * definitions for structures on disk
1198 + */
1199 +
1200 +typedef unsigned int           squashfs_block;
1201 +typedef long long              squashfs_inode;
1202 +
1203 +typedef unsigned int           squashfs_uid;
1204 +
1205 +typedef struct squashfs_super_block {
1206 +       unsigned int            s_magic __attribute__ ((packed));
1207 +       unsigned int            inodes __attribute__ ((packed));
1208 +       unsigned int            bytes_used __attribute__ ((packed));
1209 +       unsigned int            uid_start __attribute__ ((packed));
1210 +       unsigned int            guid_start __attribute__ ((packed));
1211 +       unsigned int            inode_table_start __attribute__ ((packed));
1212 +       unsigned int            directory_table_start __attribute__ ((packed));
1213 +       unsigned int            s_major:16 __attribute__ ((packed));
1214 +       unsigned int            s_minor:16 __attribute__ ((packed));
1215 +       unsigned int            block_size:16 __attribute__ ((packed));
1216 +       unsigned int            block_log:16 __attribute__ ((packed));
1217 +       unsigned int            flags:8 __attribute__ ((packed));
1218 +       unsigned int            no_uids:8 __attribute__ ((packed));
1219 +       unsigned int            no_guids:8 __attribute__ ((packed));
1220 +       time_t                  mkfs_time /* time of filesystem creation */ __attribute__ ((packed));
1221 +       squashfs_inode          root_inode __attribute__ ((packed));
1222 +} squashfs_super_block;
1223 +
1224 +typedef struct {
1225 +       unsigned int            inode_type:4 __attribute__ ((packed));
1226 +       unsigned int            mode:12 __attribute__ ((packed)); /* protection */
1227 +       unsigned int            uid:4 __attribute__ ((packed)); /* index into uid table */
1228 +       unsigned int            guid:4 __attribute__ ((packed)); /* index into guid table */
1229 +} squashfs_base_inode_header;
1230 +
1231 +typedef struct {
1232 +       unsigned int            inode_type:4 __attribute__ ((packed));
1233 +       unsigned int            mode:12 __attribute__ ((packed)); /* protection */
1234 +       unsigned int            uid:4 __attribute__ ((packed)); /* index into uid table */
1235 +       unsigned int            guid:4 __attribute__ ((packed)); /* index into guid table */
1236 +       unsigned short          rdev __attribute__ ((packed));
1237 +} squashfs_dev_inode_header;
1238 +       
1239 +typedef struct {
1240 +       unsigned int            inode_type:4 __attribute__ ((packed));
1241 +       unsigned int            mode:12 __attribute__ ((packed)); /* protection */
1242 +       unsigned int            uid:4 __attribute__ ((packed)); /* index into uid table */
1243 +       unsigned int            guid:4 __attribute__ ((packed)); /* index into guid table */
1244 +       unsigned short          symlink_size __attribute__ ((packed));
1245 +       char                    symlink[0] __attribute__ ((packed));
1246 +} squashfs_symlink_inode_header;
1247 +
1248 +typedef struct {
1249 +       unsigned int            inode_type:4 __attribute__ ((packed));
1250 +       unsigned int            mode:12 __attribute__ ((packed)); /* protection */
1251 +       unsigned int            uid:4 __attribute__ ((packed)); /* index into uid table */
1252 +       unsigned int            guid:4 __attribute__ ((packed)); /* index into guid table */
1253 +       time_t                  mtime __attribute__ ((packed));
1254 +       squashfs_block          start_block __attribute__ ((packed));
1255 +       unsigned int            file_size:SQUASHFS_MAX_FILE_SIZE_LOG __attribute__ ((packed));
1256 +       unsigned short          block_list[0]  __attribute__ ((packed));
1257 +} squashfs_reg_inode_header;
1258 +
1259 +typedef struct {
1260 +       unsigned int            inode_type:4 __attribute__ ((packed));
1261 +       unsigned int            mode:12 __attribute__ ((packed)); /* protection */
1262 +       unsigned int            uid:4 __attribute__ ((packed)); /* index into uid table */
1263 +       unsigned int            guid:4 __attribute__ ((packed)); /* index into guid table */
1264 +       unsigned int            file_size:19 __attribute__ ((packed));
1265 +       unsigned int            offset:13 __attribute__ ((packed));
1266 +       time_t                  mtime __attribute__ ((packed));
1267 +       unsigned int            start_block:24 __attribute__ ((packed));
1268 +} squashfs_dir_inode_header;
1269 +
1270 +typedef union {
1271 +       squashfs_base_inode_header      base;
1272 +       squashfs_dev_inode_header       dev;
1273 +       squashfs_symlink_inode_header   symlink;
1274 +       squashfs_reg_inode_header       reg;
1275 +       squashfs_dir_inode_header       dir;
1276 +} squashfs_inode_header;
1277 +       
1278 +typedef struct {
1279 +       unsigned int            offset:13 __attribute__ ((packed));
1280 +       unsigned int            type:3 __attribute__ ((packed));
1281 +       unsigned int            size:8 __attribute__ ((packed));
1282 +       char                    name[0] __attribute__ ((packed));
1283 +} squashfs_dir_entry;
1284 +
1285 +typedef struct {
1286 +       unsigned int            count:8 __attribute__ ((packed));
1287 +       unsigned int            start_block:24 __attribute__ ((packed));
1288 +} squashfs_dir_header;
1289 +
1290 +
1291 +extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen);
1292 +extern int squashfs_uncompress_init(void);
1293 +extern int squashfs_uncompress_exit(void);
1294 +
1295 +/*
1296 + * macros to convert each packed bitfield structure from little endian to big
1297 + * endian and vice versa.  These are needed when creating or using a filesystem on a
1298 + * machine with different byte ordering to the target architecture.
1299 + *
1300 + */
1301 +
1302 +#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\
1303 +       SQUASHFS_MEMSET(s, d, sizeof(squashfs_super_block));\
1304 +       SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\
1305 +       SQUASHFS_SWAP((s)->inodes, d, 32, 32);\
1306 +       SQUASHFS_SWAP((s)->bytes_used, d, 64, 32);\
1307 +       SQUASHFS_SWAP((s)->uid_start, d, 96, 32);\
1308 +       SQUASHFS_SWAP((s)->guid_start, d, 128, 32);\
1309 +       SQUASHFS_SWAP((s)->inode_table_start, d, 160, 32);\
1310 +       SQUASHFS_SWAP((s)->directory_table_start, d, 192, 32);\
1311 +       SQUASHFS_SWAP((s)->s_major, d, 224, 16);\
1312 +       SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\
1313 +       SQUASHFS_SWAP((s)->block_size, d, 256, 16);\
1314 +       SQUASHFS_SWAP((s)->block_log, d, 272, 16);\
1315 +       SQUASHFS_SWAP((s)->flags, d, 288, 8);\
1316 +       SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\
1317 +       SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\
1318 +       SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\
1319 +       SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\
1320 +}
1321 +
1322 +#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\
1323 +       SQUASHFS_MEMSET(s, d, n);\
1324 +       SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
1325 +       SQUASHFS_SWAP((s)->mode, d, 4, 12);\
1326 +       SQUASHFS_SWAP((s)->uid, d, 16, 4);\
1327 +       SQUASHFS_SWAP((s)->guid, d, 20, 4);\
1328 +}
1329 +
1330 +#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\
1331 +       SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\
1332 +       SQUASHFS_SWAP((s)->rdev, d, 24, 16);\
1333 +}
1334 +
1335 +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\
1336 +       SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header));\
1337 +       SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\
1338 +}
1339 +
1340 +#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\
1341 +       SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header));\
1342 +       SQUASHFS_SWAP((s)->mtime, d, 24, 32);\
1343 +       SQUASHFS_SWAP((s)->start_block, d, 56, 32);\
1344 +       SQUASHFS_SWAP((s)->file_size, d, 88, SQUASHFS_MAX_FILE_SIZE_LOG);\
1345 +}
1346 +
1347 +#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\
1348 +       SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header));\
1349 +       SQUASHFS_SWAP((s)->file_size, d, 24, 19);\
1350 +       SQUASHFS_SWAP((s)->offset, d, 43, 13);\
1351 +       SQUASHFS_SWAP((s)->mtime, d, 56, 32);\
1352 +       SQUASHFS_SWAP((s)->start_block, d, 88, 24);\
1353 +}
1354 +
1355 +#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\
1356 +       SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_header));\
1357 +       SQUASHFS_SWAP((s)->count, d, 0, 8);\
1358 +       SQUASHFS_SWAP((s)->start_block, d, 8, 24);\
1359 +}
1360 +
1361 +#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\
1362 +       SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_entry));\
1363 +       SQUASHFS_SWAP((s)->offset, d, 0, 13);\
1364 +       SQUASHFS_SWAP((s)->type, d, 13, 3);\
1365 +       SQUASHFS_SWAP((s)->size, d, 16, 8);\
1366 +}
1367 +
1368 +#define SQUASHFS_SWAP_SHORTS(s, d, n) {\
1369 +       int entry;\
1370 +       int bit_position;\
1371 +       SQUASHFS_MEMSET(s, d, n * 2);\
1372 +       for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 16)\
1373 +               SQUASHFS_SWAP(s[entry], d, bit_position, 16);\
1374 +}
1375 +
1376 +#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\
1377 +       int entry;\
1378 +       int bit_position;\
1379 +       SQUASHFS_MEMSET(s, d, n * bits / 8);\
1380 +       for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += bits)\
1381 +               SQUASHFS_SWAP(s[entry], d, bit_position, bits);\
1382 +}
1383 +
1384 +#ifdef __KERNEL__
1385 +/*
1386 + * macros used to swap each structure entry, taking into account
1387 + * bitfields and different bitfield placing conventions on differing architectures
1388 + */
1389 +#include <asm/byteorder.h>
1390 +#ifdef __BIG_ENDIAN
1391 +       /* convert from little endian to big endian */
1392 +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, b_pos)
1393 +#else
1394 +       /* convert from big endian to little endian */ 
1395 +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, 64 - tbits - b_pos)
1396 +#endif
1397 +
1398 +#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\
1399 +       int bits;\
1400 +       int b_pos = pos % 8;\
1401 +       unsigned long long val = 0;\
1402 +       unsigned char *s = (unsigned char *)p + (pos / 8);\
1403 +       unsigned char *d = ((unsigned char *) &val) + 7;\
1404 +       for(bits = 0; bits < (tbits + b_pos); bits += 8) \
1405 +               *d-- = *s++;\
1406 +       value = val >> (SHIFT);\
1407 +}
1408 +#define SQUASHFS_MEMSET(s, d, n)       memset(s, 0, n);
1409 +#endif
1410 +#endif
1411 diff -Naur linux-2.6.0-test1-ac2/include/linux/squashfs_fs_sb.h linux-2.6.0-test1-ac2-sfs/include/linux/squashfs_fs_sb.h
1412 --- linux-2.6.0-test1-ac2/include/linux/squashfs_fs_sb.h        1969-12-31 16:00:00.000000000 -0800
1413 +++ linux-2.6.0-test1-ac2-sfs/include/linux/squashfs_fs_sb.h    2003-07-18 16:12:47.000000000 -0700
1414 @@ -0,0 +1,41 @@
1415 +#ifndef SQUASHFS_FS_SB
1416 +#define SQUASHFS_FS_SB
1417 +/*
1418 + * Squashfs
1419 + *
1420 + * Copyright (c) 2002 Phillip Lougher <phillip@lougher.demon.co.uk>
1421 + *
1422 + * This program is free software; you can redistribute it and/or
1423 + * modify it under the terms of the GNU General Public License
1424 + * as published by the Free Software Foundation; either version
1425 + * 2 of the License, or (at your option) any later version.
1426 + *
1427 + * squashfs_fs_sb.h
1428 + */
1429 +
1430 +#include <linux/squashfs_fs.h>
1431 +
1432 +typedef struct {
1433 +       unsigned int    block;
1434 +       int             length;
1435 +       unsigned int    next_index;
1436 +       char            *data;
1437 +       } squashfs_cache;
1438 +
1439 +typedef struct squashfs_sb_info {
1440 +       squashfs_super_block    sBlk;
1441 +       int                     devblksize;
1442 +       int                     devblksize_log2;
1443 +       int                     swap;
1444 +       squashfs_cache          *block_cache;
1445 +       int                     next_cache;
1446 +       squashfs_uid            *uid;
1447 +       squashfs_uid            *guid;
1448 +       unsigned int            read_size;
1449 +       char                    *read_data;
1450 +       char                    *read_page;
1451 +       struct semaphore        read_page_mutex;
1452 +       struct semaphore        block_cache_mutex;
1453 +       wait_queue_head_t       waitq;
1454 +       } squashfs_sb_info;
1455 +#endif
1456 diff -Naur linux-2.6.0-test1-ac2/lib/Kconfig linux-2.6.0-test1-ac2-sfs/lib/Kconfig
1457 --- linux-2.6.0-test1-ac2/lib/Kconfig   2003-05-04 16:53:32.000000000 -0700
1458 +++ linux-2.6.0-test1-ac2-sfs/lib/Kconfig       2003-07-16 16:40:44.000000000 -0700
1459 @@ -17,8 +17,8 @@
1460  #
1461  config ZLIB_INFLATE
1462         tristate
1463 -       default y if CRAMFS=y || PPP_DEFLATE=y || JFFS2_FS=y || ZISOFS_FS=y || BINFMT_ZFLAT=y || CRYPTO_DEFLATE=y
1464 -       default m if CRAMFS=m || PPP_DEFLATE=m || JFFS2_FS=m || ZISOFS_FS=m || BINFMT_ZFLAT=m || CRYPTO_DEFLATE=m
1465 +       default y if CRAMFS=y || SQUASHFS=y || PPP_DEFLATE=y || JFFS2_FS=y || ZISOFS_FS=y || BINFMT_ZFLAT=y || CRYPTO_DEFLATE=y
1466 +       default m if CRAMFS=m || SQUASHFS=m || PPP_DEFLATE=m || JFFS2_FS=m || ZISOFS_FS=m || BINFMT_ZFLAT=m || CRYPTO_DEFLATE=m
1467  
1468  config ZLIB_DEFLATE
1469         tristate
This page took 0.250249 seconds and 3 git commands to generate.