diff options
author | Christoph Hellwig <hch@tuxera.com> | 2010-09-30 23:42:59 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-09-30 23:42:59 -0400 |
commit | dd73a01a30d729e8fa6f829c4582650e258e36f9 (patch) | |
tree | befe5a0bf762211d1a907ad11c15c4a21d7c4f74 /fs/hfsplus | |
parent | e753a62156e952fd5a3c64f98454d9aeee3a2546 (diff) |
hfsplus: fix HFSPLUS_SB calling convention
HFSPLUS_SB doesn't return a pointer to the hfsplus-specific superblock
information like all other FOO_SB macros, but dereference the pointer in a way
that made it look like a direct struct derefence. This only works as long
as the HFSPLUS_SB macro is used directly and prevents us from keepig a local
hfsplus_sb_info pointer. Fix the calling convention and introduce a local
sbi variable in all functions that use it constantly.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/bitmap.c | 20 | ||||
-rw-r--r-- | fs/hfsplus/btree.c | 8 | ||||
-rw-r--r-- | fs/hfsplus/catalog.c | 25 | ||||
-rw-r--r-- | fs/hfsplus/dir.c | 40 | ||||
-rw-r--r-- | fs/hfsplus/extents.c | 37 | ||||
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 3 | ||||
-rw-r--r-- | fs/hfsplus/inode.c | 57 | ||||
-rw-r--r-- | fs/hfsplus/ioctl.c | 4 | ||||
-rw-r--r-- | fs/hfsplus/options.c | 2 | ||||
-rw-r--r-- | fs/hfsplus/part_tbl.c | 5 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 151 | ||||
-rw-r--r-- | fs/hfsplus/unicode.c | 16 | ||||
-rw-r--r-- | fs/hfsplus/wrapper.c | 30 |
13 files changed, 209 insertions, 189 deletions
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c index 8a781769a901..ad57f5991eb1 100644 --- a/fs/hfsplus/bitmap.c +++ b/fs/hfsplus/bitmap.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *max) | 18 | int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *max) |
19 | { | 19 | { |
20 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
20 | struct page *page; | 21 | struct page *page; |
21 | struct address_space *mapping; | 22 | struct address_space *mapping; |
22 | __be32 *pptr, *curr, *end; | 23 | __be32 *pptr, *curr, *end; |
@@ -29,8 +30,8 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma | |||
29 | return size; | 30 | return size; |
30 | 31 | ||
31 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); | 32 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); |
32 | mutex_lock(&HFSPLUS_SB(sb).alloc_mutex); | 33 | mutex_lock(&sbi->alloc_mutex); |
33 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 34 | mapping = sbi->alloc_file->i_mapping; |
34 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); | 35 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); |
35 | if (IS_ERR(page)) { | 36 | if (IS_ERR(page)) { |
36 | start = size; | 37 | start = size; |
@@ -150,16 +151,17 @@ done: | |||
150 | set_page_dirty(page); | 151 | set_page_dirty(page); |
151 | kunmap(page); | 152 | kunmap(page); |
152 | *max = offset + (curr - pptr) * 32 + i - start; | 153 | *max = offset + (curr - pptr) * 32 + i - start; |
153 | HFSPLUS_SB(sb).free_blocks -= *max; | 154 | sbi->free_blocks -= *max; |
154 | sb->s_dirt = 1; | 155 | sb->s_dirt = 1; |
155 | dprint(DBG_BITMAP, "-> %u,%u\n", start, *max); | 156 | dprint(DBG_BITMAP, "-> %u,%u\n", start, *max); |
156 | out: | 157 | out: |
157 | mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex); | 158 | mutex_unlock(&sbi->alloc_mutex); |
158 | return start; | 159 | return start; |
159 | } | 160 | } |
160 | 161 | ||
161 | int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | 162 | int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) |
162 | { | 163 | { |
164 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
163 | struct page *page; | 165 | struct page *page; |
164 | struct address_space *mapping; | 166 | struct address_space *mapping; |
165 | __be32 *pptr, *curr, *end; | 167 | __be32 *pptr, *curr, *end; |
@@ -172,11 +174,11 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
172 | 174 | ||
173 | dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); | 175 | dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); |
174 | /* are all of the bits in range? */ | 176 | /* are all of the bits in range? */ |
175 | if ((offset + count) > HFSPLUS_SB(sb).total_blocks) | 177 | if ((offset + count) > sbi->total_blocks) |
176 | return -2; | 178 | return -2; |
177 | 179 | ||
178 | mutex_lock(&HFSPLUS_SB(sb).alloc_mutex); | 180 | mutex_lock(&sbi->alloc_mutex); |
179 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 181 | mapping = sbi->alloc_file->i_mapping; |
180 | pnr = offset / PAGE_CACHE_BITS; | 182 | pnr = offset / PAGE_CACHE_BITS; |
181 | page = read_mapping_page(mapping, pnr, NULL); | 183 | page = read_mapping_page(mapping, pnr, NULL); |
182 | pptr = kmap(page); | 184 | pptr = kmap(page); |
@@ -224,9 +226,9 @@ done: | |||
224 | out: | 226 | out: |
225 | set_page_dirty(page); | 227 | set_page_dirty(page); |
226 | kunmap(page); | 228 | kunmap(page); |
227 | HFSPLUS_SB(sb).free_blocks += len; | 229 | sbi->free_blocks += len; |
228 | sb->s_dirt = 1; | 230 | sb->s_dirt = 1; |
229 | mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex); | 231 | mutex_unlock(&sbi->alloc_mutex); |
230 | 232 | ||
231 | return 0; | 233 | return 0; |
232 | } | 234 | } |
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index e49fcee1e293..96e2128748f2 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c | |||
@@ -61,12 +61,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) | |||
61 | if (id == HFSPLUS_EXT_CNID) { | 61 | if (id == HFSPLUS_EXT_CNID) { |
62 | tree->keycmp = hfsplus_ext_cmp_key; | 62 | tree->keycmp = hfsplus_ext_cmp_key; |
63 | } else if (id == HFSPLUS_CAT_CNID) { | 63 | } else if (id == HFSPLUS_CAT_CNID) { |
64 | if ((HFSPLUS_SB(sb).flags & HFSPLUS_SB_HFSX) && | 64 | if ((HFSPLUS_SB(sb)->flags & HFSPLUS_SB_HFSX) && |
65 | (head->key_type == HFSPLUS_KEY_BINARY)) | 65 | (head->key_type == HFSPLUS_KEY_BINARY)) |
66 | tree->keycmp = hfsplus_cat_bin_cmp_key; | 66 | tree->keycmp = hfsplus_cat_bin_cmp_key; |
67 | else { | 67 | else { |
68 | tree->keycmp = hfsplus_cat_case_cmp_key; | 68 | tree->keycmp = hfsplus_cat_case_cmp_key; |
69 | HFSPLUS_SB(sb).flags |= HFSPLUS_SB_CASEFOLD; | 69 | HFSPLUS_SB(sb)->flags |= HFSPLUS_SB_CASEFOLD; |
70 | } | 70 | } |
71 | } else { | 71 | } else { |
72 | printk(KERN_ERR "hfs: unknown B*Tree requested\n"); | 72 | printk(KERN_ERR "hfs: unknown B*Tree requested\n"); |
@@ -200,9 +200,9 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) | |||
200 | return ERR_PTR(res); | 200 | return ERR_PTR(res); |
201 | HFSPLUS_I(inode).phys_size = inode->i_size = | 201 | HFSPLUS_I(inode).phys_size = inode->i_size = |
202 | (loff_t)HFSPLUS_I(inode).alloc_blocks << | 202 | (loff_t)HFSPLUS_I(inode).alloc_blocks << |
203 | HFSPLUS_SB(tree->sb).alloc_blksz_shift; | 203 | HFSPLUS_SB(tree->sb)->alloc_blksz_shift; |
204 | HFSPLUS_I(inode).fs_blocks = HFSPLUS_I(inode).alloc_blocks << | 204 | HFSPLUS_I(inode).fs_blocks = HFSPLUS_I(inode).alloc_blocks << |
205 | HFSPLUS_SB(tree->sb).fs_shift; | 205 | HFSPLUS_SB(tree->sb)->fs_shift; |
206 | inode_set_bytes(inode, inode->i_size); | 206 | inode_set_bytes(inode, inode->i_size); |
207 | count = inode->i_size >> tree->node_size_shift; | 207 | count = inode->i_size >> tree->node_size_shift; |
208 | tree->free_nodes = count - tree->node_count; | 208 | tree->free_nodes = count - tree->node_count; |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index f6874acb2cf2..75ac1e466f1c 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 */ |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 764fd1bdca88..584777ddb0b9 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -39,7 +39,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry, | |||
39 | 39 | ||
40 | dentry->d_op = &hfsplus_dentry_operations; | 40 | dentry->d_op = &hfsplus_dentry_operations; |
41 | dentry->d_fsdata = NULL; | 41 | dentry->d_fsdata = NULL; |
42 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | 42 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
43 | hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name); | 43 | hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name); |
44 | again: | 44 | again: |
45 | err = hfs_brec_read(&fd, &entry, sizeof(entry)); | 45 | err = hfs_brec_read(&fd, &entry, sizeof(entry)); |
@@ -68,9 +68,9 @@ again: | |||
68 | cnid = be32_to_cpu(entry.file.id); | 68 | cnid = be32_to_cpu(entry.file.id); |
69 | if (entry.file.user_info.fdType == cpu_to_be32(HFSP_HARDLINK_TYPE) && | 69 | if (entry.file.user_info.fdType == cpu_to_be32(HFSP_HARDLINK_TYPE) && |
70 | entry.file.user_info.fdCreator == cpu_to_be32(HFSP_HFSPLUS_CREATOR) && | 70 | entry.file.user_info.fdCreator == cpu_to_be32(HFSP_HFSPLUS_CREATOR) && |
71 | (entry.file.create_date == HFSPLUS_I(HFSPLUS_SB(sb).hidden_dir).create_date || | 71 | (entry.file.create_date == HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir).create_date || |
72 | entry.file.create_date == HFSPLUS_I(sb->s_root->d_inode).create_date) && | 72 | entry.file.create_date == HFSPLUS_I(sb->s_root->d_inode).create_date) && |
73 | HFSPLUS_SB(sb).hidden_dir) { | 73 | HFSPLUS_SB(sb)->hidden_dir) { |
74 | struct qstr str; | 74 | struct qstr str; |
75 | char name[32]; | 75 | char name[32]; |
76 | 76 | ||
@@ -86,7 +86,8 @@ again: | |||
86 | linkid = be32_to_cpu(entry.file.permissions.dev); | 86 | linkid = be32_to_cpu(entry.file.permissions.dev); |
87 | str.len = sprintf(name, "iNode%d", linkid); | 87 | str.len = sprintf(name, "iNode%d", linkid); |
88 | str.name = name; | 88 | str.name = name; |
89 | hfsplus_cat_build_key(sb, fd.search_key, HFSPLUS_SB(sb).hidden_dir->i_ino, &str); | 89 | hfsplus_cat_build_key(sb, fd.search_key, |
90 | HFSPLUS_SB(sb)->hidden_dir->i_ino, &str); | ||
90 | goto again; | 91 | goto again; |
91 | } | 92 | } |
92 | } else if (!dentry->d_fsdata) | 93 | } else if (!dentry->d_fsdata) |
@@ -124,7 +125,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
124 | if (filp->f_pos >= inode->i_size) | 125 | if (filp->f_pos >= inode->i_size) |
125 | return 0; | 126 | return 0; |
126 | 127 | ||
127 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | 128 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
128 | hfsplus_cat_build_key(sb, fd.search_key, inode->i_ino, NULL); | 129 | hfsplus_cat_build_key(sb, fd.search_key, inode->i_ino, NULL); |
129 | err = hfs_brec_find(&fd); | 130 | err = hfs_brec_find(&fd); |
130 | if (err) | 131 | if (err) |
@@ -180,8 +181,9 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
180 | err = -EIO; | 181 | err = -EIO; |
181 | goto out; | 182 | goto out; |
182 | } | 183 | } |
183 | if (HFSPLUS_SB(sb).hidden_dir && | 184 | if (HFSPLUS_SB(sb)->hidden_dir && |
184 | HFSPLUS_SB(sb).hidden_dir->i_ino == be32_to_cpu(entry.folder.id)) | 185 | HFSPLUS_SB(sb)->hidden_dir->i_ino == |
186 | be32_to_cpu(entry.folder.id)) | ||
185 | goto next; | 187 | goto next; |
186 | if (filldir(dirent, strbuf, len, filp->f_pos, | 188 | if (filldir(dirent, strbuf, len, filp->f_pos, |
187 | be32_to_cpu(entry.folder.id), DT_DIR)) | 189 | be32_to_cpu(entry.folder.id), DT_DIR)) |
@@ -260,7 +262,7 @@ static int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode, | |||
260 | static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | 262 | static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, |
261 | struct dentry *dst_dentry) | 263 | struct dentry *dst_dentry) |
262 | { | 264 | { |
263 | struct super_block *sb = dst_dir->i_sb; | 265 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb); |
264 | struct inode *inode = src_dentry->d_inode; | 266 | struct inode *inode = src_dentry->d_inode; |
265 | struct inode *src_dir = src_dentry->d_parent->d_inode; | 267 | struct inode *src_dir = src_dentry->d_parent->d_inode; |
266 | struct qstr str; | 268 | struct qstr str; |
@@ -279,22 +281,22 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | |||
279 | str.len = sprintf(name, "iNode%d", id); | 281 | str.len = sprintf(name, "iNode%d", id); |
280 | res = hfsplus_rename_cat(inode->i_ino, | 282 | res = hfsplus_rename_cat(inode->i_ino, |
281 | src_dir, &src_dentry->d_name, | 283 | src_dir, &src_dentry->d_name, |
282 | HFSPLUS_SB(sb).hidden_dir, &str); | 284 | sbi->hidden_dir, &str); |
283 | if (!res) | 285 | if (!res) |
284 | break; | 286 | break; |
285 | if (res != -EEXIST) | 287 | if (res != -EEXIST) |
286 | return res; | 288 | return res; |
287 | } | 289 | } |
288 | HFSPLUS_I(inode).dev = id; | 290 | HFSPLUS_I(inode).dev = id; |
289 | cnid = HFSPLUS_SB(sb).next_cnid++; | 291 | cnid = sbi->next_cnid++; |
290 | src_dentry->d_fsdata = (void *)(unsigned long)cnid; | 292 | src_dentry->d_fsdata = (void *)(unsigned long)cnid; |
291 | res = hfsplus_create_cat(cnid, src_dir, &src_dentry->d_name, inode); | 293 | res = hfsplus_create_cat(cnid, src_dir, &src_dentry->d_name, inode); |
292 | if (res) | 294 | if (res) |
293 | /* panic? */ | 295 | /* panic? */ |
294 | return res; | 296 | return res; |
295 | HFSPLUS_SB(sb).file_count++; | 297 | sbi->file_count++; |
296 | } | 298 | } |
297 | cnid = HFSPLUS_SB(sb).next_cnid++; | 299 | cnid = sbi->next_cnid++; |
298 | res = hfsplus_create_cat(cnid, dst_dir, &dst_dentry->d_name, inode); | 300 | res = hfsplus_create_cat(cnid, dst_dir, &dst_dentry->d_name, inode); |
299 | if (res) | 301 | if (res) |
300 | return res; | 302 | return res; |
@@ -304,15 +306,15 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | |||
304 | atomic_inc(&inode->i_count); | 306 | atomic_inc(&inode->i_count); |
305 | inode->i_ctime = CURRENT_TIME_SEC; | 307 | inode->i_ctime = CURRENT_TIME_SEC; |
306 | mark_inode_dirty(inode); | 308 | mark_inode_dirty(inode); |
307 | HFSPLUS_SB(sb).file_count++; | 309 | sbi->file_count++; |
308 | sb->s_dirt = 1; | 310 | dst_dir->i_sb->s_dirt = 1; |
309 | 311 | ||
310 | return 0; | 312 | return 0; |
311 | } | 313 | } |
312 | 314 | ||
313 | static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | 315 | static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) |
314 | { | 316 | { |
315 | struct super_block *sb = dir->i_sb; | 317 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
316 | struct inode *inode = dentry->d_inode; | 318 | struct inode *inode = dentry->d_inode; |
317 | struct qstr str; | 319 | struct qstr str; |
318 | char name[32]; | 320 | char name[32]; |
@@ -329,7 +331,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | |||
329 | str.len = sprintf(name, "temp%lu", inode->i_ino); | 331 | str.len = sprintf(name, "temp%lu", inode->i_ino); |
330 | res = hfsplus_rename_cat(inode->i_ino, | 332 | res = hfsplus_rename_cat(inode->i_ino, |
331 | dir, &dentry->d_name, | 333 | dir, &dentry->d_name, |
332 | HFSPLUS_SB(sb).hidden_dir, &str); | 334 | sbi->hidden_dir, &str); |
333 | if (!res) | 335 | if (!res) |
334 | inode->i_flags |= S_DEAD; | 336 | inode->i_flags |= S_DEAD; |
335 | return res; | 337 | return res; |
@@ -344,10 +346,10 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | |||
344 | clear_nlink(inode); | 346 | clear_nlink(inode); |
345 | if (!inode->i_nlink) { | 347 | if (!inode->i_nlink) { |
346 | if (inode->i_ino != cnid) { | 348 | if (inode->i_ino != cnid) { |
347 | HFSPLUS_SB(sb).file_count--; | 349 | sbi->file_count--; |
348 | if (!atomic_read(&HFSPLUS_I(inode).opencnt)) { | 350 | if (!atomic_read(&HFSPLUS_I(inode).opencnt)) { |
349 | res = hfsplus_delete_cat(inode->i_ino, | 351 | res = hfsplus_delete_cat(inode->i_ino, |
350 | HFSPLUS_SB(sb).hidden_dir, | 352 | sbi->hidden_dir, |
351 | NULL); | 353 | NULL); |
352 | if (!res) | 354 | if (!res) |
353 | hfsplus_delete_inode(inode); | 355 | hfsplus_delete_inode(inode); |
@@ -356,7 +358,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | |||
356 | } else | 358 | } else |
357 | hfsplus_delete_inode(inode); | 359 | hfsplus_delete_inode(inode); |
358 | } else | 360 | } else |
359 | HFSPLUS_SB(sb).file_count--; | 361 | sbi->file_count--; |
360 | inode->i_ctime = CURRENT_TIME_SEC; | 362 | inode->i_ctime = CURRENT_TIME_SEC; |
361 | mark_inode_dirty(inode); | 363 | mark_inode_dirty(inode); |
362 | 364 | ||
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 0022eec63cda..181969814344 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
@@ -108,7 +108,7 @@ void hfsplus_ext_write_extent(struct inode *inode) | |||
108 | if (HFSPLUS_I(inode).flags & HFSPLUS_FLG_EXT_DIRTY) { | 108 | if (HFSPLUS_I(inode).flags & HFSPLUS_FLG_EXT_DIRTY) { |
109 | struct hfs_find_data fd; | 109 | struct hfs_find_data fd; |
110 | 110 | ||
111 | hfs_find_init(HFSPLUS_SB(inode->i_sb).ext_tree, &fd); | 111 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); |
112 | __hfsplus_ext_write_extent(inode, &fd); | 112 | __hfsplus_ext_write_extent(inode, &fd); |
113 | hfs_find_exit(&fd); | 113 | hfs_find_exit(&fd); |
114 | } | 114 | } |
@@ -162,7 +162,7 @@ static int hfsplus_ext_read_extent(struct inode *inode, u32 block) | |||
162 | block < HFSPLUS_I(inode).cached_start + HFSPLUS_I(inode).cached_blocks) | 162 | block < HFSPLUS_I(inode).cached_start + HFSPLUS_I(inode).cached_blocks) |
163 | return 0; | 163 | return 0; |
164 | 164 | ||
165 | hfs_find_init(HFSPLUS_SB(inode->i_sb).ext_tree, &fd); | 165 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); |
166 | res = __hfsplus_ext_cache_extent(&fd, inode, block); | 166 | res = __hfsplus_ext_cache_extent(&fd, inode, block); |
167 | hfs_find_exit(&fd); | 167 | hfs_find_exit(&fd); |
168 | return res; | 168 | return res; |
@@ -172,16 +172,15 @@ static int hfsplus_ext_read_extent(struct inode *inode, u32 block) | |||
172 | int hfsplus_get_block(struct inode *inode, sector_t iblock, | 172 | int hfsplus_get_block(struct inode *inode, sector_t iblock, |
173 | struct buffer_head *bh_result, int create) | 173 | struct buffer_head *bh_result, int create) |
174 | { | 174 | { |
175 | struct super_block *sb; | 175 | struct super_block *sb = inode->i_sb; |
176 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
176 | int res = -EIO; | 177 | int res = -EIO; |
177 | u32 ablock, dblock, mask; | 178 | u32 ablock, dblock, mask; |
178 | int shift; | 179 | int shift; |
179 | 180 | ||
180 | sb = inode->i_sb; | ||
181 | |||
182 | /* Convert inode block to disk allocation block */ | 181 | /* Convert inode block to disk allocation block */ |
183 | shift = HFSPLUS_SB(sb).alloc_blksz_shift - sb->s_blocksize_bits; | 182 | shift = sbi->alloc_blksz_shift - sb->s_blocksize_bits; |
184 | ablock = iblock >> HFSPLUS_SB(sb).fs_shift; | 183 | ablock = iblock >> sbi->fs_shift; |
185 | 184 | ||
186 | if (iblock >= HFSPLUS_I(inode).fs_blocks) { | 185 | if (iblock >= HFSPLUS_I(inode).fs_blocks) { |
187 | if (iblock > HFSPLUS_I(inode).fs_blocks || !create) | 186 | if (iblock > HFSPLUS_I(inode).fs_blocks || !create) |
@@ -215,8 +214,8 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, | |||
215 | 214 | ||
216 | done: | 215 | done: |
217 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); | 216 | dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (long long)iblock, dblock); |
218 | mask = (1 << HFSPLUS_SB(sb).fs_shift) - 1; | 217 | mask = (1 << sbi->fs_shift) - 1; |
219 | map_bh(bh_result, sb, (dblock << HFSPLUS_SB(sb).fs_shift) + HFSPLUS_SB(sb).blockoffset + (iblock & mask)); | 218 | map_bh(bh_result, sb, (dblock << sbi->fs_shift) + sbi->blockoffset + (iblock & mask)); |
220 | if (create) { | 219 | if (create) { |
221 | set_buffer_new(bh_result); | 220 | set_buffer_new(bh_result); |
222 | HFSPLUS_I(inode).phys_size += sb->s_blocksize; | 221 | HFSPLUS_I(inode).phys_size += sb->s_blocksize; |
@@ -327,7 +326,7 @@ int hfsplus_free_fork(struct super_block *sb, u32 cnid, struct hfsplus_fork_raw | |||
327 | if (total_blocks == blocks) | 326 | if (total_blocks == blocks) |
328 | return 0; | 327 | return 0; |
329 | 328 | ||
330 | hfs_find_init(HFSPLUS_SB(sb).ext_tree, &fd); | 329 | hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); |
331 | do { | 330 | do { |
332 | res = __hfsplus_ext_read_extent(&fd, ext_entry, cnid, | 331 | res = __hfsplus_ext_read_extent(&fd, ext_entry, cnid, |
333 | total_blocks, type); | 332 | total_blocks, type); |
@@ -348,13 +347,16 @@ int hfsplus_free_fork(struct super_block *sb, u32 cnid, struct hfsplus_fork_raw | |||
348 | int hfsplus_file_extend(struct inode *inode) | 347 | int hfsplus_file_extend(struct inode *inode) |
349 | { | 348 | { |
350 | struct super_block *sb = inode->i_sb; | 349 | struct super_block *sb = inode->i_sb; |
350 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
351 | u32 start, len, goal; | 351 | u32 start, len, goal; |
352 | int res; | 352 | int res; |
353 | 353 | ||
354 | if (HFSPLUS_SB(sb).alloc_file->i_size * 8 < HFSPLUS_SB(sb).total_blocks - HFSPLUS_SB(sb).free_blocks + 8) { | 354 | if (sbi->alloc_file->i_size * 8 < |
355 | sbi->total_blocks - sbi->free_blocks + 8) { | ||
355 | // extend alloc file | 356 | // extend alloc file |
356 | printk(KERN_ERR "hfs: extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8, | 357 | printk(KERN_ERR "hfs: extend alloc file! (%Lu,%u,%u)\n", |
357 | HFSPLUS_SB(sb).total_blocks, HFSPLUS_SB(sb).free_blocks); | 358 | sbi->alloc_file->i_size * 8, |
359 | sbi->total_blocks, sbi->free_blocks); | ||
358 | return -ENOSPC; | 360 | return -ENOSPC; |
359 | } | 361 | } |
360 | 362 | ||
@@ -369,8 +371,8 @@ int hfsplus_file_extend(struct inode *inode) | |||
369 | } | 371 | } |
370 | 372 | ||
371 | len = HFSPLUS_I(inode).clump_blocks; | 373 | len = HFSPLUS_I(inode).clump_blocks; |
372 | start = hfsplus_block_allocate(sb, HFSPLUS_SB(sb).total_blocks, goal, &len); | 374 | start = hfsplus_block_allocate(sb, sbi->total_blocks, goal, &len); |
373 | if (start >= HFSPLUS_SB(sb).total_blocks) { | 375 | if (start >= sbi->total_blocks) { |
374 | start = hfsplus_block_allocate(sb, goal, 0, &len); | 376 | start = hfsplus_block_allocate(sb, goal, 0, &len); |
375 | if (start >= goal) { | 377 | if (start >= goal) { |
376 | res = -ENOSPC; | 378 | res = -ENOSPC; |
@@ -463,13 +465,14 @@ void hfsplus_file_truncate(struct inode *inode) | |||
463 | } else if (inode->i_size == HFSPLUS_I(inode).phys_size) | 465 | } else if (inode->i_size == HFSPLUS_I(inode).phys_size) |
464 | return; | 466 | return; |
465 | 467 | ||
466 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift; | 468 | blk_cnt = (inode->i_size + HFSPLUS_SB(sb)->alloc_blksz - 1) >> |
469 | HFSPLUS_SB(sb)->alloc_blksz_shift; | ||
467 | alloc_cnt = HFSPLUS_I(inode).alloc_blocks; | 470 | alloc_cnt = HFSPLUS_I(inode).alloc_blocks; |
468 | if (blk_cnt == alloc_cnt) | 471 | if (blk_cnt == alloc_cnt) |
469 | goto out; | 472 | goto out; |
470 | 473 | ||
471 | mutex_lock(&HFSPLUS_I(inode).extents_lock); | 474 | mutex_lock(&HFSPLUS_I(inode).extents_lock); |
472 | hfs_find_init(HFSPLUS_SB(sb).ext_tree, &fd); | 475 | hfs_find_init(HFSPLUS_SB(sb)->ext_tree, &fd); |
473 | while (1) { | 476 | while (1) { |
474 | if (alloc_cnt == HFSPLUS_I(inode).first_blocks) { | 477 | if (alloc_cnt == HFSPLUS_I(inode).first_blocks) { |
475 | hfsplus_free_extents(sb, HFSPLUS_I(inode).first_extents, | 478 | hfsplus_free_extents(sb, HFSPLUS_I(inode).first_extents, |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index df0a6312f0f0..55f42b49f0f1 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -375,17 +375,16 @@ int hfsplus_read_wrapper(struct super_block *); | |||
375 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); | 375 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); |
376 | 376 | ||
377 | /* access macros */ | 377 | /* access macros */ |
378 | /* | ||
379 | static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) | 378 | static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) |
380 | { | 379 | { |
381 | return sb->s_fs_info; | 380 | return sb->s_fs_info; |
382 | } | 381 | } |
382 | /* | ||
383 | static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) | 383 | static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) |
384 | { | 384 | { |
385 | return list_entry(inode, struct hfsplus_inode_info, vfs_inode); | 385 | return list_entry(inode, struct hfsplus_inode_info, vfs_inode); |
386 | } | 386 | } |
387 | */ | 387 | */ |
388 | #define HFSPLUS_SB(super) (*(struct hfsplus_sb_info *)(super)->s_fs_info) | ||
389 | #define HFSPLUS_I(inode) (*list_entry(inode, struct hfsplus_inode_info, vfs_inode)) | 388 | #define HFSPLUS_I(inode) (*list_entry(inode, struct hfsplus_inode_info, vfs_inode)) |
390 | 389 | ||
391 | #if 1 | 390 | #if 1 |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index c5a979d62c65..050eee6c81bd 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -62,13 +62,13 @@ static int hfsplus_releasepage(struct page *page, gfp_t mask) | |||
62 | 62 | ||
63 | switch (inode->i_ino) { | 63 | switch (inode->i_ino) { |
64 | case HFSPLUS_EXT_CNID: | 64 | case HFSPLUS_EXT_CNID: |
65 | tree = HFSPLUS_SB(sb).ext_tree; | 65 | tree = HFSPLUS_SB(sb)->ext_tree; |
66 | break; | 66 | break; |
67 | case HFSPLUS_CAT_CNID: | 67 | case HFSPLUS_CAT_CNID: |
68 | tree = HFSPLUS_SB(sb).cat_tree; | 68 | tree = HFSPLUS_SB(sb)->cat_tree; |
69 | break; | 69 | break; |
70 | case HFSPLUS_ATTR_CNID: | 70 | case HFSPLUS_ATTR_CNID: |
71 | tree = HFSPLUS_SB(sb).attr_tree; | 71 | tree = HFSPLUS_SB(sb)->attr_tree; |
72 | break; | 72 | break; |
73 | default: | 73 | default: |
74 | BUG(); | 74 | BUG(); |
@@ -190,7 +190,7 @@ static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dent | |||
190 | mutex_init(&HFSPLUS_I(inode).extents_lock); | 190 | mutex_init(&HFSPLUS_I(inode).extents_lock); |
191 | HFSPLUS_I(inode).flags = HFSPLUS_FLG_RSRC; | 191 | HFSPLUS_I(inode).flags = HFSPLUS_FLG_RSRC; |
192 | 192 | ||
193 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | 193 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
194 | err = hfsplus_find_cat(sb, dir->i_ino, &fd); | 194 | err = hfsplus_find_cat(sb, dir->i_ino, &fd); |
195 | if (!err) | 195 | if (!err) |
196 | err = hfsplus_cat_read_inode(inode, &fd); | 196 | err = hfsplus_cat_read_inode(inode, &fd); |
@@ -202,7 +202,7 @@ static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dent | |||
202 | HFSPLUS_I(inode).rsrc_inode = dir; | 202 | HFSPLUS_I(inode).rsrc_inode = dir; |
203 | HFSPLUS_I(dir).rsrc_inode = inode; | 203 | HFSPLUS_I(dir).rsrc_inode = inode; |
204 | igrab(dir); | 204 | igrab(dir); |
205 | hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb).rsrc_inodes); | 205 | hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb)->rsrc_inodes); |
206 | mark_inode_dirty(inode); | 206 | mark_inode_dirty(inode); |
207 | out: | 207 | out: |
208 | d_add(dentry, inode); | 208 | d_add(dentry, inode); |
@@ -211,26 +211,24 @@ out: | |||
211 | 211 | ||
212 | static void hfsplus_get_perms(struct inode *inode, struct hfsplus_perm *perms, int dir) | 212 | static void hfsplus_get_perms(struct inode *inode, struct hfsplus_perm *perms, int dir) |
213 | { | 213 | { |
214 | struct super_block *sb = inode->i_sb; | 214 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); |
215 | u16 mode; | 215 | u16 mode; |
216 | 216 | ||
217 | mode = be16_to_cpu(perms->mode); | 217 | mode = be16_to_cpu(perms->mode); |
218 | 218 | ||
219 | inode->i_uid = be32_to_cpu(perms->owner); | 219 | inode->i_uid = be32_to_cpu(perms->owner); |
220 | if (!inode->i_uid && !mode) | 220 | if (!inode->i_uid && !mode) |
221 | inode->i_uid = HFSPLUS_SB(sb).uid; | 221 | inode->i_uid = sbi->uid; |
222 | 222 | ||
223 | inode->i_gid = be32_to_cpu(perms->group); | 223 | inode->i_gid = be32_to_cpu(perms->group); |
224 | if (!inode->i_gid && !mode) | 224 | if (!inode->i_gid && !mode) |
225 | inode->i_gid = HFSPLUS_SB(sb).gid; | 225 | inode->i_gid = sbi->gid; |
226 | 226 | ||
227 | if (dir) { | 227 | if (dir) { |
228 | mode = mode ? (mode & S_IALLUGO) : | 228 | mode = mode ? (mode & S_IALLUGO) : (S_IRWXUGO & ~(sbi->umask)); |
229 | (S_IRWXUGO & ~(HFSPLUS_SB(sb).umask)); | ||
230 | mode |= S_IFDIR; | 229 | mode |= S_IFDIR; |
231 | } else if (!mode) | 230 | } else if (!mode) |
232 | mode = S_IFREG | ((S_IRUGO|S_IWUGO) & | 231 | mode = S_IFREG | ((S_IRUGO|S_IWUGO) & ~(sbi->umask)); |
233 | ~(HFSPLUS_SB(sb).umask)); | ||
234 | inode->i_mode = mode; | 232 | inode->i_mode = mode; |
235 | 233 | ||
236 | HFSPLUS_I(inode).rootflags = perms->rootflags; | 234 | HFSPLUS_I(inode).rootflags = perms->rootflags; |
@@ -282,7 +280,8 @@ static int hfsplus_file_release(struct inode *inode, struct file *file) | |||
282 | mutex_lock(&inode->i_mutex); | 280 | mutex_lock(&inode->i_mutex); |
283 | hfsplus_file_truncate(inode); | 281 | hfsplus_file_truncate(inode); |
284 | if (inode->i_flags & S_DEAD) { | 282 | if (inode->i_flags & S_DEAD) { |
285 | hfsplus_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); | 283 | hfsplus_delete_cat(inode->i_ino, |
284 | HFSPLUS_SB(sb)->hidden_dir, NULL); | ||
286 | hfsplus_delete_inode(inode); | 285 | hfsplus_delete_inode(inode); |
287 | } | 286 | } |
288 | mutex_unlock(&inode->i_mutex); | 287 | mutex_unlock(&inode->i_mutex); |
@@ -361,11 +360,13 @@ static const struct file_operations hfsplus_file_operations = { | |||
361 | 360 | ||
362 | struct inode *hfsplus_new_inode(struct super_block *sb, int mode) | 361 | struct inode *hfsplus_new_inode(struct super_block *sb, int mode) |
363 | { | 362 | { |
363 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
364 | struct inode *inode = new_inode(sb); | 364 | struct inode *inode = new_inode(sb); |
365 | |||
365 | if (!inode) | 366 | if (!inode) |
366 | return NULL; | 367 | return NULL; |
367 | 368 | ||
368 | inode->i_ino = HFSPLUS_SB(sb).next_cnid++; | 369 | inode->i_ino = sbi->next_cnid++; |
369 | inode->i_mode = mode; | 370 | inode->i_mode = mode; |
370 | inode->i_uid = current_fsuid(); | 371 | inode->i_uid = current_fsuid(); |
371 | inode->i_gid = current_fsgid(); | 372 | inode->i_gid = current_fsgid(); |
@@ -386,22 +387,22 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode) | |||
386 | HFSPLUS_I(inode).rsrc_inode = NULL; | 387 | HFSPLUS_I(inode).rsrc_inode = NULL; |
387 | if (S_ISDIR(inode->i_mode)) { | 388 | if (S_ISDIR(inode->i_mode)) { |
388 | inode->i_size = 2; | 389 | inode->i_size = 2; |
389 | HFSPLUS_SB(sb).folder_count++; | 390 | sbi->folder_count++; |
390 | inode->i_op = &hfsplus_dir_inode_operations; | 391 | inode->i_op = &hfsplus_dir_inode_operations; |
391 | inode->i_fop = &hfsplus_dir_operations; | 392 | inode->i_fop = &hfsplus_dir_operations; |
392 | } else if (S_ISREG(inode->i_mode)) { | 393 | } else if (S_ISREG(inode->i_mode)) { |
393 | HFSPLUS_SB(sb).file_count++; | 394 | sbi->file_count++; |
394 | inode->i_op = &hfsplus_file_inode_operations; | 395 | inode->i_op = &hfsplus_file_inode_operations; |
395 | inode->i_fop = &hfsplus_file_operations; | 396 | inode->i_fop = &hfsplus_file_operations; |
396 | inode->i_mapping->a_ops = &hfsplus_aops; | 397 | inode->i_mapping->a_ops = &hfsplus_aops; |
397 | HFSPLUS_I(inode).clump_blocks = HFSPLUS_SB(sb).data_clump_blocks; | 398 | HFSPLUS_I(inode).clump_blocks = sbi->data_clump_blocks; |
398 | } else if (S_ISLNK(inode->i_mode)) { | 399 | } else if (S_ISLNK(inode->i_mode)) { |
399 | HFSPLUS_SB(sb).file_count++; | 400 | sbi->file_count++; |
400 | inode->i_op = &page_symlink_inode_operations; | 401 | inode->i_op = &page_symlink_inode_operations; |
401 | inode->i_mapping->a_ops = &hfsplus_aops; | 402 | inode->i_mapping->a_ops = &hfsplus_aops; |
402 | HFSPLUS_I(inode).clump_blocks = 1; | 403 | HFSPLUS_I(inode).clump_blocks = 1; |
403 | } else | 404 | } else |
404 | HFSPLUS_SB(sb).file_count++; | 405 | sbi->file_count++; |
405 | insert_inode_hash(inode); | 406 | insert_inode_hash(inode); |
406 | mark_inode_dirty(inode); | 407 | mark_inode_dirty(inode); |
407 | sb->s_dirt = 1; | 408 | sb->s_dirt = 1; |
@@ -414,11 +415,11 @@ void hfsplus_delete_inode(struct inode *inode) | |||
414 | struct super_block *sb = inode->i_sb; | 415 | struct super_block *sb = inode->i_sb; |
415 | 416 | ||
416 | if (S_ISDIR(inode->i_mode)) { | 417 | if (S_ISDIR(inode->i_mode)) { |
417 | HFSPLUS_SB(sb).folder_count--; | 418 | HFSPLUS_SB(sb)->folder_count--; |
418 | sb->s_dirt = 1; | 419 | sb->s_dirt = 1; |
419 | return; | 420 | return; |
420 | } | 421 | } |
421 | HFSPLUS_SB(sb).file_count--; | 422 | HFSPLUS_SB(sb)->file_count--; |
422 | if (S_ISREG(inode->i_mode)) { | 423 | if (S_ISREG(inode->i_mode)) { |
423 | if (!inode->i_nlink) { | 424 | if (!inode->i_nlink) { |
424 | inode->i_size = 0; | 425 | inode->i_size = 0; |
@@ -434,6 +435,7 @@ void hfsplus_delete_inode(struct inode *inode) | |||
434 | void hfsplus_inode_read_fork(struct inode *inode, struct hfsplus_fork_raw *fork) | 435 | void hfsplus_inode_read_fork(struct inode *inode, struct hfsplus_fork_raw *fork) |
435 | { | 436 | { |
436 | struct super_block *sb = inode->i_sb; | 437 | struct super_block *sb = inode->i_sb; |
438 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
437 | u32 count; | 439 | u32 count; |
438 | int i; | 440 | int i; |
439 | 441 | ||
@@ -450,10 +452,13 @@ void hfsplus_inode_read_fork(struct inode *inode, struct hfsplus_fork_raw *fork) | |||
450 | inode->i_size = HFSPLUS_I(inode).phys_size = be64_to_cpu(fork->total_size); | 452 | inode->i_size = HFSPLUS_I(inode).phys_size = be64_to_cpu(fork->total_size); |
451 | HFSPLUS_I(inode).fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; | 453 | HFSPLUS_I(inode).fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
452 | inode_set_bytes(inode, HFSPLUS_I(inode).fs_blocks << sb->s_blocksize_bits); | 454 | inode_set_bytes(inode, HFSPLUS_I(inode).fs_blocks << sb->s_blocksize_bits); |
453 | HFSPLUS_I(inode).clump_blocks = be32_to_cpu(fork->clump_size) >> HFSPLUS_SB(sb).alloc_blksz_shift; | 455 | HFSPLUS_I(inode).clump_blocks = |
454 | if (!HFSPLUS_I(inode).clump_blocks) | 456 | be32_to_cpu(fork->clump_size) >> sbi->alloc_blksz_shift; |
455 | HFSPLUS_I(inode).clump_blocks = HFSPLUS_IS_RSRC(inode) ? HFSPLUS_SB(sb).rsrc_clump_blocks : | 457 | if (!HFSPLUS_I(inode).clump_blocks) { |
456 | HFSPLUS_SB(sb).data_clump_blocks; | 458 | HFSPLUS_I(inode).clump_blocks = HFSPLUS_IS_RSRC(inode) ? |
459 | sbi->rsrc_clump_blocks : | ||
460 | sbi->data_clump_blocks; | ||
461 | } | ||
457 | } | 462 | } |
458 | 463 | ||
459 | void hfsplus_inode_write_fork(struct inode *inode, struct hfsplus_fork_raw *fork) | 464 | void hfsplus_inode_write_fork(struct inode *inode, struct hfsplus_fork_raw *fork) |
@@ -538,7 +543,7 @@ int hfsplus_cat_write_inode(struct inode *inode) | |||
538 | if (!main_inode->i_nlink) | 543 | if (!main_inode->i_nlink) |
539 | return 0; | 544 | return 0; |
540 | 545 | ||
541 | if (hfs_find_init(HFSPLUS_SB(main_inode->i_sb).cat_tree, &fd)) | 546 | if (hfs_find_init(HFSPLUS_SB(main_inode->i_sb)->cat_tree, &fd)) |
542 | /* panic? */ | 547 | /* panic? */ |
543 | return -EIO; | 548 | return -EIO; |
544 | 549 | ||
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index 906bd3dd3145..66dd64b88b2e 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
@@ -126,7 +126,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name, | |||
126 | if (!S_ISREG(inode->i_mode) || HFSPLUS_IS_RSRC(inode)) | 126 | if (!S_ISREG(inode->i_mode) || HFSPLUS_IS_RSRC(inode)) |
127 | return -EOPNOTSUPP; | 127 | return -EOPNOTSUPP; |
128 | 128 | ||
129 | res = hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd); | 129 | res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd); |
130 | if (res) | 130 | if (res) |
131 | return res; | 131 | return res; |
132 | res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); | 132 | res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); |
@@ -169,7 +169,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | |||
169 | return -EOPNOTSUPP; | 169 | return -EOPNOTSUPP; |
170 | 170 | ||
171 | if (size) { | 171 | if (size) { |
172 | res = hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd); | 172 | res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd); |
173 | if (res) | 173 | if (res) |
174 | return res; | 174 | return res; |
175 | res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); | 175 | res = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); |
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 572628b4b07d..f2598aef206e 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -171,7 +171,7 @@ done: | |||
171 | 171 | ||
172 | int hfsplus_show_options(struct seq_file *seq, struct vfsmount *mnt) | 172 | int hfsplus_show_options(struct seq_file *seq, struct vfsmount *mnt) |
173 | { | 173 | { |
174 | struct hfsplus_sb_info *sbi = &HFSPLUS_SB(mnt->mnt_sb); | 174 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(mnt->mnt_sb); |
175 | 175 | ||
176 | if (sbi->creator != HFSPLUS_DEF_CR_TYPE) | 176 | if (sbi->creator != HFSPLUS_DEF_CR_TYPE) |
177 | seq_printf(seq, ",creator=%.4s", (char *)&sbi->creator); | 177 | seq_printf(seq, ",creator=%.4s", (char *)&sbi->creator); |
diff --git a/fs/hfsplus/part_tbl.c b/fs/hfsplus/part_tbl.c index 1528a6fd0299..208b16c645cc 100644 --- a/fs/hfsplus/part_tbl.c +++ b/fs/hfsplus/part_tbl.c | |||
@@ -74,6 +74,7 @@ struct old_pmap { | |||
74 | int hfs_part_find(struct super_block *sb, | 74 | int hfs_part_find(struct super_block *sb, |
75 | sector_t *part_start, sector_t *part_size) | 75 | sector_t *part_start, sector_t *part_size) |
76 | { | 76 | { |
77 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
77 | struct buffer_head *bh; | 78 | struct buffer_head *bh; |
78 | __be16 *data; | 79 | __be16 *data; |
79 | int i, size, res; | 80 | int i, size, res; |
@@ -95,7 +96,7 @@ int hfs_part_find(struct super_block *sb, | |||
95 | for (i = 0; i < size; p++, i++) { | 96 | for (i = 0; i < size; p++, i++) { |
96 | if (p->pdStart && p->pdSize && | 97 | if (p->pdStart && p->pdSize && |
97 | p->pdFSID == cpu_to_be32(0x54465331)/*"TFS1"*/ && | 98 | p->pdFSID == cpu_to_be32(0x54465331)/*"TFS1"*/ && |
98 | (HFSPLUS_SB(sb).part < 0 || HFSPLUS_SB(sb).part == i)) { | 99 | (sbi->part < 0 || sbi->part == i)) { |
99 | *part_start += be32_to_cpu(p->pdStart); | 100 | *part_start += be32_to_cpu(p->pdStart); |
100 | *part_size = be32_to_cpu(p->pdSize); | 101 | *part_size = be32_to_cpu(p->pdSize); |
101 | res = 0; | 102 | res = 0; |
@@ -111,7 +112,7 @@ int hfs_part_find(struct super_block *sb, | |||
111 | size = be32_to_cpu(pm->pmMapBlkCnt); | 112 | size = be32_to_cpu(pm->pmMapBlkCnt); |
112 | for (i = 0; i < size;) { | 113 | for (i = 0; i < size;) { |
113 | if (!memcmp(pm->pmPartType,"Apple_HFS", 9) && | 114 | if (!memcmp(pm->pmPartType,"Apple_HFS", 9) && |
114 | (HFSPLUS_SB(sb).part < 0 || HFSPLUS_SB(sb).part == i)) { | 115 | (sbi->part < 0 || sbi->part == i)) { |
115 | *part_start += be32_to_cpu(pm->pmPyPartStart); | 116 | *part_start += be32_to_cpu(pm->pmPyPartStart); |
116 | *part_size = be32_to_cpu(pm->pmPartBlkCnt); | 117 | *part_size = be32_to_cpu(pm->pmPartBlkCnt); |
117 | res = 0; | 118 | res = 0; |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index a1d3fd920403..1bf00b9ecc1a 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -41,7 +41,7 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino) | |||
41 | 41 | ||
42 | if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { | 42 | if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { |
43 | read_inode: | 43 | read_inode: |
44 | hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd); | 44 | hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &fd); |
45 | err = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); | 45 | err = hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd); |
46 | if (!err) | 46 | if (!err) |
47 | err = hfsplus_cat_read_inode(inode, &fd); | 47 | err = hfsplus_cat_read_inode(inode, &fd); |
@@ -50,7 +50,7 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino) | |||
50 | goto bad_inode; | 50 | goto bad_inode; |
51 | goto done; | 51 | goto done; |
52 | } | 52 | } |
53 | vhdr = HFSPLUS_SB(inode->i_sb).s_vhdr; | 53 | vhdr = HFSPLUS_SB(inode->i_sb)->s_vhdr; |
54 | switch(inode->i_ino) { | 54 | switch(inode->i_ino) { |
55 | case HFSPLUS_ROOT_CNID: | 55 | case HFSPLUS_ROOT_CNID: |
56 | goto read_inode; | 56 | goto read_inode; |
@@ -89,6 +89,7 @@ bad_inode: | |||
89 | static int hfsplus_write_inode(struct inode *inode, | 89 | static int hfsplus_write_inode(struct inode *inode, |
90 | struct writeback_control *wbc) | 90 | struct writeback_control *wbc) |
91 | { | 91 | { |
92 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); | ||
92 | struct hfsplus_vh *vhdr; | 93 | struct hfsplus_vh *vhdr; |
93 | int ret = 0; | 94 | int ret = 0; |
94 | 95 | ||
@@ -97,48 +98,48 @@ static int hfsplus_write_inode(struct inode *inode, | |||
97 | if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { | 98 | if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) { |
98 | return hfsplus_cat_write_inode(inode); | 99 | return hfsplus_cat_write_inode(inode); |
99 | } | 100 | } |
100 | vhdr = HFSPLUS_SB(inode->i_sb).s_vhdr; | 101 | vhdr = sbi->s_vhdr; |
101 | switch (inode->i_ino) { | 102 | switch (inode->i_ino) { |
102 | case HFSPLUS_ROOT_CNID: | 103 | case HFSPLUS_ROOT_CNID: |
103 | ret = hfsplus_cat_write_inode(inode); | 104 | ret = hfsplus_cat_write_inode(inode); |
104 | break; | 105 | break; |
105 | case HFSPLUS_EXT_CNID: | 106 | case HFSPLUS_EXT_CNID: |
106 | if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) { | 107 | if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) { |
107 | HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP; | 108 | sbi->flags |= HFSPLUS_SB_WRITEBACKUP; |
108 | inode->i_sb->s_dirt = 1; | 109 | inode->i_sb->s_dirt = 1; |
109 | } | 110 | } |
110 | hfsplus_inode_write_fork(inode, &vhdr->ext_file); | 111 | hfsplus_inode_write_fork(inode, &vhdr->ext_file); |
111 | hfs_btree_write(HFSPLUS_SB(inode->i_sb).ext_tree); | 112 | hfs_btree_write(sbi->ext_tree); |
112 | break; | 113 | break; |
113 | case HFSPLUS_CAT_CNID: | 114 | case HFSPLUS_CAT_CNID: |
114 | if (vhdr->cat_file.total_size != cpu_to_be64(inode->i_size)) { | 115 | if (vhdr->cat_file.total_size != cpu_to_be64(inode->i_size)) { |
115 | HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP; | 116 | sbi->flags |= HFSPLUS_SB_WRITEBACKUP; |
116 | inode->i_sb->s_dirt = 1; | 117 | inode->i_sb->s_dirt = 1; |
117 | } | 118 | } |
118 | hfsplus_inode_write_fork(inode, &vhdr->cat_file); | 119 | hfsplus_inode_write_fork(inode, &vhdr->cat_file); |
119 | hfs_btree_write(HFSPLUS_SB(inode->i_sb).cat_tree); | 120 | hfs_btree_write(sbi->cat_tree); |
120 | break; | 121 | break; |
121 | case HFSPLUS_ALLOC_CNID: | 122 | case HFSPLUS_ALLOC_CNID: |
122 | if (vhdr->alloc_file.total_size != cpu_to_be64(inode->i_size)) { | 123 | if (vhdr->alloc_file.total_size != cpu_to_be64(inode->i_size)) { |
123 | HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP; | 124 | sbi->flags |= HFSPLUS_SB_WRITEBACKUP; |
124 | inode->i_sb->s_dirt = 1; | 125 | inode->i_sb->s_dirt = 1; |
125 | } | 126 | } |
126 | hfsplus_inode_write_fork(inode, &vhdr->alloc_file); | 127 | hfsplus_inode_write_fork(inode, &vhdr->alloc_file); |
127 | break; | 128 | break; |
128 | case HFSPLUS_START_CNID: | 129 | case HFSPLUS_START_CNID: |
129 | if (vhdr->start_file.total_size != cpu_to_be64(inode->i_size)) { | 130 | if (vhdr->start_file.total_size != cpu_to_be64(inode->i_size)) { |
130 | HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP; | 131 | sbi->flags |= HFSPLUS_SB_WRITEBACKUP; |
131 | inode->i_sb->s_dirt = 1; | 132 | inode->i_sb->s_dirt = 1; |
132 | } | 133 | } |
133 | hfsplus_inode_write_fork(inode, &vhdr->start_file); | 134 | hfsplus_inode_write_fork(inode, &vhdr->start_file); |
134 | break; | 135 | break; |
135 | case HFSPLUS_ATTR_CNID: | 136 | case HFSPLUS_ATTR_CNID: |
136 | if (vhdr->attr_file.total_size != cpu_to_be64(inode->i_size)) { | 137 | if (vhdr->attr_file.total_size != cpu_to_be64(inode->i_size)) { |
137 | HFSPLUS_SB(inode->i_sb).flags |= HFSPLUS_SB_WRITEBACKUP; | 138 | sbi->flags |= HFSPLUS_SB_WRITEBACKUP; |
138 | inode->i_sb->s_dirt = 1; | 139 | inode->i_sb->s_dirt = 1; |
139 | } | 140 | } |
140 | hfsplus_inode_write_fork(inode, &vhdr->attr_file); | 141 | hfsplus_inode_write_fork(inode, &vhdr->attr_file); |
141 | hfs_btree_write(HFSPLUS_SB(inode->i_sb).attr_tree); | 142 | hfs_btree_write(sbi->attr_tree); |
142 | break; | 143 | break; |
143 | } | 144 | } |
144 | return ret; | 145 | return ret; |
@@ -157,44 +158,46 @@ static void hfsplus_evict_inode(struct inode *inode) | |||
157 | 158 | ||
158 | int hfsplus_sync_fs(struct super_block *sb, int wait) | 159 | int hfsplus_sync_fs(struct super_block *sb, int wait) |
159 | { | 160 | { |
160 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 161 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
162 | struct hfsplus_vh *vhdr = sbi->s_vhdr; | ||
161 | 163 | ||
162 | dprint(DBG_SUPER, "hfsplus_write_super\n"); | 164 | dprint(DBG_SUPER, "hfsplus_write_super\n"); |
163 | 165 | ||
164 | mutex_lock(&HFSPLUS_SB(sb).alloc_mutex); | 166 | mutex_lock(&sbi->alloc_mutex); |
165 | sb->s_dirt = 0; | 167 | sb->s_dirt = 0; |
166 | 168 | ||
167 | vhdr->free_blocks = cpu_to_be32(HFSPLUS_SB(sb).free_blocks); | 169 | vhdr->free_blocks = cpu_to_be32(sbi->free_blocks); |
168 | vhdr->next_alloc = cpu_to_be32(HFSPLUS_SB(sb).next_alloc); | 170 | vhdr->next_alloc = cpu_to_be32(sbi->next_alloc); |
169 | vhdr->next_cnid = cpu_to_be32(HFSPLUS_SB(sb).next_cnid); | 171 | vhdr->next_cnid = cpu_to_be32(sbi->next_cnid); |
170 | vhdr->folder_count = cpu_to_be32(HFSPLUS_SB(sb).folder_count); | 172 | vhdr->folder_count = cpu_to_be32(sbi->folder_count); |
171 | vhdr->file_count = cpu_to_be32(HFSPLUS_SB(sb).file_count); | 173 | vhdr->file_count = cpu_to_be32(sbi->file_count); |
172 | 174 | ||
173 | mark_buffer_dirty(HFSPLUS_SB(sb).s_vhbh); | 175 | mark_buffer_dirty(sbi->s_vhbh); |
174 | if (HFSPLUS_SB(sb).flags & HFSPLUS_SB_WRITEBACKUP) { | 176 | if (sbi->flags & HFSPLUS_SB_WRITEBACKUP) { |
175 | if (HFSPLUS_SB(sb).sect_count) { | 177 | if (sbi->sect_count) { |
176 | struct buffer_head *bh; | 178 | struct buffer_head *bh; |
177 | u32 block, offset; | 179 | u32 block, offset; |
178 | 180 | ||
179 | block = HFSPLUS_SB(sb).blockoffset; | 181 | block = sbi->blockoffset; |
180 | block += (HFSPLUS_SB(sb).sect_count - 2) >> (sb->s_blocksize_bits - 9); | 182 | block += (sbi->sect_count - 2) >> (sb->s_blocksize_bits - 9); |
181 | offset = ((HFSPLUS_SB(sb).sect_count - 2) << 9) & (sb->s_blocksize - 1); | 183 | offset = ((sbi->sect_count - 2) << 9) & (sb->s_blocksize - 1); |
182 | printk(KERN_DEBUG "hfs: backup: %u,%u,%u,%u\n", HFSPLUS_SB(sb).blockoffset, | 184 | printk(KERN_DEBUG "hfs: backup: %u,%u,%u,%u\n", |
183 | HFSPLUS_SB(sb).sect_count, block, offset); | 185 | sbi->blockoffset, sbi->sect_count, |
186 | block, offset); | ||
184 | bh = sb_bread(sb, block); | 187 | bh = sb_bread(sb, block); |
185 | if (bh) { | 188 | if (bh) { |
186 | vhdr = (struct hfsplus_vh *)(bh->b_data + offset); | 189 | vhdr = (struct hfsplus_vh *)(bh->b_data + offset); |
187 | if (be16_to_cpu(vhdr->signature) == HFSPLUS_VOLHEAD_SIG) { | 190 | if (be16_to_cpu(vhdr->signature) == HFSPLUS_VOLHEAD_SIG) { |
188 | memcpy(vhdr, HFSPLUS_SB(sb).s_vhdr, sizeof(*vhdr)); | 191 | memcpy(vhdr, sbi->s_vhdr, sizeof(*vhdr)); |
189 | mark_buffer_dirty(bh); | 192 | mark_buffer_dirty(bh); |
190 | brelse(bh); | 193 | brelse(bh); |
191 | } else | 194 | } else |
192 | printk(KERN_WARNING "hfs: backup not found!\n"); | 195 | printk(KERN_WARNING "hfs: backup not found!\n"); |
193 | } | 196 | } |
194 | } | 197 | } |
195 | HFSPLUS_SB(sb).flags &= ~HFSPLUS_SB_WRITEBACKUP; | 198 | sbi->flags &= ~HFSPLUS_SB_WRITEBACKUP; |
196 | } | 199 | } |
197 | mutex_unlock(&HFSPLUS_SB(sb).alloc_mutex); | 200 | mutex_unlock(&sbi->alloc_mutex); |
198 | return 0; | 201 | return 0; |
199 | } | 202 | } |
200 | 203 | ||
@@ -208,28 +211,31 @@ static void hfsplus_write_super(struct super_block *sb) | |||
208 | 211 | ||
209 | static void hfsplus_put_super(struct super_block *sb) | 212 | static void hfsplus_put_super(struct super_block *sb) |
210 | { | 213 | { |
214 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
215 | |||
211 | dprint(DBG_SUPER, "hfsplus_put_super\n"); | 216 | dprint(DBG_SUPER, "hfsplus_put_super\n"); |
217 | |||
212 | if (!sb->s_fs_info) | 218 | if (!sb->s_fs_info) |
213 | return; | 219 | return; |
214 | 220 | ||
215 | if (sb->s_dirt) | 221 | if (sb->s_dirt) |
216 | hfsplus_write_super(sb); | 222 | hfsplus_write_super(sb); |
217 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { | 223 | if (!(sb->s_flags & MS_RDONLY) && sbi->s_vhdr) { |
218 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 224 | struct hfsplus_vh *vhdr = sbi->s_vhdr; |
219 | 225 | ||
220 | vhdr->modify_date = hfsp_now2mt(); | 226 | vhdr->modify_date = hfsp_now2mt(); |
221 | vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_UNMNT); | 227 | vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_UNMNT); |
222 | vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_INCNSTNT); | 228 | vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_INCNSTNT); |
223 | mark_buffer_dirty(HFSPLUS_SB(sb).s_vhbh); | 229 | mark_buffer_dirty(sbi->s_vhbh); |
224 | sync_dirty_buffer(HFSPLUS_SB(sb).s_vhbh); | 230 | sync_dirty_buffer(sbi->s_vhbh); |
225 | } | 231 | } |
226 | 232 | ||
227 | hfs_btree_close(HFSPLUS_SB(sb).cat_tree); | 233 | hfs_btree_close(sbi->cat_tree); |
228 | hfs_btree_close(HFSPLUS_SB(sb).ext_tree); | 234 | hfs_btree_close(sbi->ext_tree); |
229 | iput(HFSPLUS_SB(sb).alloc_file); | 235 | iput(sbi->alloc_file); |
230 | iput(HFSPLUS_SB(sb).hidden_dir); | 236 | iput(sbi->hidden_dir); |
231 | brelse(HFSPLUS_SB(sb).s_vhbh); | 237 | brelse(sbi->s_vhbh); |
232 | unload_nls(HFSPLUS_SB(sb).nls); | 238 | unload_nls(sbi->nls); |
233 | kfree(sb->s_fs_info); | 239 | kfree(sb->s_fs_info); |
234 | sb->s_fs_info = NULL; | 240 | sb->s_fs_info = NULL; |
235 | } | 241 | } |
@@ -237,15 +243,16 @@ static void hfsplus_put_super(struct super_block *sb) | |||
237 | static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) | 243 | static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) |
238 | { | 244 | { |
239 | struct super_block *sb = dentry->d_sb; | 245 | struct super_block *sb = dentry->d_sb; |
246 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
240 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); | 247 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); |
241 | 248 | ||
242 | buf->f_type = HFSPLUS_SUPER_MAGIC; | 249 | buf->f_type = HFSPLUS_SUPER_MAGIC; |
243 | buf->f_bsize = sb->s_blocksize; | 250 | buf->f_bsize = sb->s_blocksize; |
244 | buf->f_blocks = HFSPLUS_SB(sb).total_blocks << HFSPLUS_SB(sb).fs_shift; | 251 | buf->f_blocks = sbi->total_blocks << sbi->fs_shift; |
245 | buf->f_bfree = HFSPLUS_SB(sb).free_blocks << HFSPLUS_SB(sb).fs_shift; | 252 | buf->f_bfree = sbi->free_blocks << sbi->fs_shift; |
246 | buf->f_bavail = buf->f_bfree; | 253 | buf->f_bavail = buf->f_bfree; |
247 | buf->f_files = 0xFFFFFFFF; | 254 | buf->f_files = 0xFFFFFFFF; |
248 | buf->f_ffree = 0xFFFFFFFF - HFSPLUS_SB(sb).next_cnid; | 255 | buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid; |
249 | buf->f_fsid.val[0] = (u32)id; | 256 | buf->f_fsid.val[0] = (u32)id; |
250 | buf->f_fsid.val[1] = (u32)(id >> 32); | 257 | buf->f_fsid.val[1] = (u32)(id >> 32); |
251 | buf->f_namelen = HFSPLUS_MAX_STRLEN; | 258 | buf->f_namelen = HFSPLUS_MAX_STRLEN; |
@@ -258,11 +265,11 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data) | |||
258 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 265 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) |
259 | return 0; | 266 | return 0; |
260 | if (!(*flags & MS_RDONLY)) { | 267 | if (!(*flags & MS_RDONLY)) { |
261 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 268 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb)->s_vhdr; |
262 | struct hfsplus_sb_info sbi; | 269 | struct hfsplus_sb_info sbi; |
263 | 270 | ||
264 | memset(&sbi, 0, sizeof(struct hfsplus_sb_info)); | 271 | memset(&sbi, 0, sizeof(struct hfsplus_sb_info)); |
265 | sbi.nls = HFSPLUS_SB(sb).nls; | 272 | sbi.nls = HFSPLUS_SB(sb)->nls; |
266 | if (!hfsplus_parse_options(data, &sbi)) | 273 | if (!hfsplus_parse_options(data, &sbi)) |
267 | return -EINVAL; | 274 | return -EINVAL; |
268 | 275 | ||
@@ -340,7 +347,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
340 | err = -EINVAL; | 347 | err = -EINVAL; |
341 | goto cleanup; | 348 | goto cleanup; |
342 | } | 349 | } |
343 | vhdr = HFSPLUS_SB(sb).s_vhdr; | 350 | vhdr = sbi->s_vhdr; |
344 | 351 | ||
345 | /* Copy parts of the volume header into the superblock */ | 352 | /* Copy parts of the volume header into the superblock */ |
346 | sb->s_magic = HFSPLUS_VOLHEAD_SIG; | 353 | sb->s_magic = HFSPLUS_VOLHEAD_SIG; |
@@ -349,18 +356,20 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
349 | printk(KERN_ERR "hfs: wrong filesystem version\n"); | 356 | printk(KERN_ERR "hfs: wrong filesystem version\n"); |
350 | goto cleanup; | 357 | goto cleanup; |
351 | } | 358 | } |
352 | HFSPLUS_SB(sb).total_blocks = be32_to_cpu(vhdr->total_blocks); | 359 | sbi->total_blocks = be32_to_cpu(vhdr->total_blocks); |
353 | HFSPLUS_SB(sb).free_blocks = be32_to_cpu(vhdr->free_blocks); | 360 | sbi->free_blocks = be32_to_cpu(vhdr->free_blocks); |
354 | HFSPLUS_SB(sb).next_alloc = be32_to_cpu(vhdr->next_alloc); | 361 | sbi->next_alloc = be32_to_cpu(vhdr->next_alloc); |
355 | HFSPLUS_SB(sb).next_cnid = be32_to_cpu(vhdr->next_cnid); | 362 | sbi->next_cnid = be32_to_cpu(vhdr->next_cnid); |
356 | HFSPLUS_SB(sb).file_count = be32_to_cpu(vhdr->file_count); | 363 | sbi->file_count = be32_to_cpu(vhdr->file_count); |
357 | HFSPLUS_SB(sb).folder_count = be32_to_cpu(vhdr->folder_count); | 364 | sbi->folder_count = be32_to_cpu(vhdr->folder_count); |
358 | HFSPLUS_SB(sb).data_clump_blocks = be32_to_cpu(vhdr->data_clump_sz) >> HFSPLUS_SB(sb).alloc_blksz_shift; | 365 | sbi->data_clump_blocks = |
359 | if (!HFSPLUS_SB(sb).data_clump_blocks) | 366 | be32_to_cpu(vhdr->data_clump_sz) >> sbi->alloc_blksz_shift; |
360 | HFSPLUS_SB(sb).data_clump_blocks = 1; | 367 | if (!sbi->data_clump_blocks) |
361 | HFSPLUS_SB(sb).rsrc_clump_blocks = be32_to_cpu(vhdr->rsrc_clump_sz) >> HFSPLUS_SB(sb).alloc_blksz_shift; | 368 | sbi->data_clump_blocks = 1; |
362 | if (!HFSPLUS_SB(sb).rsrc_clump_blocks) | 369 | sbi->rsrc_clump_blocks = |
363 | HFSPLUS_SB(sb).rsrc_clump_blocks = 1; | 370 | be32_to_cpu(vhdr->rsrc_clump_sz) >> sbi->alloc_blksz_shift; |
371 | if (!sbi->rsrc_clump_blocks) | ||
372 | sbi->rsrc_clump_blocks = 1; | ||
364 | 373 | ||
365 | /* Set up operations so we can load metadata */ | 374 | /* Set up operations so we can load metadata */ |
366 | sb->s_op = &hfsplus_sops; | 375 | sb->s_op = &hfsplus_sops; |
@@ -383,13 +392,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
383 | sbi->flags &= ~HFSPLUS_SB_FORCE; | 392 | sbi->flags &= ~HFSPLUS_SB_FORCE; |
384 | 393 | ||
385 | /* Load metadata objects (B*Trees) */ | 394 | /* Load metadata objects (B*Trees) */ |
386 | HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); | 395 | sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); |
387 | if (!HFSPLUS_SB(sb).ext_tree) { | 396 | if (!sbi->ext_tree) { |
388 | printk(KERN_ERR "hfs: failed to load extents file\n"); | 397 | printk(KERN_ERR "hfs: failed to load extents file\n"); |
389 | goto cleanup; | 398 | goto cleanup; |
390 | } | 399 | } |
391 | HFSPLUS_SB(sb).cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); | 400 | sbi->cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); |
392 | if (!HFSPLUS_SB(sb).cat_tree) { | 401 | if (!sbi->cat_tree) { |
393 | printk(KERN_ERR "hfs: failed to load catalog file\n"); | 402 | printk(KERN_ERR "hfs: failed to load catalog file\n"); |
394 | goto cleanup; | 403 | goto cleanup; |
395 | } | 404 | } |
@@ -400,7 +409,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
400 | err = PTR_ERR(inode); | 409 | err = PTR_ERR(inode); |
401 | goto cleanup; | 410 | goto cleanup; |
402 | } | 411 | } |
403 | HFSPLUS_SB(sb).alloc_file = inode; | 412 | sbi->alloc_file = inode; |
404 | 413 | ||
405 | /* Load the root directory */ | 414 | /* Load the root directory */ |
406 | root = hfsplus_iget(sb, HFSPLUS_ROOT_CNID); | 415 | root = hfsplus_iget(sb, HFSPLUS_ROOT_CNID); |
@@ -419,7 +428,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
419 | 428 | ||
420 | str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1; | 429 | str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1; |
421 | str.name = HFSP_HIDDENDIR_NAME; | 430 | str.name = HFSP_HIDDENDIR_NAME; |
422 | hfs_find_init(HFSPLUS_SB(sb).cat_tree, &fd); | 431 | hfs_find_init(sbi->cat_tree, &fd); |
423 | hfsplus_cat_build_key(sb, fd.search_key, HFSPLUS_ROOT_CNID, &str); | 432 | hfsplus_cat_build_key(sb, fd.search_key, HFSPLUS_ROOT_CNID, &str); |
424 | if (!hfs_brec_read(&fd, &entry, sizeof(entry))) { | 433 | if (!hfs_brec_read(&fd, &entry, sizeof(entry))) { |
425 | hfs_find_exit(&fd); | 434 | hfs_find_exit(&fd); |
@@ -430,7 +439,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
430 | err = PTR_ERR(inode); | 439 | err = PTR_ERR(inode); |
431 | goto cleanup; | 440 | goto cleanup; |
432 | } | 441 | } |
433 | HFSPLUS_SB(sb).hidden_dir = inode; | 442 | sbi->hidden_dir = inode; |
434 | } else | 443 | } else |
435 | hfs_find_exit(&fd); | 444 | hfs_find_exit(&fd); |
436 | 445 | ||
@@ -445,15 +454,15 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
445 | be32_add_cpu(&vhdr->write_count, 1); | 454 | be32_add_cpu(&vhdr->write_count, 1); |
446 | vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_UNMNT); | 455 | vhdr->attributes &= cpu_to_be32(~HFSPLUS_VOL_UNMNT); |
447 | vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_INCNSTNT); | 456 | vhdr->attributes |= cpu_to_be32(HFSPLUS_VOL_INCNSTNT); |
448 | mark_buffer_dirty(HFSPLUS_SB(sb).s_vhbh); | 457 | mark_buffer_dirty(sbi->s_vhbh); |
449 | sync_dirty_buffer(HFSPLUS_SB(sb).s_vhbh); | 458 | sync_dirty_buffer(sbi->s_vhbh); |
450 | 459 | ||
451 | if (!HFSPLUS_SB(sb).hidden_dir) { | 460 | if (!sbi->hidden_dir) { |
452 | printk(KERN_DEBUG "hfs: create hidden dir...\n"); | 461 | printk(KERN_DEBUG "hfs: create hidden dir...\n"); |
453 | HFSPLUS_SB(sb).hidden_dir = hfsplus_new_inode(sb, S_IFDIR); | 462 | sbi->hidden_dir = hfsplus_new_inode(sb, S_IFDIR); |
454 | hfsplus_create_cat(HFSPLUS_SB(sb).hidden_dir->i_ino, sb->s_root->d_inode, | 463 | hfsplus_create_cat(sbi->hidden_dir->i_ino, sb->s_root->d_inode, |
455 | &str, HFSPLUS_SB(sb).hidden_dir); | 464 | &str, sbi->hidden_dir); |
456 | mark_inode_dirty(HFSPLUS_SB(sb).hidden_dir); | 465 | mark_inode_dirty(sbi->hidden_dir); |
457 | } | 466 | } |
458 | out: | 467 | out: |
459 | unload_nls(sbi->nls); | 468 | unload_nls(sbi->nls); |
diff --git a/fs/hfsplus/unicode.c b/fs/hfsplus/unicode.c index 628ccf6fa402..a15fcffce74f 100644 --- a/fs/hfsplus/unicode.c +++ b/fs/hfsplus/unicode.c | |||
@@ -121,7 +121,7 @@ static u16 *hfsplus_compose_lookup(u16 *p, u16 cc) | |||
121 | int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr, char *astr, int *len_p) | 121 | int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr, char *astr, int *len_p) |
122 | { | 122 | { |
123 | const hfsplus_unichr *ip; | 123 | const hfsplus_unichr *ip; |
124 | struct nls_table *nls = HFSPLUS_SB(sb).nls; | 124 | struct nls_table *nls = HFSPLUS_SB(sb)->nls; |
125 | u8 *op; | 125 | u8 *op; |
126 | u16 cc, c0, c1; | 126 | u16 cc, c0, c1; |
127 | u16 *ce1, *ce2; | 127 | u16 *ce1, *ce2; |
@@ -132,7 +132,7 @@ int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr, c | |||
132 | ustrlen = be16_to_cpu(ustr->length); | 132 | ustrlen = be16_to_cpu(ustr->length); |
133 | len = *len_p; | 133 | len = *len_p; |
134 | ce1 = NULL; | 134 | ce1 = NULL; |
135 | compose = !(HFSPLUS_SB(sb).flags & HFSPLUS_SB_NODECOMPOSE); | 135 | compose = !(HFSPLUS_SB(sb)->flags & HFSPLUS_SB_NODECOMPOSE); |
136 | 136 | ||
137 | while (ustrlen > 0) { | 137 | while (ustrlen > 0) { |
138 | c0 = be16_to_cpu(*ip++); | 138 | c0 = be16_to_cpu(*ip++); |
@@ -246,7 +246,7 @@ out: | |||
246 | static inline int asc2unichar(struct super_block *sb, const char *astr, int len, | 246 | static inline int asc2unichar(struct super_block *sb, const char *astr, int len, |
247 | wchar_t *uc) | 247 | wchar_t *uc) |
248 | { | 248 | { |
249 | int size = HFSPLUS_SB(sb).nls->char2uni(astr, len, uc); | 249 | int size = HFSPLUS_SB(sb)->nls->char2uni(astr, len, uc); |
250 | if (size <= 0) { | 250 | if (size <= 0) { |
251 | *uc = '?'; | 251 | *uc = '?'; |
252 | size = 1; | 252 | size = 1; |
@@ -293,7 +293,7 @@ int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr, | |||
293 | u16 *dstr, outlen = 0; | 293 | u16 *dstr, outlen = 0; |
294 | wchar_t c; | 294 | wchar_t c; |
295 | 295 | ||
296 | decompose = !(HFSPLUS_SB(sb).flags & HFSPLUS_SB_NODECOMPOSE); | 296 | decompose = !(HFSPLUS_SB(sb)->flags & HFSPLUS_SB_NODECOMPOSE); |
297 | while (outlen < HFSPLUS_MAX_STRLEN && len > 0) { | 297 | while (outlen < HFSPLUS_MAX_STRLEN && len > 0) { |
298 | size = asc2unichar(sb, astr, len, &c); | 298 | size = asc2unichar(sb, astr, len, &c); |
299 | 299 | ||
@@ -330,8 +330,8 @@ int hfsplus_hash_dentry(struct dentry *dentry, struct qstr *str) | |||
330 | wchar_t c; | 330 | wchar_t c; |
331 | u16 c2; | 331 | u16 c2; |
332 | 332 | ||
333 | casefold = (HFSPLUS_SB(sb).flags & HFSPLUS_SB_CASEFOLD); | 333 | casefold = (HFSPLUS_SB(sb)->flags & HFSPLUS_SB_CASEFOLD); |
334 | decompose = !(HFSPLUS_SB(sb).flags & HFSPLUS_SB_NODECOMPOSE); | 334 | decompose = !(HFSPLUS_SB(sb)->flags & HFSPLUS_SB_NODECOMPOSE); |
335 | hash = init_name_hash(); | 335 | hash = init_name_hash(); |
336 | astr = str->name; | 336 | astr = str->name; |
337 | len = str->len; | 337 | len = str->len; |
@@ -373,8 +373,8 @@ int hfsplus_compare_dentry(struct dentry *dentry, struct qstr *s1, struct qstr * | |||
373 | u16 c1, c2; | 373 | u16 c1, c2; |
374 | wchar_t c; | 374 | wchar_t c; |
375 | 375 | ||
376 | casefold = (HFSPLUS_SB(sb).flags & HFSPLUS_SB_CASEFOLD); | 376 | casefold = (HFSPLUS_SB(sb)->flags & HFSPLUS_SB_CASEFOLD); |
377 | decompose = !(HFSPLUS_SB(sb).flags & HFSPLUS_SB_NODECOMPOSE); | 377 | decompose = !(HFSPLUS_SB(sb)->flags & HFSPLUS_SB_NODECOMPOSE); |
378 | astr1 = s1->name; | 378 | astr1 = s1->name; |
379 | len1 = s1->len; | 379 | len1 = s1->len; |
380 | astr2 = s2->name; | 380 | astr2 = s2->name; |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index bed78ac8f6d1..c89e198e8a2a 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
@@ -65,8 +65,8 @@ static int hfsplus_get_last_session(struct super_block *sb, | |||
65 | *start = 0; | 65 | *start = 0; |
66 | *size = sb->s_bdev->bd_inode->i_size >> 9; | 66 | *size = sb->s_bdev->bd_inode->i_size >> 9; |
67 | 67 | ||
68 | if (HFSPLUS_SB(sb).session >= 0) { | 68 | if (HFSPLUS_SB(sb)->session >= 0) { |
69 | te.cdte_track = HFSPLUS_SB(sb).session; | 69 | te.cdte_track = HFSPLUS_SB(sb)->session; |
70 | te.cdte_format = CDROM_LBA; | 70 | te.cdte_format = CDROM_LBA; |
71 | res = ioctl_by_bdev(sb->s_bdev, CDROMREADTOCENTRY, (unsigned long)&te); | 71 | res = ioctl_by_bdev(sb->s_bdev, CDROMREADTOCENTRY, (unsigned long)&te); |
72 | if (!res && (te.cdte_ctrl & CDROM_DATA_TRACK) == 4) { | 72 | if (!res && (te.cdte_ctrl & CDROM_DATA_TRACK) == 4) { |
@@ -87,6 +87,7 @@ static int hfsplus_get_last_session(struct super_block *sb, | |||
87 | /* Takes in super block, returns true if good data read */ | 87 | /* Takes in super block, returns true if good data read */ |
88 | int hfsplus_read_wrapper(struct super_block *sb) | 88 | int hfsplus_read_wrapper(struct super_block *sb) |
89 | { | 89 | { |
90 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | ||
90 | struct buffer_head *bh; | 91 | struct buffer_head *bh; |
91 | struct hfsplus_vh *vhdr; | 92 | struct hfsplus_vh *vhdr; |
92 | struct hfsplus_wd wd; | 93 | struct hfsplus_wd wd; |
@@ -122,7 +123,7 @@ int hfsplus_read_wrapper(struct super_block *sb) | |||
122 | if (vhdr->signature == cpu_to_be16(HFSPLUS_VOLHEAD_SIG)) | 123 | if (vhdr->signature == cpu_to_be16(HFSPLUS_VOLHEAD_SIG)) |
123 | break; | 124 | break; |
124 | if (vhdr->signature == cpu_to_be16(HFSPLUS_VOLHEAD_SIGX)) { | 125 | if (vhdr->signature == cpu_to_be16(HFSPLUS_VOLHEAD_SIGX)) { |
125 | HFSPLUS_SB(sb).flags |= HFSPLUS_SB_HFSX; | 126 | sbi->flags |= HFSPLUS_SB_HFSX; |
126 | break; | 127 | break; |
127 | } | 128 | } |
128 | brelse(bh); | 129 | brelse(bh); |
@@ -143,11 +144,11 @@ int hfsplus_read_wrapper(struct super_block *sb) | |||
143 | if (blocksize < HFSPLUS_SECTOR_SIZE || | 144 | if (blocksize < HFSPLUS_SECTOR_SIZE || |
144 | ((blocksize - 1) & blocksize)) | 145 | ((blocksize - 1) & blocksize)) |
145 | return -EINVAL; | 146 | return -EINVAL; |
146 | HFSPLUS_SB(sb).alloc_blksz = blocksize; | 147 | sbi->alloc_blksz = blocksize; |
147 | HFSPLUS_SB(sb).alloc_blksz_shift = 0; | 148 | sbi->alloc_blksz_shift = 0; |
148 | while ((blocksize >>= 1) != 0) | 149 | while ((blocksize >>= 1) != 0) |
149 | HFSPLUS_SB(sb).alloc_blksz_shift++; | 150 | sbi->alloc_blksz_shift++; |
150 | blocksize = min(HFSPLUS_SB(sb).alloc_blksz, (u32)PAGE_SIZE); | 151 | blocksize = min(sbi->alloc_blksz, (u32)PAGE_SIZE); |
151 | 152 | ||
152 | /* align block size to block offset */ | 153 | /* align block size to block offset */ |
153 | while (part_start & ((blocksize >> HFSPLUS_SECTOR_SHIFT) - 1)) | 154 | while (part_start & ((blocksize >> HFSPLUS_SECTOR_SHIFT) - 1)) |
@@ -158,23 +159,22 @@ int hfsplus_read_wrapper(struct super_block *sb) | |||
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | } | 160 | } |
160 | 161 | ||
161 | HFSPLUS_SB(sb).blockoffset = part_start >> | 162 | sbi->blockoffset = |
162 | (sb->s_blocksize_bits - HFSPLUS_SECTOR_SHIFT); | 163 | part_start >> (sb->s_blocksize_bits - HFSPLUS_SECTOR_SHIFT); |
163 | HFSPLUS_SB(sb).sect_count = part_size; | 164 | sbi->sect_count = part_size; |
164 | HFSPLUS_SB(sb).fs_shift = HFSPLUS_SB(sb).alloc_blksz_shift - | 165 | sbi->fs_shift = sbi->alloc_blksz_shift - sb->s_blocksize_bits; |
165 | sb->s_blocksize_bits; | ||
166 | 166 | ||
167 | bh = sb_bread512(sb, part_start + HFSPLUS_VOLHEAD_SECTOR, vhdr); | 167 | bh = sb_bread512(sb, part_start + HFSPLUS_VOLHEAD_SECTOR, vhdr); |
168 | if (!bh) | 168 | if (!bh) |
169 | return -EIO; | 169 | return -EIO; |
170 | 170 | ||
171 | /* should still be the same... */ | 171 | /* should still be the same... */ |
172 | if (vhdr->signature != (HFSPLUS_SB(sb).flags & HFSPLUS_SB_HFSX ? | 172 | if (vhdr->signature != (sbi->flags & HFSPLUS_SB_HFSX ? |
173 | cpu_to_be16(HFSPLUS_VOLHEAD_SIGX) : | 173 | cpu_to_be16(HFSPLUS_VOLHEAD_SIGX) : |
174 | cpu_to_be16(HFSPLUS_VOLHEAD_SIG))) | 174 | cpu_to_be16(HFSPLUS_VOLHEAD_SIG))) |
175 | goto error; | 175 | goto error; |
176 | HFSPLUS_SB(sb).s_vhbh = bh; | 176 | sbi->s_vhbh = bh; |
177 | HFSPLUS_SB(sb).s_vhdr = vhdr; | 177 | sbi->s_vhdr = vhdr; |
178 | 178 | ||
179 | return 0; | 179 | return 0; |
180 | error: | 180 | error: |