Skip to content

Commit 4d4f146

Browse files
andy-shevkdave
authored andcommitted
affs: rename local toupper() to fn() to avoid confusion
A compiler may see the collision with the toupper() defined in ctype.h: fs/affs/namei.c:159:19: warning: unused variable 'toupper' [-Wunused-variable] 159 | toupper_t toupper = affs_get_toupper(sb); To prevent this from happening, rename toupper local variable to fn. Initially this had been introduced by 24579a8 ("v2.4.3.5 -> v2.4.3.6") in the history.git by history group. Reported-by: kernel test robot <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a3bf4c3 commit 4d4f146

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

fs/affs/namei.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ affs_get_toupper(struct super_block *sb)
4343
* Note: the dentry argument is the parent dentry.
4444
*/
4545
static inline int
46-
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t toupper, bool notruncate)
46+
__affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t fn, bool notruncate)
4747
{
4848
const u8 *name = qstr->name;
4949
unsigned long hash;
@@ -57,7 +57,7 @@ __affs_hash_dentry(const struct dentry *dentry, struct qstr *qstr, toupper_t tou
5757
hash = init_name_hash(dentry);
5858
len = min(qstr->len, AFFSNAMEMAX);
5959
for (; len > 0; name++, len--)
60-
hash = partial_name_hash(toupper(*name), hash);
60+
hash = partial_name_hash(fn(*name), hash);
6161
qstr->hash = end_name_hash(hash);
6262

6363
return 0;
@@ -80,7 +80,7 @@ affs_intl_hash_dentry(const struct dentry *dentry, struct qstr *qstr)
8080
}
8181

8282
static inline int __affs_compare_dentry(unsigned int len,
83-
const char *str, const struct qstr *name, toupper_t toupper,
83+
const char *str, const struct qstr *name, toupper_t fn,
8484
bool notruncate)
8585
{
8686
const u8 *aname = str;
@@ -106,7 +106,7 @@ static inline int __affs_compare_dentry(unsigned int len,
106106
return 1;
107107

108108
for (; len > 0; len--)
109-
if (toupper(*aname++) != toupper(*bname++))
109+
if (fn(*aname++) != fn(*bname++))
110110
return 1;
111111

112112
return 0;
@@ -135,7 +135,7 @@ affs_intl_compare_dentry(const struct dentry *dentry,
135135
*/
136136

137137
static inline int
138-
affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
138+
affs_match(struct dentry *dentry, const u8 *name2, toupper_t fn)
139139
{
140140
const u8 *name = dentry->d_name.name;
141141
int len = dentry->d_name.len;
@@ -148,20 +148,20 @@ affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
148148
return 0;
149149

150150
for (name2++; len > 0; len--)
151-
if (toupper(*name++) != toupper(*name2++))
151+
if (fn(*name++) != fn(*name2++))
152152
return 0;
153153
return 1;
154154
}
155155

156156
int
157157
affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
158158
{
159-
toupper_t toupper = affs_get_toupper(sb);
159+
toupper_t fn = affs_get_toupper(sb);
160160
u32 hash;
161161

162162
hash = len = min(len, AFFSNAMEMAX);
163163
for (; len > 0; len--)
164-
hash = (hash * 13 + toupper(*name++)) & 0x7ff;
164+
hash = (hash * 13 + fn(*name++)) & 0x7ff;
165165

166166
return hash % AFFS_SB(sb)->s_hashsize;
167167
}
@@ -171,7 +171,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
171171
{
172172
struct super_block *sb = dir->i_sb;
173173
struct buffer_head *bh;
174-
toupper_t toupper = affs_get_toupper(sb);
174+
toupper_t fn = affs_get_toupper(sb);
175175
u32 key;
176176

177177
pr_debug("%s(\"%pd\")\n", __func__, dentry);
@@ -189,7 +189,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
189189
bh = affs_bread(sb, key);
190190
if (!bh)
191191
return ERR_PTR(-EIO);
192-
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, toupper))
192+
if (affs_match(dentry, AFFS_TAIL(sb, bh)->name, fn))
193193
return bh;
194194
key = be32_to_cpu(AFFS_TAIL(sb, bh)->hash_chain);
195195
}

0 commit comments

Comments
 (0)