diff options
Diffstat (limited to 'fs/hfsplus/dir.c')
-rw-r--r-- | fs/hfsplus/dir.c | 40 |
1 files changed, 21 insertions, 19 deletions
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 | ||