32 #include <linux/slab.h>
36 #include <linux/module.h>
37 #include <linux/magic.h>
38 #include <linux/xattr.h>
51 major,
short minor,
short id)
56 ERROR(
"Major/Minor mismatch, older Squashfs %d.%d "
57 "filesystems are unsupported\n", major, minor);
60 ERROR(
"Major/Minor mismatch, trying to mount newer "
61 "%d.%d filesystem\n", major, minor);
62 ERROR(
"Please update your kernel\n");
68 ERROR(
"Filesystem uses \"%s\" compression. This is not "
69 "supported\n", decompressor->
name);
85 unsigned int fragments;
86 u64 lookup_table_start, xattr_id_table_start, next_table;
89 TRACE(
"Entered squashfs_fill_superblock\n");
93 ERROR(
"Failed to allocate squashfs_sb_info\n");
114 ERROR(
"unable to read squashfs_super_block\n");
126 ERROR(
"Can't find a SQUASHFS superblock on %s\n",
143 i_size_read(sb->
s_bdev->bd_inode))
156 ERROR(
"Page size > filesystem block size (%d). This is "
157 "currently not supported!\n", msblk->
block_size);
192 TRACE(
"sblk->fragment_table_start %llx\n",
194 TRACE(
"sblk->id_table_start %llx\n",
199 sb->
s_op = &squashfs_super_ops;
211 ERROR(
"Failed to allocate read_page block\n");
216 if (IS_ERR(msblk->
stream)) {
217 err = PTR_ERR(msblk->
stream);
227 goto allocate_id_index_table;
234 ERROR(
"unable to read xattr id index table\n");
242 allocate_id_index_table:
248 ERROR(
"unable to read id index table\n");
258 goto handle_fragments;
262 lookup_table_start, next_table, msblk->
inodes);
264 ERROR(
"unable to read inode lookup table\n");
276 goto check_directory_table;
289 ERROR(
"unable to read fragment index table\n");
296 check_directory_table:
322 insert_inode_hash(root);
326 ERROR(
"Root inode create failed\n");
331 TRACE(
"Leaving squashfs_fill_super\n");
339 squashfs_decompressor_free(msblk, msblk->
stream);
354 u64 id = huge_encode_dev(dentry->
d_sb->s_bdev->bd_dev);
356 TRACE(
"Entered squashfs_statfs\n");
372 static int squashfs_remount(
struct super_block *sb,
int *flags,
char *data)
379 static void squashfs_put_super(
struct super_block *sb)
386 squashfs_decompressor_free(sbi, sbi->
stream);
399 int flags,
const char *dev_name,
void *data)
401 return mount_bdev(fs_type, flags, dev_name, data, squashfs_fill_super);
405 static struct kmem_cache *squashfs_inode_cachep;
408 static void init_once(
void *
foo)
416 static int __init init_inodecache(
void)
422 return squashfs_inode_cachep ? 0 : -
ENOMEM;
426 static void destroy_inodecache(
void)
437 static int __init init_squashfs_fs(
void)
439 int err = init_inodecache();
446 destroy_inodecache();
451 "Phillip Lougher\n");
457 static void __exit exit_squashfs_fs(
void)
460 destroy_inodecache();
479 static void squashfs_destroy_inode(
struct inode *inode)
488 .mount = squashfs_mount,
494 .alloc_inode = squashfs_alloc_inode,
495 .destroy_inode = squashfs_destroy_inode,
496 .statfs = squashfs_statfs,
497 .put_super = squashfs_put_super,
498 .remount_fs = squashfs_remount