diff options
Diffstat (limited to 'fs/hfsplus/super.c')
-rw-r--r-- | fs/hfsplus/super.c | 151 |
1 files changed, 80 insertions, 71 deletions
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); |