diff options
Diffstat (limited to 'fs/fat/namei_vfat.c')
-rw-r--r-- | fs/fat/namei_vfat.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index b936703b8924..95e00ab84c3f 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -85,15 +85,18 @@ static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /* returns the length of a struct qstr, ignoring trailing dots */ | 87 | /* returns the length of a struct qstr, ignoring trailing dots */ |
88 | static unsigned int vfat_striptail_len(struct qstr *qstr) | 88 | static unsigned int __vfat_striptail_len(unsigned int len, const char *name) |
89 | { | 89 | { |
90 | unsigned int len = qstr->len; | 90 | while (len && name[len - 1] == '.') |
91 | |||
92 | while (len && qstr->name[len - 1] == '.') | ||
93 | len--; | 91 | len--; |
94 | return len; | 92 | return len; |
95 | } | 93 | } |
96 | 94 | ||
95 | static unsigned int vfat_striptail_len(const struct qstr *qstr) | ||
96 | { | ||
97 | return __vfat_striptail_len(qstr->len, qstr->name); | ||
98 | } | ||
99 | |||
97 | /* | 100 | /* |
98 | * Compute the hash for the vfat name corresponding to the dentry. | 101 | * Compute the hash for the vfat name corresponding to the dentry. |
99 | * Note: if the name is invalid, we leave the hash code unchanged so | 102 | * Note: if the name is invalid, we leave the hash code unchanged so |
@@ -133,16 +136,18 @@ static int vfat_hashi(struct dentry *dentry, struct qstr *qstr) | |||
133 | /* | 136 | /* |
134 | * Case insensitive compare of two vfat names. | 137 | * Case insensitive compare of two vfat names. |
135 | */ | 138 | */ |
136 | static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b) | 139 | static int vfat_cmpi(const struct dentry *parent, const struct inode *pinode, |
140 | const struct dentry *dentry, const struct inode *inode, | ||
141 | unsigned int len, const char *str, const struct qstr *name) | ||
137 | { | 142 | { |
138 | struct nls_table *t = MSDOS_SB(dentry->d_inode->i_sb)->nls_io; | 143 | struct nls_table *t = MSDOS_SB(parent->d_sb)->nls_io; |
139 | unsigned int alen, blen; | 144 | unsigned int alen, blen; |
140 | 145 | ||
141 | /* A filename cannot end in '.' or we treat it like it has none */ | 146 | /* A filename cannot end in '.' or we treat it like it has none */ |
142 | alen = vfat_striptail_len(a); | 147 | alen = vfat_striptail_len(name); |
143 | blen = vfat_striptail_len(b); | 148 | blen = __vfat_striptail_len(len, str); |
144 | if (alen == blen) { | 149 | if (alen == blen) { |
145 | if (nls_strnicmp(t, a->name, b->name, alen) == 0) | 150 | if (nls_strnicmp(t, name->name, str, alen) == 0) |
146 | return 0; | 151 | return 0; |
147 | } | 152 | } |
148 | return 1; | 153 | return 1; |
@@ -151,15 +156,17 @@ static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b) | |||
151 | /* | 156 | /* |
152 | * Case sensitive compare of two vfat names. | 157 | * Case sensitive compare of two vfat names. |
153 | */ | 158 | */ |
154 | static int vfat_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b) | 159 | static int vfat_cmp(const struct dentry *parent, const struct inode *pinode, |
160 | const struct dentry *dentry, const struct inode *inode, | ||
161 | unsigned int len, const char *str, const struct qstr *name) | ||
155 | { | 162 | { |
156 | unsigned int alen, blen; | 163 | unsigned int alen, blen; |
157 | 164 | ||
158 | /* A filename cannot end in '.' or we treat it like it has none */ | 165 | /* A filename cannot end in '.' or we treat it like it has none */ |
159 | alen = vfat_striptail_len(a); | 166 | alen = vfat_striptail_len(name); |
160 | blen = vfat_striptail_len(b); | 167 | blen = __vfat_striptail_len(len, str); |
161 | if (alen == blen) { | 168 | if (alen == blen) { |
162 | if (strncmp(a->name, b->name, alen) == 0) | 169 | if (strncmp(name->name, str, alen) == 0) |
163 | return 0; | 170 | return 0; |
164 | } | 171 | } |
165 | return 1; | 172 | return 1; |