1 diff -x .gitignore -Nurp linux-2.6.27-rc4/include/linux/squashfs_fs.h linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs.h
2 --- linux-2.6.27-rc4/include/linux/squashfs_fs.h 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs.h 2008-08-19 18:31:56.000000000 +0100
11 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
12 + * Phillip Lougher <phillip@lougher.demon.co.uk>
14 + * This program is free software; you can redistribute it and/or
15 + * modify it under the terms of the GNU General Public License
16 + * as published by the Free Software Foundation; either version 2,
17 + * or (at your option) any later version.
19 + * This program is distributed in the hope that it will be useful,
20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 + * GNU General Public License for more details.
24 + * You should have received a copy of the GNU General Public License
25 + * along with this program; if not, write to the Free Software
26 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 +#ifndef CONFIG_SQUASHFS_2_0_COMPATIBILITY
32 +#define CONFIG_SQUASHFS_2_0_COMPATIBILITY
35 +#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
36 +#define SQUASHFS_MAJOR 3
37 +#define SQUASHFS_MINOR 1
38 +#define SQUASHFS_MAGIC 0x73717368
39 +#define SQUASHFS_MAGIC_SWAP 0x68737173
40 +#define SQUASHFS_START 0
42 +/* size of metadata (inode and directory) blocks */
43 +#define SQUASHFS_METADATA_SIZE 8192
44 +#define SQUASHFS_METADATA_LOG 13
46 +/* default size of data blocks */
47 +#define SQUASHFS_FILE_SIZE 131072
48 +#define SQUASHFS_FILE_LOG 17
50 +#define SQUASHFS_FILE_MAX_SIZE 1048576
52 +/* Max number of uids and gids */
53 +#define SQUASHFS_UIDS 256
54 +#define SQUASHFS_GUIDS 255
56 +/* Max length of filename (not 255) */
57 +#define SQUASHFS_NAME_LEN 256
59 +#define SQUASHFS_INVALID ((long long) 0xffffffffffff)
60 +#define SQUASHFS_INVALID_FRAG ((unsigned int) 0xffffffff)
61 +#define SQUASHFS_INVALID_BLK ((long long) -1)
62 +#define SQUASHFS_USED_BLK ((long long) -2)
64 +/* Filesystem flags */
65 +#define SQUASHFS_NOI 0
66 +#define SQUASHFS_NOD 1
67 +#define SQUASHFS_CHECK 2
68 +#define SQUASHFS_NOF 3
69 +#define SQUASHFS_NO_FRAG 4
70 +#define SQUASHFS_ALWAYS_FRAG 5
71 +#define SQUASHFS_DUPLICATE 6
72 +#define SQUASHFS_EXPORT 7
74 +#define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1)
76 +#define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, \
79 +#define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, \
82 +#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, \
85 +#define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, \
88 +#define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, \
89 + SQUASHFS_ALWAYS_FRAG)
91 +#define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, \
94 +#define SQUASHFS_EXPORTABLE(flags) SQUASHFS_BIT(flags, \
97 +#define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, \
100 +#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \
101 + duplicate_checking, exportable) (noi | (nod << 1) | (check_data << 2) \
102 + | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \
103 + (duplicate_checking << 6) | (exportable << 7))
105 +/* Max number of types and file types */
106 +#define SQUASHFS_DIR_TYPE 1
107 +#define SQUASHFS_FILE_TYPE 2
108 +#define SQUASHFS_SYMLINK_TYPE 3
109 +#define SQUASHFS_BLKDEV_TYPE 4
110 +#define SQUASHFS_CHRDEV_TYPE 5
111 +#define SQUASHFS_FIFO_TYPE 6
112 +#define SQUASHFS_SOCKET_TYPE 7
113 +#define SQUASHFS_LDIR_TYPE 8
114 +#define SQUASHFS_LREG_TYPE 9
116 +/* 1.0 filesystem type definitions */
117 +#define SQUASHFS_TYPES 5
118 +#define SQUASHFS_IPC_TYPE 0
120 +/* Flag whether block is compressed or uncompressed, bit is set if block is
122 +#define SQUASHFS_COMPRESSED_BIT (1 << 15)
124 +#define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \
125 + (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT)
127 +#define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT))
129 +#define SQUASHFS_COMPRESSED_BIT_BLOCK (1 << 24)
131 +#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) ((B) & \
132 + ~SQUASHFS_COMPRESSED_BIT_BLOCK)
134 +#define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
137 + * Inode number ops. Inodes consist of a compressed block number, and an
138 + * uncompressed offset within that block
140 +#define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16))
142 +#define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff))
144 +#define SQUASHFS_MKINODE(A, B) ((squashfs_inode_t)(((squashfs_inode_t) (A)\
147 +/* Compute 32 bit VFS inode number from squashfs inode number */
148 +#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + \
152 +/* Translate between VFS mode and squashfs mode */
153 +#define SQUASHFS_MODE(a) ((a) & 0xfff)
155 +/* fragment and fragment table defines */
156 +#define SQUASHFS_FRAGMENT_BYTES(A) ((A) * sizeof(struct squashfs_fragment_entry))
158 +#define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / \
159 + SQUASHFS_METADATA_SIZE)
161 +#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % \
162 + SQUASHFS_METADATA_SIZE)
164 +#define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + \
165 + SQUASHFS_METADATA_SIZE - 1) / \
166 + SQUASHFS_METADATA_SIZE)
168 +#define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) *\
171 +/* inode lookup table defines */
172 +#define SQUASHFS_LOOKUP_BYTES(A) ((A) * sizeof(squashfs_inode_t))
174 +#define SQUASHFS_LOOKUP_BLOCK(A) (SQUASHFS_LOOKUP_BYTES(A) / \
175 + SQUASHFS_METADATA_SIZE)
177 +#define SQUASHFS_LOOKUP_BLOCK_OFFSET(A) (SQUASHFS_LOOKUP_BYTES(A) % \
178 + SQUASHFS_METADATA_SIZE)
180 +#define SQUASHFS_LOOKUP_BLOCKS(A) ((SQUASHFS_LOOKUP_BYTES(A) + \
181 + SQUASHFS_METADATA_SIZE - 1) / \
182 + SQUASHFS_METADATA_SIZE)
184 +#define SQUASHFS_LOOKUP_BLOCK_BYTES(A) (SQUASHFS_LOOKUP_BLOCKS(A) *\
187 +/* cached data constants for filesystem */
188 +#define SQUASHFS_CACHED_BLKS 8
190 +#define SQUASHFS_MAX_FILE_SIZE_LOG 64
192 +#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << \
193 + (SQUASHFS_MAX_FILE_SIZE_LOG - 2))
195 +#define SQUASHFS_MARKER_BYTE 0xff
197 +/* meta index cache */
198 +#define SQUASHFS_META_INDEXES (SQUASHFS_METADATA_SIZE / sizeof(unsigned int))
199 +#define SQUASHFS_META_ENTRIES 31
200 +#define SQUASHFS_META_NUMBER 8
201 +#define SQUASHFS_SLOTS 4
204 + long long data_block;
205 + unsigned int index_block;
206 + unsigned short offset;
207 + unsigned short pad;
211 + unsigned int inode_number;
212 + unsigned int offset;
213 + unsigned short entries;
214 + unsigned short skip;
215 + unsigned short locked;
216 + unsigned short pad;
217 + struct meta_entry meta_entry[SQUASHFS_META_ENTRIES];
222 + * definitions for structures on disk
225 +typedef long long squashfs_block_t;
226 +typedef long long squashfs_inode_t;
228 +struct squashfs_super_block {
229 + unsigned int s_magic;
230 + unsigned int inodes;
231 + unsigned int bytes_used_2;
232 + unsigned int uid_start_2;
233 + unsigned int guid_start_2;
234 + unsigned int inode_table_start_2;
235 + unsigned int directory_table_start_2;
236 + unsigned int s_major:16;
237 + unsigned int s_minor:16;
238 + unsigned int block_size_1:16;
239 + unsigned int block_log:16;
240 + unsigned int flags:8;
241 + unsigned int no_uids:8;
242 + unsigned int no_guids:8;
243 + unsigned int mkfs_time /* time of filesystem creation */;
244 + squashfs_inode_t root_inode;
245 + unsigned int block_size;
246 + unsigned int fragments;
247 + unsigned int fragment_table_start_2;
248 + long long bytes_used;
249 + long long uid_start;
250 + long long guid_start;
251 + long long inode_table_start;
252 + long long directory_table_start;
253 + long long fragment_table_start;
254 + long long lookup_table_start;
255 +} __attribute__ ((packed));
257 +struct squashfs_dir_index {
258 + unsigned int index;
259 + unsigned int start_block;
260 + unsigned char size;
261 + unsigned char name[0];
262 +} __attribute__ ((packed));
264 +#define SQUASHFS_BASE_INODE_HEADER \
265 + unsigned int inode_type:4; \
266 + unsigned int mode:12; \
267 + unsigned int uid:8; \
268 + unsigned int guid:8; \
269 + unsigned int mtime; \
270 + unsigned int inode_number;
272 +struct squashfs_base_inode_header {
273 + SQUASHFS_BASE_INODE_HEADER;
274 +} __attribute__ ((packed));
276 +struct squashfs_ipc_inode_header {
277 + SQUASHFS_BASE_INODE_HEADER;
278 + unsigned int nlink;
279 +} __attribute__ ((packed));
281 +struct squashfs_dev_inode_header {
282 + SQUASHFS_BASE_INODE_HEADER;
283 + unsigned int nlink;
284 + unsigned short rdev;
285 +} __attribute__ ((packed));
287 +struct squashfs_symlink_inode_header {
288 + SQUASHFS_BASE_INODE_HEADER;
289 + unsigned int nlink;
290 + unsigned short symlink_size;
292 +} __attribute__ ((packed));
294 +struct squashfs_reg_inode_header {
295 + SQUASHFS_BASE_INODE_HEADER;
296 + squashfs_block_t start_block;
297 + unsigned int fragment;
298 + unsigned int offset;
299 + unsigned int file_size;
300 + unsigned short block_list[0];
301 +} __attribute__ ((packed));
303 +struct squashfs_lreg_inode_header {
304 + SQUASHFS_BASE_INODE_HEADER;
305 + unsigned int nlink;
306 + squashfs_block_t start_block;
307 + unsigned int fragment;
308 + unsigned int offset;
309 + long long file_size;
310 + unsigned short block_list[0];
311 +} __attribute__ ((packed));
313 +struct squashfs_dir_inode_header {
314 + SQUASHFS_BASE_INODE_HEADER;
315 + unsigned int nlink;
316 + unsigned int file_size:19;
317 + unsigned int offset:13;
318 + unsigned int start_block;
319 + unsigned int parent_inode;
320 +} __attribute__ ((packed));
322 +struct squashfs_ldir_inode_header {
323 + SQUASHFS_BASE_INODE_HEADER;
324 + unsigned int nlink;
325 + unsigned int file_size:27;
326 + unsigned int offset:13;
327 + unsigned int start_block;
328 + unsigned int i_count:16;
329 + unsigned int parent_inode;
330 + struct squashfs_dir_index index[0];
331 +} __attribute__ ((packed));
333 +union squashfs_inode_header {
334 + struct squashfs_base_inode_header base;
335 + struct squashfs_dev_inode_header dev;
336 + struct squashfs_symlink_inode_header symlink;
337 + struct squashfs_reg_inode_header reg;
338 + struct squashfs_lreg_inode_header lreg;
339 + struct squashfs_dir_inode_header dir;
340 + struct squashfs_ldir_inode_header ldir;
341 + struct squashfs_ipc_inode_header ipc;
344 +struct squashfs_dir_entry {
345 + unsigned int offset:13;
346 + unsigned int type:3;
347 + unsigned int size:8;
348 + int inode_number:16;
350 +} __attribute__ ((packed));
352 +struct squashfs_dir_header {
353 + unsigned int count:8;
354 + unsigned int start_block;
355 + unsigned int inode_number;
356 +} __attribute__ ((packed));
358 +struct squashfs_fragment_entry {
359 + long long start_block;
361 + unsigned int unused;
362 +} __attribute__ ((packed));
364 +extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen);
365 +extern int squashfs_uncompress_init(void);
366 +extern int squashfs_uncompress_exit(void);
369 + * macros to convert each packed bitfield structure from little endian to big
370 + * endian and vice versa. These are needed when creating or using a filesystem
371 + * on a machine with different byte ordering to the target architecture.
375 +#define SQUASHFS_SWAP_START \
378 + unsigned long long val;\
382 +#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\
383 + SQUASHFS_SWAP_START\
384 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_super_block));\
385 + SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\
386 + SQUASHFS_SWAP((s)->inodes, d, 32, 32);\
387 + SQUASHFS_SWAP((s)->bytes_used_2, d, 64, 32);\
388 + SQUASHFS_SWAP((s)->uid_start_2, d, 96, 32);\
389 + SQUASHFS_SWAP((s)->guid_start_2, d, 128, 32);\
390 + SQUASHFS_SWAP((s)->inode_table_start_2, d, 160, 32);\
391 + SQUASHFS_SWAP((s)->directory_table_start_2, d, 192, 32);\
392 + SQUASHFS_SWAP((s)->s_major, d, 224, 16);\
393 + SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\
394 + SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\
395 + SQUASHFS_SWAP((s)->block_log, d, 272, 16);\
396 + SQUASHFS_SWAP((s)->flags, d, 288, 8);\
397 + SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\
398 + SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\
399 + SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\
400 + SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\
401 + SQUASHFS_SWAP((s)->block_size, d, 408, 32);\
402 + SQUASHFS_SWAP((s)->fragments, d, 440, 32);\
403 + SQUASHFS_SWAP((s)->fragment_table_start_2, d, 472, 32);\
404 + SQUASHFS_SWAP((s)->bytes_used, d, 504, 64);\
405 + SQUASHFS_SWAP((s)->uid_start, d, 568, 64);\
406 + SQUASHFS_SWAP((s)->guid_start, d, 632, 64);\
407 + SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\
408 + SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\
409 + SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\
410 + SQUASHFS_SWAP((s)->lookup_table_start, d, 888, 64);\
413 +#define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\
414 + SQUASHFS_MEMSET(s, d, n);\
415 + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
416 + SQUASHFS_SWAP((s)->mode, d, 4, 12);\
417 + SQUASHFS_SWAP((s)->uid, d, 16, 8);\
418 + SQUASHFS_SWAP((s)->guid, d, 24, 8);\
419 + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\
420 + SQUASHFS_SWAP((s)->inode_number, d, 64, 32);
422 +#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\
423 + SQUASHFS_SWAP_START\
424 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\
427 +#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\
428 + SQUASHFS_SWAP_START\
429 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
430 + sizeof(struct squashfs_ipc_inode_header))\
431 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
434 +#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\
435 + SQUASHFS_SWAP_START\
436 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
437 + sizeof(struct squashfs_dev_inode_header)); \
438 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
439 + SQUASHFS_SWAP((s)->rdev, d, 128, 16);\
442 +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\
443 + SQUASHFS_SWAP_START\
444 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
445 + sizeof(struct squashfs_symlink_inode_header));\
446 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
447 + SQUASHFS_SWAP((s)->symlink_size, d, 128, 16);\
450 +#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\
451 + SQUASHFS_SWAP_START\
452 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
453 + sizeof(struct squashfs_reg_inode_header));\
454 + SQUASHFS_SWAP((s)->start_block, d, 96, 64);\
455 + SQUASHFS_SWAP((s)->fragment, d, 160, 32);\
456 + SQUASHFS_SWAP((s)->offset, d, 192, 32);\
457 + SQUASHFS_SWAP((s)->file_size, d, 224, 32);\
460 +#define SQUASHFS_SWAP_LREG_INODE_HEADER(s, d) {\
461 + SQUASHFS_SWAP_START\
462 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
463 + sizeof(struct squashfs_lreg_inode_header));\
464 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
465 + SQUASHFS_SWAP((s)->start_block, d, 128, 64);\
466 + SQUASHFS_SWAP((s)->fragment, d, 192, 32);\
467 + SQUASHFS_SWAP((s)->offset, d, 224, 32);\
468 + SQUASHFS_SWAP((s)->file_size, d, 256, 64);\
471 +#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\
472 + SQUASHFS_SWAP_START\
473 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
474 + sizeof(struct squashfs_dir_inode_header));\
475 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
476 + SQUASHFS_SWAP((s)->file_size, d, 128, 19);\
477 + SQUASHFS_SWAP((s)->offset, d, 147, 13);\
478 + SQUASHFS_SWAP((s)->start_block, d, 160, 32);\
479 + SQUASHFS_SWAP((s)->parent_inode, d, 192, 32);\
482 +#define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\
483 + SQUASHFS_SWAP_START\
484 + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
485 + sizeof(struct squashfs_ldir_inode_header));\
486 + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
487 + SQUASHFS_SWAP((s)->file_size, d, 128, 27);\
488 + SQUASHFS_SWAP((s)->offset, d, 155, 13);\
489 + SQUASHFS_SWAP((s)->start_block, d, 168, 32);\
490 + SQUASHFS_SWAP((s)->i_count, d, 200, 16);\
491 + SQUASHFS_SWAP((s)->parent_inode, d, 216, 32);\
494 +#define SQUASHFS_SWAP_DIR_INDEX(s, d) {\
495 + SQUASHFS_SWAP_START\
496 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index));\
497 + SQUASHFS_SWAP((s)->index, d, 0, 32);\
498 + SQUASHFS_SWAP((s)->start_block, d, 32, 32);\
499 + SQUASHFS_SWAP((s)->size, d, 64, 8);\
502 +#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\
503 + SQUASHFS_SWAP_START\
504 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header));\
505 + SQUASHFS_SWAP((s)->count, d, 0, 8);\
506 + SQUASHFS_SWAP((s)->start_block, d, 8, 32);\
507 + SQUASHFS_SWAP((s)->inode_number, d, 40, 32);\
510 +#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\
511 + SQUASHFS_SWAP_START\
512 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry));\
513 + SQUASHFS_SWAP((s)->offset, d, 0, 13);\
514 + SQUASHFS_SWAP((s)->type, d, 13, 3);\
515 + SQUASHFS_SWAP((s)->size, d, 16, 8);\
516 + SQUASHFS_SWAP((s)->inode_number, d, 24, 16);\
519 +#define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\
520 + SQUASHFS_SWAP_START\
521 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry));\
522 + SQUASHFS_SWAP((s)->start_block, d, 0, 64);\
523 + SQUASHFS_SWAP((s)->size, d, 64, 32);\
526 +#define SQUASHFS_SWAP_INODE_T(s, d) SQUASHFS_SWAP_LONG_LONGS(s, d, 1)
528 +#define SQUASHFS_SWAP_SHORTS(s, d, n) {\
531 + SQUASHFS_SWAP_START\
532 + SQUASHFS_MEMSET(s, d, n * 2);\
533 + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
535 + SQUASHFS_SWAP(s[entry], d, bit_position, 16);\
538 +#define SQUASHFS_SWAP_INTS(s, d, n) {\
541 + SQUASHFS_SWAP_START\
542 + SQUASHFS_MEMSET(s, d, n * 4);\
543 + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
545 + SQUASHFS_SWAP(s[entry], d, bit_position, 32);\
548 +#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) {\
551 + SQUASHFS_SWAP_START\
552 + SQUASHFS_MEMSET(s, d, n * 8);\
553 + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
555 + SQUASHFS_SWAP(s[entry], d, bit_position, 64);\
558 +#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\
561 + SQUASHFS_SWAP_START\
562 + SQUASHFS_MEMSET(s, d, n * bits / 8);\
563 + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
565 + SQUASHFS_SWAP(s[entry], d, bit_position, bits);\
568 +#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n)
569 +#define SQUASHFS_SWAP_LOOKUP_BLOCKS(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n)
571 +#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
573 +struct squashfs_base_inode_header_1 {
574 + unsigned int inode_type:4;
575 + unsigned int mode:12; /* protection */
576 + unsigned int uid:4; /* index into uid table */
577 + unsigned int guid:4; /* index into guid table */
578 +} __attribute__ ((packed));
580 +struct squashfs_ipc_inode_header_1 {
581 + unsigned int inode_type:4;
582 + unsigned int mode:12; /* protection */
583 + unsigned int uid:4; /* index into uid table */
584 + unsigned int guid:4; /* index into guid table */
585 + unsigned int type:4;
586 + unsigned int offset:4;
587 +} __attribute__ ((packed));
589 +struct squashfs_dev_inode_header_1 {
590 + unsigned int inode_type:4;
591 + unsigned int mode:12; /* protection */
592 + unsigned int uid:4; /* index into uid table */
593 + unsigned int guid:4; /* index into guid table */
594 + unsigned short rdev;
595 +} __attribute__ ((packed));
597 +struct squashfs_symlink_inode_header_1 {
598 + unsigned int inode_type:4;
599 + unsigned int mode:12; /* protection */
600 + unsigned int uid:4; /* index into uid table */
601 + unsigned int guid:4; /* index into guid table */
602 + unsigned short symlink_size;
604 +} __attribute__ ((packed));
606 +struct squashfs_reg_inode_header_1 {
607 + unsigned int inode_type:4;
608 + unsigned int mode:12; /* protection */
609 + unsigned int uid:4; /* index into uid table */
610 + unsigned int guid:4; /* index into guid table */
611 + unsigned int mtime;
612 + unsigned int start_block;
613 + unsigned int file_size:32;
614 + unsigned short block_list[0];
615 +} __attribute__ ((packed));
617 +struct squashfs_dir_inode_header_1 {
618 + unsigned int inode_type:4;
619 + unsigned int mode:12; /* protection */
620 + unsigned int uid:4; /* index into uid table */
621 + unsigned int guid:4; /* index into guid table */
622 + unsigned int file_size:19;
623 + unsigned int offset:13;
624 + unsigned int mtime;
625 + unsigned int start_block:24;
626 +} __attribute__ ((packed));
628 +union squashfs_inode_header_1 {
629 + struct squashfs_base_inode_header_1 base;
630 + struct squashfs_dev_inode_header_1 dev;
631 + struct squashfs_symlink_inode_header_1 symlink;
632 + struct squashfs_reg_inode_header_1 reg;
633 + struct squashfs_dir_inode_header_1 dir;
634 + struct squashfs_ipc_inode_header_1 ipc;
637 +#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \
638 + SQUASHFS_MEMSET(s, d, n);\
639 + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
640 + SQUASHFS_SWAP((s)->mode, d, 4, 12);\
641 + SQUASHFS_SWAP((s)->uid, d, 16, 4);\
642 + SQUASHFS_SWAP((s)->guid, d, 20, 4);
644 +#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\
645 + SQUASHFS_SWAP_START\
646 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n)\
649 +#define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\
650 + SQUASHFS_SWAP_START\
651 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
652 + sizeof(struct squashfs_ipc_inode_header_1));\
653 + SQUASHFS_SWAP((s)->type, d, 24, 4);\
654 + SQUASHFS_SWAP((s)->offset, d, 28, 4);\
657 +#define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\
658 + SQUASHFS_SWAP_START\
659 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
660 + sizeof(struct squashfs_dev_inode_header_1));\
661 + SQUASHFS_SWAP((s)->rdev, d, 24, 16);\
664 +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\
665 + SQUASHFS_SWAP_START\
666 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
667 + sizeof(struct squashfs_symlink_inode_header_1));\
668 + SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\
671 +#define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\
672 + SQUASHFS_SWAP_START\
673 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
674 + sizeof(struct squashfs_reg_inode_header_1));\
675 + SQUASHFS_SWAP((s)->mtime, d, 24, 32);\
676 + SQUASHFS_SWAP((s)->start_block, d, 56, 32);\
677 + SQUASHFS_SWAP((s)->file_size, d, 88, 32);\
680 +#define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\
681 + SQUASHFS_SWAP_START\
682 + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
683 + sizeof(struct squashfs_dir_inode_header_1));\
684 + SQUASHFS_SWAP((s)->file_size, d, 24, 19);\
685 + SQUASHFS_SWAP((s)->offset, d, 43, 13);\
686 + SQUASHFS_SWAP((s)->mtime, d, 56, 32);\
687 + SQUASHFS_SWAP((s)->start_block, d, 88, 24);\
692 +#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
694 +struct squashfs_dir_index_2 {
695 + unsigned int index:27;
696 + unsigned int start_block:29;
697 + unsigned char size;
698 + unsigned char name[0];
699 +} __attribute__ ((packed));
701 +struct squashfs_base_inode_header_2 {
702 + unsigned int inode_type:4;
703 + unsigned int mode:12; /* protection */
704 + unsigned int uid:8; /* index into uid table */
705 + unsigned int guid:8; /* index into guid table */
706 +} __attribute__ ((packed));
708 +struct squashfs_ipc_inode_header_2 {
709 + unsigned int inode_type:4;
710 + unsigned int mode:12; /* protection */
711 + unsigned int uid:8; /* index into uid table */
712 + unsigned int guid:8; /* index into guid table */
713 +} __attribute__ ((packed));
715 +struct squashfs_dev_inode_header_2 {
716 + unsigned int inode_type:4;
717 + unsigned int mode:12; /* protection */
718 + unsigned int uid:8; /* index into uid table */
719 + unsigned int guid:8; /* index into guid table */
720 + unsigned short rdev;
721 +} __attribute__ ((packed));
723 +struct squashfs_symlink_inode_header_2 {
724 + unsigned int inode_type:4;
725 + unsigned int mode:12; /* protection */
726 + unsigned int uid:8; /* index into uid table */
727 + unsigned int guid:8; /* index into guid table */
728 + unsigned short symlink_size;
730 +} __attribute__ ((packed));
732 +struct squashfs_reg_inode_header_2 {
733 + unsigned int inode_type:4;
734 + unsigned int mode:12; /* protection */
735 + unsigned int uid:8; /* index into uid table */
736 + unsigned int guid:8; /* index into guid table */
737 + unsigned int mtime;
738 + unsigned int start_block;
739 + unsigned int fragment;
740 + unsigned int offset;
741 + unsigned int file_size:32;
742 + unsigned short block_list[0];
743 +} __attribute__ ((packed));
745 +struct squashfs_dir_inode_header_2 {
746 + unsigned int inode_type:4;
747 + unsigned int mode:12; /* protection */
748 + unsigned int uid:8; /* index into uid table */
749 + unsigned int guid:8; /* index into guid table */
750 + unsigned int file_size:19;
751 + unsigned int offset:13;
752 + unsigned int mtime;
753 + unsigned int start_block:24;
754 +} __attribute__ ((packed));
756 +struct squashfs_ldir_inode_header_2 {
757 + unsigned int inode_type:4;
758 + unsigned int mode:12; /* protection */
759 + unsigned int uid:8; /* index into uid table */
760 + unsigned int guid:8; /* index into guid table */
761 + unsigned int file_size:27;
762 + unsigned int offset:13;
763 + unsigned int mtime;
764 + unsigned int start_block:24;
765 + unsigned int i_count:16;
766 + struct squashfs_dir_index_2 index[0];
767 +} __attribute__ ((packed));
769 +union squashfs_inode_header_2 {
770 + struct squashfs_base_inode_header_2 base;
771 + struct squashfs_dev_inode_header_2 dev;
772 + struct squashfs_symlink_inode_header_2 symlink;
773 + struct squashfs_reg_inode_header_2 reg;
774 + struct squashfs_dir_inode_header_2 dir;
775 + struct squashfs_ldir_inode_header_2 ldir;
776 + struct squashfs_ipc_inode_header_2 ipc;
779 +struct squashfs_dir_header_2 {
780 + unsigned int count:8;
781 + unsigned int start_block:24;
782 +} __attribute__ ((packed));
784 +struct squashfs_dir_entry_2 {
785 + unsigned int offset:13;
786 + unsigned int type:3;
787 + unsigned int size:8;
789 +} __attribute__ ((packed));
791 +struct squashfs_fragment_entry_2 {
792 + unsigned int start_block;
794 +} __attribute__ ((packed));
796 +#define SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\
797 + SQUASHFS_MEMSET(s, d, n);\
798 + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
799 + SQUASHFS_SWAP((s)->mode, d, 4, 12);\
800 + SQUASHFS_SWAP((s)->uid, d, 16, 8);\
801 + SQUASHFS_SWAP((s)->guid, d, 24, 8);\
803 +#define SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, n) {\
804 + SQUASHFS_SWAP_START\
805 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\
808 +#define SQUASHFS_SWAP_IPC_INODE_HEADER_2(s, d) \
809 + SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, sizeof(struct squashfs_ipc_inode_header_2))
811 +#define SQUASHFS_SWAP_DEV_INODE_HEADER_2(s, d) {\
812 + SQUASHFS_SWAP_START\
813 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
814 + sizeof(struct squashfs_dev_inode_header_2)); \
815 + SQUASHFS_SWAP((s)->rdev, d, 32, 16);\
818 +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(s, d) {\
819 + SQUASHFS_SWAP_START\
820 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
821 + sizeof(struct squashfs_symlink_inode_header_2));\
822 + SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\
825 +#define SQUASHFS_SWAP_REG_INODE_HEADER_2(s, d) {\
826 + SQUASHFS_SWAP_START\
827 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
828 + sizeof(struct squashfs_reg_inode_header_2));\
829 + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\
830 + SQUASHFS_SWAP((s)->start_block, d, 64, 32);\
831 + SQUASHFS_SWAP((s)->fragment, d, 96, 32);\
832 + SQUASHFS_SWAP((s)->offset, d, 128, 32);\
833 + SQUASHFS_SWAP((s)->file_size, d, 160, 32);\
836 +#define SQUASHFS_SWAP_DIR_INODE_HEADER_2(s, d) {\
837 + SQUASHFS_SWAP_START\
838 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
839 + sizeof(struct squashfs_dir_inode_header_2));\
840 + SQUASHFS_SWAP((s)->file_size, d, 32, 19);\
841 + SQUASHFS_SWAP((s)->offset, d, 51, 13);\
842 + SQUASHFS_SWAP((s)->mtime, d, 64, 32);\
843 + SQUASHFS_SWAP((s)->start_block, d, 96, 24);\
846 +#define SQUASHFS_SWAP_LDIR_INODE_HEADER_2(s, d) {\
847 + SQUASHFS_SWAP_START\
848 + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
849 + sizeof(struct squashfs_ldir_inode_header_2));\
850 + SQUASHFS_SWAP((s)->file_size, d, 32, 27);\
851 + SQUASHFS_SWAP((s)->offset, d, 59, 13);\
852 + SQUASHFS_SWAP((s)->mtime, d, 72, 32);\
853 + SQUASHFS_SWAP((s)->start_block, d, 104, 24);\
854 + SQUASHFS_SWAP((s)->i_count, d, 128, 16);\
857 +#define SQUASHFS_SWAP_DIR_INDEX_2(s, d) {\
858 + SQUASHFS_SWAP_START\
859 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index_2));\
860 + SQUASHFS_SWAP((s)->index, d, 0, 27);\
861 + SQUASHFS_SWAP((s)->start_block, d, 27, 29);\
862 + SQUASHFS_SWAP((s)->size, d, 56, 8);\
864 +#define SQUASHFS_SWAP_DIR_HEADER_2(s, d) {\
865 + SQUASHFS_SWAP_START\
866 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header_2));\
867 + SQUASHFS_SWAP((s)->count, d, 0, 8);\
868 + SQUASHFS_SWAP((s)->start_block, d, 8, 24);\
871 +#define SQUASHFS_SWAP_DIR_ENTRY_2(s, d) {\
872 + SQUASHFS_SWAP_START\
873 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry_2));\
874 + SQUASHFS_SWAP((s)->offset, d, 0, 13);\
875 + SQUASHFS_SWAP((s)->type, d, 13, 3);\
876 + SQUASHFS_SWAP((s)->size, d, 16, 8);\
879 +#define SQUASHFS_SWAP_FRAGMENT_ENTRY_2(s, d) {\
880 + SQUASHFS_SWAP_START\
881 + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry_2));\
882 + SQUASHFS_SWAP((s)->start_block, d, 0, 32);\
883 + SQUASHFS_SWAP((s)->size, d, 32, 32);\
886 +#define SQUASHFS_SWAP_FRAGMENT_INDEXES_2(s, d, n) SQUASHFS_SWAP_INTS(s, d, n)
888 +/* fragment and fragment table defines */
889 +#define SQUASHFS_FRAGMENT_BYTES_2(A) (A * sizeof(struct squashfs_fragment_entry_2))
891 +#define SQUASHFS_FRAGMENT_INDEX_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) / \
892 + SQUASHFS_METADATA_SIZE)
894 +#define SQUASHFS_FRAGMENT_INDEX_OFFSET_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) % \
895 + SQUASHFS_METADATA_SIZE)
897 +#define SQUASHFS_FRAGMENT_INDEXES_2(A) ((SQUASHFS_FRAGMENT_BYTES_2(A) + \
898 + SQUASHFS_METADATA_SIZE - 1) / \
899 + SQUASHFS_METADATA_SIZE)
901 +#define SQUASHFS_FRAGMENT_INDEX_BYTES_2(A) (SQUASHFS_FRAGMENT_INDEXES_2(A) *\
909 + * macros used to swap each structure entry, taking into account
910 + * bitfields and different bitfield placing conventions on differing
914 +#include <asm/byteorder.h>
917 + /* convert from little endian to big endian */
918 +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \
921 + /* convert from big endian to little endian */
922 +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \
923 + tbits, 64 - tbits - b_pos)
926 +#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\
929 + s = (unsigned char *)p + (pos / 8);\
930 + d = ((unsigned char *) &val) + 7;\
931 + for(bits = 0; bits < (tbits + b_pos); bits += 8) \
933 + value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\
936 +#define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n);
940 diff -x .gitignore -Nurp linux-2.6.27-rc4/include/linux/squashfs_fs_i.h linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs_i.h
941 --- linux-2.6.27-rc4/include/linux/squashfs_fs_i.h 1970-01-01 01:00:00.000000000 +0100
942 +++ linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs_i.h 2008-08-19 18:31:56.000000000 +0100
944 +#ifndef SQUASHFS_FS_I
945 +#define SQUASHFS_FS_I
949 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
950 + * Phillip Lougher <phillip@lougher.demon.co.uk>
952 + * This program is free software; you can redistribute it and/or
953 + * modify it under the terms of the GNU General Public License
954 + * as published by the Free Software Foundation; either version 2,
955 + * or (at your option) any later version.
957 + * This program is distributed in the hope that it will be useful,
958 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
959 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
960 + * GNU General Public License for more details.
962 + * You should have received a copy of the GNU General Public License
963 + * along with this program; if not, write to the Free Software
964 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
969 +struct squashfs_inode_info {
970 + long long start_block;
971 + unsigned int offset;
974 + long long fragment_start_block;
975 + unsigned int fragment_size;
976 + unsigned int fragment_offset;
977 + long long block_list_start;
980 + long long directory_index_start;
981 + unsigned int directory_index_offset;
982 + unsigned int directory_index_count;
983 + unsigned int parent_inode;
986 + struct inode vfs_inode;
989 diff -x .gitignore -Nurp linux-2.6.27-rc4/include/linux/squashfs_fs_sb.h linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs_sb.h
990 --- linux-2.6.27-rc4/include/linux/squashfs_fs_sb.h 1970-01-01 01:00:00.000000000 +0100
991 +++ linux-2.6.27-rc4-squashfs3.4/include/linux/squashfs_fs_sb.h 2008-08-19 18:31:56.000000000 +0100
993 +#ifndef SQUASHFS_FS_SB
994 +#define SQUASHFS_FS_SB
998 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
999 + * Phillip Lougher <phillip@lougher.demon.co.uk>
1001 + * This program is free software; you can redistribute it and/or
1002 + * modify it under the terms of the GNU General Public License
1003 + * as published by the Free Software Foundation; either version 2,
1004 + * or (at your option) any later version.
1006 + * This program is distributed in the hope that it will be useful,
1007 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1008 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1009 + * GNU General Public License for more details.
1011 + * You should have received a copy of the GNU General Public License
1012 + * along with this program; if not, write to the Free Software
1013 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1015 + * squashfs_fs_sb.h
1018 +#include <linux/squashfs_fs.h>
1020 +struct squashfs_cache_entry {
1024 + long long next_index;
1028 + wait_queue_head_t wait_queue;
1032 +struct squashfs_cache {
1041 + wait_queue_head_t wait_queue;
1042 + struct squashfs_cache_entry entry[0];
1045 +struct squashfs_sb_info {
1046 + struct squashfs_super_block sblk;
1048 + int devblksize_log2;
1050 + struct squashfs_cache *block_cache;
1051 + struct squashfs_cache *fragment_cache;
1052 + int next_meta_index;
1053 + unsigned int *uid;
1054 + unsigned int *guid;
1055 + long long *fragment_index;
1056 + unsigned int *fragment_index_2;
1058 + struct mutex read_data_mutex;
1059 + struct mutex read_page_mutex;
1060 + struct mutex meta_index_mutex;
1061 + struct meta_index *meta_index;
1063 + long long *inode_lookup_table;
1064 + int (*read_inode)(struct inode *i, squashfs_inode_t \
1066 + long long (*read_blocklist)(struct inode *inode, int \
1067 + index, int readahead_blks, char *block_list, \
1068 + unsigned short **block_p, unsigned int *bsize);
1069 + int (*read_fragment_index_table)(struct super_block *s);