6 * Copyright (c) 2002, 2003, 2004, 2005 Phillip Lougher <phillip@lougher.demon.co.uk>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2,
11 * or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifdef CONFIG_SQUASHFS_VMALLOC
26 #define SQUASHFS_ALLOC(a) vmalloc(a)
27 #define SQUASHFS_FREE(a) vfree(a)
29 #define SQUASHFS_ALLOC(a) kmalloc(a, GFP_KERNEL)
30 #define SQUASHFS_FREE(a) kfree(a)
32 #define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
33 #define SQUASHFS_MAJOR 2
34 #define SQUASHFS_MINOR 1
35 #define SQUASHFS_MAGIC 0x73717368
36 #define SQUASHFS_MAGIC_SWAP 0x68737173
37 #define SQUASHFS_START 0
39 /* size of metadata (inode and directory) blocks */
40 #define SQUASHFS_METADATA_SIZE 8192
41 #define SQUASHFS_METADATA_LOG 13
43 /* default size of data blocks */
44 #define SQUASHFS_FILE_SIZE 65536
45 #define SQUASHFS_FILE_LOG 16
47 #define SQUASHFS_FILE_MAX_SIZE 65536
49 /* Max number of uids and gids */
50 #define SQUASHFS_UIDS 256
51 #define SQUASHFS_GUIDS 255
53 /* Max length of filename (not 255) */
54 #define SQUASHFS_NAME_LEN 256
56 #define SQUASHFS_INVALID ((long long) 0xffffffffffff)
57 #define SQUASHFS_INVALID_BLK ((long long) 0xffffffff)
58 #define SQUASHFS_USED_BLK ((long long) 0xfffffffe)
60 /* Filesystem flags */
61 #define SQUASHFS_NOI 0
62 #define SQUASHFS_NOD 1
63 #define SQUASHFS_CHECK 2
64 #define SQUASHFS_NOF 3
65 #define SQUASHFS_NO_FRAG 4
66 #define SQUASHFS_ALWAYS_FRAG 5
67 #define SQUASHFS_DUPLICATE 6
68 #define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1)
69 #define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, SQUASHFS_NOI)
70 #define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, SQUASHFS_NOD)
71 #define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_NOF)
72 #define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_NO_FRAG)
73 #define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, SQUASHFS_ALWAYS_FRAG)
74 #define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, SQUASHFS_DUPLICATE)
75 #define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, SQUASHFS_CHECK)
76 #define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, duplicate_checking) (noi | (nod << 1) | (check_data << 2) | (nof << 3) | (no_frag << 4) | (always_frag << 5) | (duplicate_checking << 6))
78 /* Max number of types and file types */
79 #define SQUASHFS_DIR_TYPE 1
80 #define SQUASHFS_FILE_TYPE 2
81 #define SQUASHFS_SYMLINK_TYPE 3
82 #define SQUASHFS_BLKDEV_TYPE 4
83 #define SQUASHFS_CHRDEV_TYPE 5
84 #define SQUASHFS_FIFO_TYPE 6
85 #define SQUASHFS_SOCKET_TYPE 7
86 #define SQUASHFS_LDIR_TYPE 8
88 /* 1.0 filesystem type definitions */
89 #define SQUASHFS_TYPES 5
90 #define SQUASHFS_IPC_TYPE 0
92 /* Flag whether block is compressed or uncompressed, bit is set if block is uncompressed */
93 #define SQUASHFS_COMPRESSED_BIT (1 << 15)
94 #define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \
95 (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT)
97 #define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT))
99 #define SQUASHFS_COMPRESSED_BIT_BLOCK (1 << 24)
100 #define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) (((B) & ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? \
101 (B) & ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK)
103 #define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
106 * Inode number ops. Inodes consist of a compressed block number, and an uncompressed
107 * offset within that block
109 #define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16))
110 #define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff))
111 #define SQUASHFS_MKINODE(A, B) ((squashfs_inode)(((squashfs_inode) (A) << 16)\
114 /* Compute 32 bit VFS inode number from squashfs inode number */
115 #define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + ((b) >> 2) + 1))
117 /* Translate between VFS mode and squashfs mode */
118 #define SQUASHFS_MODE(a) ((a) & 0xfff)
120 /* fragment and fragment table defines */
121 typedef unsigned int squashfs_fragment_index;
122 #define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(squashfs_fragment_entry))
123 #define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / SQUASHFS_METADATA_SIZE)
124 #define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % SQUASHFS_METADATA_SIZE)
125 #define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + SQUASHFS_METADATA_SIZE - 1) / SQUASHFS_METADATA_SIZE)
126 #define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) * sizeof(squashfs_fragment_index))
128 /* cached data constants for filesystem */
129 #define SQUASHFS_CACHED_BLKS 8
131 #define SQUASHFS_MAX_FILE_SIZE_LOG 32
132 #define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << (SQUASHFS_MAX_FILE_SIZE_LOG - 1))
134 #define SQUASHFS_MARKER_BYTE 0xff
138 * definitions for structures on disk
141 typedef unsigned int squashfs_block;
142 typedef long long squashfs_inode;
144 typedef unsigned int squashfs_uid;
146 typedef struct squashfs_super_block {
147 unsigned int s_magic;
149 unsigned int bytes_used;
150 unsigned int uid_start;
151 unsigned int guid_start;
152 unsigned int inode_table_start;
153 unsigned int directory_table_start;
154 unsigned int s_major:16;
155 unsigned int s_minor:16;
156 unsigned int block_size_1:16;
157 unsigned int block_log:16;
158 unsigned int flags:8;
159 unsigned int no_uids:8;
160 unsigned int no_guids:8;
161 unsigned int mkfs_time /* time of filesystem creation */;
162 squashfs_inode root_inode;
163 unsigned int block_size;
164 unsigned int fragments;
165 unsigned int fragment_table_start;
166 } __attribute__ ((packed)) squashfs_super_block;
169 unsigned int index:27;
170 unsigned int start_block:29;
172 unsigned char name[0];
173 } __attribute__ ((packed)) squashfs_dir_index;
176 unsigned int inode_type:4;
177 unsigned int mode:12; /* protection */
178 unsigned int uid:8; /* index into uid table */
179 unsigned int guid:8; /* index into guid table */
180 } __attribute__ ((packed)) squashfs_base_inode_header;
182 typedef squashfs_base_inode_header squashfs_ipc_inode_header;
185 unsigned int inode_type:4;
186 unsigned int mode:12; /* protection */
187 unsigned int uid:8; /* index into uid table */
188 unsigned int guid:8; /* index into guid table */
190 } __attribute__ ((packed)) squashfs_dev_inode_header;
193 unsigned int inode_type:4;
194 unsigned int mode:12; /* protection */
195 unsigned int uid:8; /* index into uid table */
196 unsigned int guid:8; /* index into guid table */
197 unsigned short symlink_size;
199 } __attribute__ ((packed)) squashfs_symlink_inode_header;
202 unsigned int inode_type:4;
203 unsigned int mode:12; /* protection */
204 unsigned int uid:8; /* index into uid table */
205 unsigned int guid:8; /* index into guid table */
207 squashfs_block start_block;
208 unsigned int fragment;
210 unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG;
211 unsigned short block_list[0];
212 } __attribute__ ((packed)) squashfs_reg_inode_header;
215 unsigned int inode_type:4;
216 unsigned int mode:12; /* protection */
217 unsigned int uid:8; /* index into uid table */
218 unsigned int guid:8; /* index into guid table */
219 unsigned int file_size:19;
220 unsigned int offset:13;
222 unsigned int start_block:24;
223 } __attribute__ ((packed)) squashfs_dir_inode_header;
226 unsigned int inode_type:4;
227 unsigned int mode:12; /* protection */
228 unsigned int uid:8; /* index into uid table */
229 unsigned int guid:8; /* index into guid table */
230 unsigned int file_size:27;
231 unsigned int offset:13;
233 unsigned int start_block:24;
234 unsigned int i_count:16;
235 squashfs_dir_index index[0];
236 } __attribute__ ((packed)) squashfs_ldir_inode_header;
239 squashfs_base_inode_header base;
240 squashfs_dev_inode_header dev;
241 squashfs_symlink_inode_header symlink;
242 squashfs_reg_inode_header reg;
243 squashfs_dir_inode_header dir;
244 squashfs_ldir_inode_header ldir;
245 squashfs_ipc_inode_header ipc;
246 } squashfs_inode_header;
249 unsigned int offset:13;
253 } __attribute__ ((packed)) squashfs_dir_entry;
256 unsigned int count:8;
257 unsigned int start_block:24;
258 } __attribute__ ((packed)) squashfs_dir_header;
261 unsigned int start_block;
263 } __attribute__ ((packed)) squashfs_fragment_entry;
265 extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen);
266 extern int squashfs_uncompress_init(void);
267 extern int squashfs_uncompress_exit(void);
270 * macros to convert each packed bitfield structure from little endian to big
271 * endian and vice versa. These are needed when creating or using a filesystem on a
272 * machine with different byte ordering to the target architecture.
276 #define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\
277 SQUASHFS_MEMSET(s, d, sizeof(squashfs_super_block));\
278 SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\
279 SQUASHFS_SWAP((s)->inodes, d, 32, 32);\
280 SQUASHFS_SWAP((s)->bytes_used, d, 64, 32);\
281 SQUASHFS_SWAP((s)->uid_start, d, 96, 32);\
282 SQUASHFS_SWAP((s)->guid_start, d, 128, 32);\
283 SQUASHFS_SWAP((s)->inode_table_start, d, 160, 32);\
284 SQUASHFS_SWAP((s)->directory_table_start, d, 192, 32);\
285 SQUASHFS_SWAP((s)->s_major, d, 224, 16);\
286 SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\
287 SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\
288 SQUASHFS_SWAP((s)->block_log, d, 272, 16);\
289 SQUASHFS_SWAP((s)->flags, d, 288, 8);\
290 SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\
291 SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\
292 SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\
293 SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\
294 SQUASHFS_SWAP((s)->block_size, d, 408, 32);\
295 SQUASHFS_SWAP((s)->fragments, d, 440, 32);\
296 SQUASHFS_SWAP((s)->fragment_table_start, d, 472, 32);\
299 #define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\
300 SQUASHFS_MEMSET(s, d, n);\
301 SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
302 SQUASHFS_SWAP((s)->mode, d, 4, 12);\
303 SQUASHFS_SWAP((s)->uid, d, 16, 8);\
304 SQUASHFS_SWAP((s)->guid, d, 24, 8);\
307 #define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_ipc_inode_header))
309 #define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\
310 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dev_inode_header));\
311 SQUASHFS_SWAP((s)->rdev, d, 32, 16);\
314 #define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\
315 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header));\
316 SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\
319 #define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\
320 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header));\
321 SQUASHFS_SWAP((s)->mtime, d, 32, 32);\
322 SQUASHFS_SWAP((s)->start_block, d, 64, 32);\
323 SQUASHFS_SWAP((s)->fragment, d, 96, 32);\
324 SQUASHFS_SWAP((s)->offset, d, 128, 32);\
325 SQUASHFS_SWAP((s)->file_size, d, 160, SQUASHFS_MAX_FILE_SIZE_LOG);\
328 #define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\
329 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header));\
330 SQUASHFS_SWAP((s)->file_size, d, 32, 19);\
331 SQUASHFS_SWAP((s)->offset, d, 51, 13);\
332 SQUASHFS_SWAP((s)->mtime, d, 64, 32);\
333 SQUASHFS_SWAP((s)->start_block, d, 96, 24);\
336 #define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\
337 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_ldir_inode_header));\
338 SQUASHFS_SWAP((s)->file_size, d, 32, 27);\
339 SQUASHFS_SWAP((s)->offset, d, 59, 13);\
340 SQUASHFS_SWAP((s)->mtime, d, 72, 32);\
341 SQUASHFS_SWAP((s)->start_block, d, 104, 24);\
342 SQUASHFS_SWAP((s)->i_count, d, 128, 16);\
345 #define SQUASHFS_SWAP_DIR_INDEX(s, d) {\
346 SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_index));\
347 SQUASHFS_SWAP((s)->index, d, 0, 27);\
348 SQUASHFS_SWAP((s)->start_block, d, 27, 29);\
349 SQUASHFS_SWAP((s)->size, d, 56, 8);\
352 #define SQUASHFS_SWAP_DIR_HEADER(s, d) {\
353 SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_header));\
354 SQUASHFS_SWAP((s)->count, d, 0, 8);\
355 SQUASHFS_SWAP((s)->start_block, d, 8, 24);\
358 #define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\
359 SQUASHFS_MEMSET(s, d, sizeof(squashfs_dir_entry));\
360 SQUASHFS_SWAP((s)->offset, d, 0, 13);\
361 SQUASHFS_SWAP((s)->type, d, 13, 3);\
362 SQUASHFS_SWAP((s)->size, d, 16, 8);\
365 #define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\
366 SQUASHFS_MEMSET(s, d, sizeof(squashfs_fragment_entry));\
367 SQUASHFS_SWAP((s)->start_block, d, 0, 32);\
368 SQUASHFS_SWAP((s)->size, d, 32, 32);\
371 #define SQUASHFS_SWAP_SHORTS(s, d, n) {\
374 SQUASHFS_MEMSET(s, d, n * 2);\
375 for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 16)\
376 SQUASHFS_SWAP(s[entry], d, bit_position, 16);\
379 #define SQUASHFS_SWAP_INTS(s, d, n) {\
382 SQUASHFS_MEMSET(s, d, n * 4);\
383 for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += 32)\
384 SQUASHFS_SWAP(s[entry], d, bit_position, 32);\
387 #define SQUASHFS_SWAP_DATA(s, d, n, bits) {\
390 SQUASHFS_MEMSET(s, d, n * bits / 8);\
391 for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += bits)\
392 SQUASHFS_SWAP(s[entry], d, bit_position, bits);\
395 #define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_INTS(s, d, n)
397 #ifdef SQUASHFS_1_0_COMPATIBILITY
399 unsigned int inode_type:4;
400 unsigned int mode:12; /* protection */
401 unsigned int uid:4; /* index into uid table */
402 unsigned int guid:4; /* index into guid table */
403 } __attribute__ ((packed)) squashfs_base_inode_header_1;
406 unsigned int inode_type:4;
407 unsigned int mode:12; /* protection */
408 unsigned int uid:4; /* index into uid table */
409 unsigned int guid:4; /* index into guid table */
411 unsigned int offset:4;
412 } __attribute__ ((packed)) squashfs_ipc_inode_header_1;
415 unsigned int inode_type:4;
416 unsigned int mode:12; /* protection */
417 unsigned int uid:4; /* index into uid table */
418 unsigned int guid:4; /* index into guid table */
420 } __attribute__ ((packed)) squashfs_dev_inode_header_1;
423 unsigned int inode_type:4;
424 unsigned int mode:12; /* protection */
425 unsigned int uid:4; /* index into uid table */
426 unsigned int guid:4; /* index into guid table */
427 unsigned short symlink_size;
429 } __attribute__ ((packed)) squashfs_symlink_inode_header_1;
432 unsigned int inode_type:4;
433 unsigned int mode:12; /* protection */
434 unsigned int uid:4; /* index into uid table */
435 unsigned int guid:4; /* index into guid table */
437 squashfs_block start_block;
438 unsigned int file_size:SQUASHFS_MAX_FILE_SIZE_LOG;
439 unsigned short block_list[0];
440 } __attribute__ ((packed)) squashfs_reg_inode_header_1;
443 unsigned int inode_type:4;
444 unsigned int mode:12; /* protection */
445 unsigned int uid:4; /* index into uid table */
446 unsigned int guid:4; /* index into guid table */
447 unsigned int file_size:19;
448 unsigned int offset:13;
450 unsigned int start_block:24;
451 } __attribute__ ((packed)) squashfs_dir_inode_header_1;
453 #define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\
454 SQUASHFS_MEMSET(s, d, n);\
455 SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
456 SQUASHFS_SWAP((s)->mode, d, 4, 12);\
457 SQUASHFS_SWAP((s)->uid, d, 16, 4);\
458 SQUASHFS_SWAP((s)->guid, d, 20, 4);\
461 #define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\
462 SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, sizeof(squashfs_ipc_inode_header_1));\
463 SQUASHFS_SWAP((s)->type, d, 24, 4);\
464 SQUASHFS_SWAP((s)->offset, d, 28, 4);\
467 #define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\
468 SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, sizeof(squashfs_dev_inode_header_1));\
469 SQUASHFS_SWAP((s)->rdev, d, 24, 16);\
472 #define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\
473 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_symlink_inode_header_1));\
474 SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\
477 #define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\
478 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_reg_inode_header_1));\
479 SQUASHFS_SWAP((s)->mtime, d, 24, 32);\
480 SQUASHFS_SWAP((s)->start_block, d, 56, 32);\
481 SQUASHFS_SWAP((s)->file_size, d, 88, SQUASHFS_MAX_FILE_SIZE_LOG);\
484 #define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\
485 SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, sizeof(squashfs_dir_inode_header_1));\
486 SQUASHFS_SWAP((s)->file_size, d, 24, 19);\
487 SQUASHFS_SWAP((s)->offset, d, 43, 13);\
488 SQUASHFS_SWAP((s)->mtime, d, 56, 32);\
489 SQUASHFS_SWAP((s)->start_block, d, 88, 24);\
495 * macros used to swap each structure entry, taking into account
496 * bitfields and different bitfield placing conventions on differing architectures
498 #include <asm/byteorder.h>
500 /* convert from little endian to big endian */
501 #define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, b_pos)
503 /* convert from big endian to little endian */
504 #define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, tbits, 64 - tbits - b_pos)
507 #define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\
509 int b_pos = pos % 8;\
510 unsigned long long val = 0;\
511 unsigned char *s = (unsigned char *)p + (pos / 8);\
512 unsigned char *d = ((unsigned char *) &val) + 7;\
513 for(bits = 0; bits < (tbits + b_pos); bits += 8) \
515 value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\
517 #define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n);