• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:squashfs +full:- +full:root

2  * Squashfs - a compressed read only filesystem for Linux
19 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 * in-memory structures at mount time, and all the VFS glue code to register
42 #include "squashfs.h"
50 ERROR("Major/Minor mismatch, older Squashfs %d.%d " in supported_squashfs_filesystem()
52 return -EINVAL; in supported_squashfs_filesystem()
57 return -EINVAL; in supported_squashfs_filesystem()
61 return -EINVAL; in supported_squashfs_filesystem()
72 struct inode *root; in squashfs_fill_super() local
81 sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL); in squashfs_fill_super()
82 if (sb->s_fs_info == NULL) { in squashfs_fill_super()
84 return -ENOMEM; in squashfs_fill_super()
86 msblk = sb->s_fs_info; in squashfs_fill_super()
88 msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), in squashfs_fill_super()
90 if (msblk->stream.workspace == NULL) { in squashfs_fill_super()
101 msblk->devblksize = sb_min_blocksize(sb, BLOCK_SIZE); in squashfs_fill_super()
102 msblk->devblksize_log2 = ffz(~msblk->devblksize); in squashfs_fill_super()
104 mutex_init(&msblk->read_data_mutex); in squashfs_fill_super()
105 mutex_init(&msblk->meta_index_mutex); in squashfs_fill_super()
108 * msblk->bytes_used is checked in squashfs_read_table to ensure reads in squashfs_fill_super()
113 msblk->bytes_used = sizeof(*sblk); in squashfs_fill_super()
121 /* Check it is a SQUASHFS superblock */ in squashfs_fill_super()
122 sb->s_magic = le32_to_cpu(sblk->s_magic); in squashfs_fill_super()
123 if (sb->s_magic != SQUASHFS_MAGIC) { in squashfs_fill_super()
125 ERROR("Can't find a SQUASHFS superblock on %s\n", in squashfs_fill_super()
126 bdevname(sb->s_bdev, b)); in squashfs_fill_super()
127 err = -EINVAL; in squashfs_fill_super()
132 err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), in squashfs_fill_super()
133 le16_to_cpu(sblk->s_minor), in squashfs_fill_super()
134 le16_to_cpu(sblk->compression)); in squashfs_fill_super()
138 err = -EINVAL; in squashfs_fill_super()
144 if (le64_to_cpu(sblk->xattr_table_start) != SQUASHFS_INVALID_BLK) in squashfs_fill_super()
149 msblk->bytes_used = le64_to_cpu(sblk->bytes_used); in squashfs_fill_super()
150 if (msblk->bytes_used < 0 || msblk->bytes_used > in squashfs_fill_super()
151 i_size_read(sb->s_bdev->bd_inode)) in squashfs_fill_super()
155 msblk->block_size = le32_to_cpu(sblk->block_size); in squashfs_fill_super()
156 if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) in squashfs_fill_super()
159 msblk->block_log = le16_to_cpu(sblk->block_log); in squashfs_fill_super()
160 if (msblk->block_log > SQUASHFS_FILE_MAX_LOG) in squashfs_fill_super()
163 /* Check the root inode for sanity */ in squashfs_fill_super()
164 root_inode = le64_to_cpu(sblk->root_inode); in squashfs_fill_super()
168 msblk->inode_table = le64_to_cpu(sblk->inode_table_start); in squashfs_fill_super()
169 msblk->directory_table = le64_to_cpu(sblk->directory_table_start); in squashfs_fill_super()
170 msblk->inodes = le32_to_cpu(sblk->inodes); in squashfs_fill_super()
171 flags = le16_to_cpu(sblk->flags); in squashfs_fill_super()
173 TRACE("Found valid superblock on %s\n", bdevname(sb->s_bdev, b)); in squashfs_fill_super()
178 TRACE("Filesystem size %lld bytes\n", msblk->bytes_used); in squashfs_fill_super()
179 TRACE("Block size %d\n", msblk->block_size); in squashfs_fill_super()
180 TRACE("Number of inodes %d\n", msblk->inodes); in squashfs_fill_super()
181 TRACE("Number of fragments %d\n", le32_to_cpu(sblk->fragments)); in squashfs_fill_super()
182 TRACE("Number of ids %d\n", le16_to_cpu(sblk->no_ids)); in squashfs_fill_super()
183 TRACE("sblk->inode_table_start %llx\n", msblk->inode_table); in squashfs_fill_super()
184 TRACE("sblk->directory_table_start %llx\n", msblk->directory_table); in squashfs_fill_super()
185 TRACE("sblk->fragment_table_start %llx\n", in squashfs_fill_super()
186 (u64) le64_to_cpu(sblk->fragment_table_start)); in squashfs_fill_super()
187 TRACE("sblk->id_table_start %llx\n", in squashfs_fill_super()
188 (u64) le64_to_cpu(sblk->id_table_start)); in squashfs_fill_super()
190 sb->s_maxbytes = MAX_LFS_FILESIZE; in squashfs_fill_super()
191 sb->s_flags |= MS_RDONLY; in squashfs_fill_super()
192 sb->s_op = &squashfs_super_ops; in squashfs_fill_super()
194 err = -ENOMEM; in squashfs_fill_super()
196 msblk->block_cache = squashfs_cache_init("metadata", in squashfs_fill_super()
198 if (msblk->block_cache == NULL) in squashfs_fill_super()
202 msblk->read_page = squashfs_cache_init("data", 1, msblk->block_size); in squashfs_fill_super()
203 if (msblk->read_page == NULL) { in squashfs_fill_super()
209 msblk->id_table = squashfs_read_id_index_table(sb, in squashfs_fill_super()
210 le64_to_cpu(sblk->id_table_start), le16_to_cpu(sblk->no_ids)); in squashfs_fill_super()
211 if (IS_ERR(msblk->id_table)) { in squashfs_fill_super()
212 err = PTR_ERR(msblk->id_table); in squashfs_fill_super()
213 msblk->id_table = NULL; in squashfs_fill_super()
217 fragments = le32_to_cpu(sblk->fragments); in squashfs_fill_super()
221 msblk->fragment_cache = squashfs_cache_init("fragment", in squashfs_fill_super()
222 SQUASHFS_CACHED_FRAGMENTS, msblk->block_size); in squashfs_fill_super()
223 if (msblk->fragment_cache == NULL) { in squashfs_fill_super()
224 err = -ENOMEM; in squashfs_fill_super()
229 msblk->fragment_index = squashfs_read_fragment_index_table(sb, in squashfs_fill_super()
230 le64_to_cpu(sblk->fragment_table_start), fragments); in squashfs_fill_super()
231 if (IS_ERR(msblk->fragment_index)) { in squashfs_fill_super()
232 err = PTR_ERR(msblk->fragment_index); in squashfs_fill_super()
233 msblk->fragment_index = NULL; in squashfs_fill_super()
238 lookup_table_start = le64_to_cpu(sblk->lookup_table_start); in squashfs_fill_super()
243 msblk->inode_lookup_table = squashfs_read_inode_lookup_table(sb, in squashfs_fill_super()
244 lookup_table_start, msblk->inodes); in squashfs_fill_super()
245 if (IS_ERR(msblk->inode_lookup_table)) { in squashfs_fill_super()
246 err = PTR_ERR(msblk->inode_lookup_table); in squashfs_fill_super()
247 msblk->inode_lookup_table = NULL; in squashfs_fill_super()
251 sb->s_export_op = &squashfs_export_ops; in squashfs_fill_super()
254 root = new_inode(sb); in squashfs_fill_super()
255 if (!root) { in squashfs_fill_super()
256 err = -ENOMEM; in squashfs_fill_super()
260 err = squashfs_read_inode(root, root_inode); in squashfs_fill_super()
262 iget_failed(root); in squashfs_fill_super()
265 insert_inode_hash(root); in squashfs_fill_super()
267 sb->s_root = d_alloc_root(root); in squashfs_fill_super()
268 if (sb->s_root == NULL) { in squashfs_fill_super()
269 ERROR("Root inode create failed\n"); in squashfs_fill_super()
270 err = -ENOMEM; in squashfs_fill_super()
271 iput(root); in squashfs_fill_super()
280 squashfs_cache_delete(msblk->block_cache); in squashfs_fill_super()
281 squashfs_cache_delete(msblk->fragment_cache); in squashfs_fill_super()
282 squashfs_cache_delete(msblk->read_page); in squashfs_fill_super()
283 kfree(msblk->inode_lookup_table); in squashfs_fill_super()
284 kfree(msblk->fragment_index); in squashfs_fill_super()
285 kfree(msblk->id_table); in squashfs_fill_super()
286 kfree(msblk->stream.workspace); in squashfs_fill_super()
287 kfree(sb->s_fs_info); in squashfs_fill_super()
288 sb->s_fs_info = NULL; in squashfs_fill_super()
293 kfree(msblk->stream.workspace); in squashfs_fill_super()
294 kfree(sb->s_fs_info); in squashfs_fill_super()
295 sb->s_fs_info = NULL; in squashfs_fill_super()
296 return -ENOMEM; in squashfs_fill_super()
302 struct squashfs_sb_info *msblk = dentry->d_sb->s_fs_info; in squashfs_statfs()
306 buf->f_type = SQUASHFS_MAGIC; in squashfs_statfs()
307 buf->f_bsize = msblk->block_size; in squashfs_statfs()
308 buf->f_blocks = ((msblk->bytes_used - 1) >> msblk->block_log) + 1; in squashfs_statfs()
309 buf->f_bfree = buf->f_bavail = 0; in squashfs_statfs()
310 buf->f_files = msblk->inodes; in squashfs_statfs()
311 buf->f_ffree = 0; in squashfs_statfs()
312 buf->f_namelen = SQUASHFS_NAME_LEN; in squashfs_statfs()
327 if (sb->s_fs_info) { in squashfs_put_super()
328 struct squashfs_sb_info *sbi = sb->s_fs_info; in squashfs_put_super()
329 squashfs_cache_delete(sbi->block_cache); in squashfs_put_super()
330 squashfs_cache_delete(sbi->fragment_cache); in squashfs_put_super()
331 squashfs_cache_delete(sbi->read_page); in squashfs_put_super()
332 kfree(sbi->id_table); in squashfs_put_super()
333 kfree(sbi->fragment_index); in squashfs_put_super()
334 kfree(sbi->meta_index); in squashfs_put_super()
335 kfree(sbi->stream.workspace); in squashfs_put_super()
336 kfree(sb->s_fs_info); in squashfs_put_super()
337 sb->s_fs_info = NULL; in squashfs_put_super()
358 inode_init_once(&ei->vfs_inode); in init_once()
368 return squashfs_inode_cachep ? 0 : -ENOMEM; in init_inodecache()
391 printk(KERN_INFO "squashfs: version 4.0 (2009/01/03) " in init_squashfs_fs()
410 return ei ? &ei->vfs_inode : NULL; in squashfs_alloc_inode()
422 .name = "squashfs",
438 MODULE_DESCRIPTION("squashfs 4.0, a compressed read-only filesystem");