10 #include <linux/module.h>
15 #include <linux/slab.h>
20 static void hfsplus_destroy_inode(
struct inode *
inode);
24 static int hfsplus_system_read_inode(
struct inode *
inode)
28 switch (inode->
i_ino) {
67 INIT_LIST_HEAD(&HFSPLUS_I(inode)->open_dir_list);
69 HFSPLUS_I(inode)->flags = 0;
70 HFSPLUS_I(inode)->extent_state = 0;
71 HFSPLUS_I(inode)->rsrc_inode =
NULL;
84 err = hfsplus_system_read_inode(inode);
96 static int hfsplus_system_write_inode(
struct inode *inode)
103 switch (inode->
i_ino) {
135 static int hfsplus_write_inode(
struct inode *inode,
150 return hfsplus_system_write_inode(inode);
153 static void hfsplus_evict_inode(
struct inode *inode)
159 HFSPLUS_I(HFSPLUS_I(inode)->rsrc_inode)->rsrc_inode =
NULL;
160 iput(HFSPLUS_I(inode)->rsrc_inode);
168 int write_backup = 0;
257 static void hfsplus_put_super(
struct super_block *sb)
272 hfsplus_sync_fs(sb, 1);
290 u64 id = huge_encode_dev(sb->
s_bdev->bd_dev);
310 if (!(*flags & MS_RDONLY)) {
311 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr;
319 "not cleanly unmounted, "
320 "running fsck.hfsplus is recommended. "
321 "leaving read-only.\n");
329 "leaving read-only.\n");
336 "leaving read-only.\n");
345 .alloc_inode = hfsplus_alloc_inode,
346 .destroy_inode = hfsplus_destroy_inode,
347 .write_inode = hfsplus_write_inode,
348 .evict_inode = hfsplus_evict_inode,
349 .put_super = hfsplus_put_super,
350 .sync_fs = hfsplus_sync_fs,
351 .statfs = hfsplus_statfs,
352 .remount_fs = hfsplus_remount,
356 static int hfsplus_fill_super(
struct super_block *sb,
void *data,
int silent)
360 hfsplus_cat_entry
entry;
365 u64 last_fs_block, last_fs_page;
429 (last_fs_page > (
pgoff_t)(~0ULL))) {
435 sb->
s_op = &hfsplus_sops;
440 "not cleanly unmounted, "
441 "running fsck.hfsplus is recommended. "
442 "mounting read-only.\n");
452 "a journaled filesystem is not supported, "
453 "use the force option at your own risk, "
454 "mounting read-only.\n");
469 goto out_close_ext_tree;
475 err = PTR_ERR(inode);
476 goto out_close_cat_tree;
485 goto out_put_alloc_file;
492 goto out_put_alloc_file;
507 err = PTR_ERR(inode);
514 if (!(sb->
s_flags & MS_RDONLY)) {
524 hfsplus_sync_fs(sb, 1);
538 goto out_put_hidden_dir;
575 static struct kmem_cache *hfsplus_inode_cachep;
577 static struct inode *hfsplus_alloc_inode(
struct super_block *sb)
592 static void hfsplus_destroy_inode(
struct inode *inode)
597 #define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
600 int flags,
const char *dev_name,
void *data)
602 return mount_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super);
608 .mount = hfsplus_mount,
613 static void hfsplus_init_once(
void *
p)
620 static int __init init_hfsplus_fs(
void)
627 if (!hfsplus_inode_cachep)
635 static void __exit exit_hfsplus_fs(
void)