diff options
Diffstat (limited to 'fs/hfs')
-rw-r--r-- | fs/hfs/dir.c | 2 | ||||
-rw-r--r-- | fs/hfs/hfs_fs.h | 8 | ||||
-rw-r--r-- | fs/hfs/string.c | 17 | ||||
-rw-r--r-- | fs/hfs/super.c | 11 | ||||
-rw-r--r-- | fs/hfs/sysdep.c | 7 |
5 files changed, 31 insertions, 14 deletions
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 2b3b8611b41b..ea4aefe7c652 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -25,7 +25,7 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry, | |||
25 | struct inode *inode = NULL; | 25 | struct inode *inode = NULL; |
26 | int res; | 26 | int res; |
27 | 27 | ||
28 | dentry->d_op = &hfs_dentry_operations; | 28 | d_set_d_op(dentry, &hfs_dentry_operations); |
29 | 29 | ||
30 | hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); | 30 | hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); |
31 | hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); | 31 | hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); |
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index c8cffb81e849..ad97c2d58287 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h | |||
@@ -213,10 +213,14 @@ extern int hfs_part_find(struct super_block *, sector_t *, sector_t *); | |||
213 | /* string.c */ | 213 | /* string.c */ |
214 | extern const struct dentry_operations hfs_dentry_operations; | 214 | extern const struct dentry_operations hfs_dentry_operations; |
215 | 215 | ||
216 | extern int hfs_hash_dentry(struct dentry *, struct qstr *); | 216 | extern int hfs_hash_dentry(const struct dentry *, const struct inode *, |
217 | struct qstr *); | ||
217 | extern int hfs_strcmp(const unsigned char *, unsigned int, | 218 | extern int hfs_strcmp(const unsigned char *, unsigned int, |
218 | const unsigned char *, unsigned int); | 219 | const unsigned char *, unsigned int); |
219 | extern int hfs_compare_dentry(struct dentry *, struct qstr *, struct qstr *); | 220 | extern int hfs_compare_dentry(const struct dentry *parent, |
221 | const struct inode *pinode, | ||
222 | const struct dentry *dentry, const struct inode *inode, | ||
223 | unsigned int len, const char *str, const struct qstr *name); | ||
220 | 224 | ||
221 | /* trans.c */ | 225 | /* trans.c */ |
222 | extern void hfs_asc2mac(struct super_block *, struct hfs_name *, struct qstr *); | 226 | extern void hfs_asc2mac(struct super_block *, struct hfs_name *, struct qstr *); |
diff --git a/fs/hfs/string.c b/fs/hfs/string.c index 927a5af79428..495a976a3cc9 100644 --- a/fs/hfs/string.c +++ b/fs/hfs/string.c | |||
@@ -51,7 +51,8 @@ static unsigned char caseorder[256] = { | |||
51 | /* | 51 | /* |
52 | * Hash a string to an integer in a case-independent way | 52 | * Hash a string to an integer in a case-independent way |
53 | */ | 53 | */ |
54 | int hfs_hash_dentry(struct dentry *dentry, struct qstr *this) | 54 | int hfs_hash_dentry(const struct dentry *dentry, const struct inode *inode, |
55 | struct qstr *this) | ||
55 | { | 56 | { |
56 | const unsigned char *name = this->name; | 57 | const unsigned char *name = this->name; |
57 | unsigned int hash, len = this->len; | 58 | unsigned int hash, len = this->len; |
@@ -92,21 +93,21 @@ int hfs_strcmp(const unsigned char *s1, unsigned int len1, | |||
92 | * Test for equality of two strings in the HFS filename character ordering. | 93 | * Test for equality of two strings in the HFS filename character ordering. |
93 | * return 1 on failure and 0 on success | 94 | * return 1 on failure and 0 on success |
94 | */ | 95 | */ |
95 | int hfs_compare_dentry(struct dentry *dentry, struct qstr *s1, struct qstr *s2) | 96 | int hfs_compare_dentry(const struct dentry *parent, const struct inode *pinode, |
97 | const struct dentry *dentry, const struct inode *inode, | ||
98 | unsigned int len, const char *str, const struct qstr *name) | ||
96 | { | 99 | { |
97 | const unsigned char *n1, *n2; | 100 | const unsigned char *n1, *n2; |
98 | int len; | ||
99 | 101 | ||
100 | len = s1->len; | ||
101 | if (len >= HFS_NAMELEN) { | 102 | if (len >= HFS_NAMELEN) { |
102 | if (s2->len < HFS_NAMELEN) | 103 | if (name->len < HFS_NAMELEN) |
103 | return 1; | 104 | return 1; |
104 | len = HFS_NAMELEN; | 105 | len = HFS_NAMELEN; |
105 | } else if (len != s2->len) | 106 | } else if (len != name->len) |
106 | return 1; | 107 | return 1; |
107 | 108 | ||
108 | n1 = s1->name; | 109 | n1 = str; |
109 | n2 = s2->name; | 110 | n2 = name->name; |
110 | while (len--) { | 111 | while (len--) { |
111 | if (caseorder[*n1++] != caseorder[*n2++]) | 112 | if (caseorder[*n1++] != caseorder[*n2++]) |
112 | return 1; | 113 | return 1; |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 4824c27cebb8..0bef62aa4f42 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -167,11 +167,18 @@ static struct inode *hfs_alloc_inode(struct super_block *sb) | |||
167 | return i ? &i->vfs_inode : NULL; | 167 | return i ? &i->vfs_inode : NULL; |
168 | } | 168 | } |
169 | 169 | ||
170 | static void hfs_destroy_inode(struct inode *inode) | 170 | static void hfs_i_callback(struct rcu_head *head) |
171 | { | 171 | { |
172 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
173 | INIT_LIST_HEAD(&inode->i_dentry); | ||
172 | kmem_cache_free(hfs_inode_cachep, HFS_I(inode)); | 174 | kmem_cache_free(hfs_inode_cachep, HFS_I(inode)); |
173 | } | 175 | } |
174 | 176 | ||
177 | static void hfs_destroy_inode(struct inode *inode) | ||
178 | { | ||
179 | call_rcu(&inode->i_rcu, hfs_i_callback); | ||
180 | } | ||
181 | |||
175 | static const struct super_operations hfs_super_operations = { | 182 | static const struct super_operations hfs_super_operations = { |
176 | .alloc_inode = hfs_alloc_inode, | 183 | .alloc_inode = hfs_alloc_inode, |
177 | .destroy_inode = hfs_destroy_inode, | 184 | .destroy_inode = hfs_destroy_inode, |
@@ -427,7 +434,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
427 | if (!sb->s_root) | 434 | if (!sb->s_root) |
428 | goto bail_iput; | 435 | goto bail_iput; |
429 | 436 | ||
430 | sb->s_root->d_op = &hfs_dentry_operations; | 437 | d_set_d_op(sb->s_root, &hfs_dentry_operations); |
431 | 438 | ||
432 | /* everything's okay */ | 439 | /* everything's okay */ |
433 | return 0; | 440 | return 0; |
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c index 7478f5c219aa..19cf291eb91f 100644 --- a/fs/hfs/sysdep.c +++ b/fs/hfs/sysdep.c | |||
@@ -8,15 +8,20 @@ | |||
8 | * This file contains the code to do various system dependent things. | 8 | * This file contains the code to do various system dependent things. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/namei.h> | ||
11 | #include "hfs_fs.h" | 12 | #include "hfs_fs.h" |
12 | 13 | ||
13 | /* dentry case-handling: just lowercase everything */ | 14 | /* dentry case-handling: just lowercase everything */ |
14 | 15 | ||
15 | static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd) | 16 | static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd) |
16 | { | 17 | { |
17 | struct inode *inode = dentry->d_inode; | 18 | struct inode *inode; |
18 | int diff; | 19 | int diff; |
19 | 20 | ||
21 | if (nd->flags & LOOKUP_RCU) | ||
22 | return -ECHILD; | ||
23 | |||
24 | inode = dentry->d_inode; | ||
20 | if(!inode) | 25 | if(!inode) |
21 | return 1; | 26 | return 1; |
22 | 27 | ||