diff options
Diffstat (limited to 'fs/hfsplus/catalog.c')
| -rw-r--r-- | fs/hfsplus/catalog.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index f6874acb2cf..75ac1e466f1 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -86,6 +86,8 @@ static void hfsplus_set_perms(struct inode *inode, struct hfsplus_perm *perms) | |||
| 86 | 86 | ||
| 87 | static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct inode *inode) | 87 | static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct inode *inode) |
| 88 | { | 88 | { |
| 89 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); | ||
| 90 | |||
| 89 | if (S_ISDIR(inode->i_mode)) { | 91 | if (S_ISDIR(inode->i_mode)) { |
| 90 | struct hfsplus_cat_folder *folder; | 92 | struct hfsplus_cat_folder *folder; |
| 91 | 93 | ||
| @@ -99,7 +101,7 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct i | |||
| 99 | folder->attribute_mod_date = | 101 | folder->attribute_mod_date = |
| 100 | folder->access_date = hfsp_now2mt(); | 102 | folder->access_date = hfsp_now2mt(); |
| 101 | hfsplus_set_perms(inode, &folder->permissions); | 103 | hfsplus_set_perms(inode, &folder->permissions); |
| 102 | if (inode == HFSPLUS_SB(inode->i_sb).hidden_dir) | 104 | if (inode == sbi->hidden_dir) |
| 103 | /* invisible and namelocked */ | 105 | /* invisible and namelocked */ |
| 104 | folder->user_info.frFlags = cpu_to_be16(0x5000); | 106 | folder->user_info.frFlags = cpu_to_be16(0x5000); |
| 105 | return sizeof(*folder); | 107 | return sizeof(*folder); |
| @@ -122,8 +124,8 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct i | |||
| 122 | file->user_info.fdType = cpu_to_be32(HFSP_SYMLINK_TYPE); | 124 | file->user_info.fdType = cpu_to_be32(HFSP_SYMLINK_TYPE); |
| 123 | file->user_info.fdCreator = cpu_to_be32(HFSP_SYMLINK_CREATOR); | 125 | file->user_info.fdCreator = cpu_to_be32(HFSP_SYMLINK_CREATOR); |
| 124 | } else { | 126 | } else { |
| 125 | file->user_info.fdType = cpu_to_be32(HFSPLUS_SB(inode->i_sb).type); | 127 | file->user_info.fdType = cpu_to_be32(sbi->type); |
| 126 | file->user_info.fdCreator = cpu_to_be32(HFSPLUS_SB(inode->i_sb).creator); | 128 | file->user_info.fdCreator = cpu_to_be32(sbi->creator); |
| 127 | } | 129 | } |
| 128 | if ((file->permissions.rootflags | file->permissions.userflags) & HFSPLUS_FLG_IMMUTABLE) | 130 | if ((file->permissions.rootflags | file->permissions.userflags) & HFSPLUS_FLG_IMMUTABLE) |
| 129 | file->flags |= cpu_to_be16(HFSPLUS_FILE_LOCKED); | 131 | file->flags |= cpu_to_be16(HFSPLUS_FILE_LOCKED); |
| @@ -131,7 +133,7 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, u32 cnid, struct i | |||
| 131 | file->user_info.fdType = cpu_to_be32(HFSP_HARDLINK_TYPE); | 133 | file->user_info.fdType = cpu_to_be32(HFSP_HARDLINK_TYPE); |
| 132 | file->user_info.fdCreator = cpu_to_be32(HFSP_HFSPLUS_CREATOR); | 134 | file->user_info.fdCreator = cpu_to_be32(HFSP_HFSPLUS_CREATOR); |
| 133 | file->user_info.fdFlags = cpu_to_be16(0x100); | 135 | file->user_info.fdFlags = cpu_to_be16(0x100); |
| 134 | file->create_date = HFSPLUS_I(HFSPLUS_SB(inode->i_sb).hidden_dir).create_date; | 136 | file->create_date = HFSPLUS_I(sbi->hidden_dir).create_date; |
| 135 | file->permissions.dev = cpu_to_be32(HFSPLUS_I(inode).dev); | 137 | file->permissions.dev = cpu_to_be32(HFSPLUS_I(inode).dev); |
| 136 | } | 138 | } |
| 137 | return sizeof(*file); | 139 | return sizeof(*file); |
| @@ -180,15 +182,14 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid, | |||
| 180 | 182 | ||
| 181 | int hfsplus_create_cat(u32 cnid, struct inode *dir, struct qstr *str, struct inode *inode) | 183 | int hfsplus_create_cat(u32 cnid, struct inode *dir, struct qstr *str, struct inode *inode) |
| 182 | { | 184 | { |
| 185 | struct super_block *sb = dir->i_sb; | ||
| 183 | struct hfs_find_data fd; | 186 | struct hfs_find_data fd; |
| 184 | struct super_block *sb; | ||
| 185 | hfsplus_cat_entry entry; | 187 | hfsplus_cat_entry entry; |
| 186 | int entry_size; | 188 | int entry_size; |
| 187 | int err; | 189 | int err; |
| 188 | 190 | ||
| 189 | dprint(DBG_CAT_MOD, "create_cat: %s,%u(%d)\n", str->name, cnid, inode->i_nlink); | 191 | dprint(DBG_CAT_MOD, "create_cat: %s,%u(%d)\n", str->name, cnid, inode->i_nlink); |
| 190 | sb = dir->i_sb; | 192 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
| 191 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | ||
| 192 | 193 | ||
| 193 | hfsplus_cat_build_key(sb, fd.search_key, cnid, NULL); | 194 | hfsplus_cat_build_key(sb, fd.search_key, cnid, NULL); |
| 194 | entry_size = hfsplus_fill_cat_thread(sb, &entry, S_ISDIR(inode->i_mode) ? | 195 | entry_size = hfsplus_fill_cat_thread(sb, &entry, S_ISDIR(inode->i_mode) ? |
| @@ -234,7 +235,7 @@ err2: | |||
| 234 | 235 | ||
| 235 | int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | 236 | int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) |
| 236 | { | 237 | { |
| 237 | struct super_block *sb; | 238 | struct super_block *sb = dir->i_sb; |
| 238 | struct hfs_find_data fd; | 239 | struct hfs_find_data fd; |
| 239 | struct hfsplus_fork_raw fork; | 240 | struct hfsplus_fork_raw fork; |
| 240 | struct list_head *pos; | 241 | struct list_head *pos; |
| @@ -242,8 +243,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | |||
| 242 | u16 type; | 243 | u16 type; |
| 243 | 244 | ||
| 244 | dprint(DBG_CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid); | 245 | dprint(DBG_CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid); |
| 245 | sb = dir->i_sb; | 246 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
| 246 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | ||
| 247 | 247 | ||
| 248 | if (!str) { | 248 | if (!str) { |
| 249 | int len; | 249 | int len; |
| @@ -312,7 +312,7 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 312 | struct inode *src_dir, struct qstr *src_name, | 312 | struct inode *src_dir, struct qstr *src_name, |
| 313 | struct inode *dst_dir, struct qstr *dst_name) | 313 | struct inode *dst_dir, struct qstr *dst_name) |
| 314 | { | 314 | { |
| 315 | struct super_block *sb; | 315 | struct super_block *sb = src_dir->i_sb; |
| 316 | struct hfs_find_data src_fd, dst_fd; | 316 | struct hfs_find_data src_fd, dst_fd; |
| 317 | hfsplus_cat_entry entry; | 317 | hfsplus_cat_entry entry; |
| 318 | int entry_size, type; | 318 | int entry_size, type; |
| @@ -320,8 +320,7 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 320 | 320 | ||
| 321 | dprint(DBG_CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", cnid, src_dir->i_ino, src_name->name, | 321 | dprint(DBG_CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", cnid, src_dir->i_ino, src_name->name, |
| 322 | dst_dir->i_ino, dst_name->name); | 322 | dst_dir->i_ino, dst_name->name); |
| 323 | sb = src_dir->i_sb; | 323 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &src_fd); |
| 324 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &src_fd); | ||
| 325 | dst_fd = src_fd; | 324 | dst_fd = src_fd; |
| 326 | 325 | ||
| 327 | /* find the old dir entry and read the data */ | 326 | /* find the old dir entry and read the data */ |
