Skip to content

Commit 458532c

Browse files
andrealmeidbrauner
authored andcommitted
libfs: Export generic_ci_ dentry functions
Export generic_ci_ dentry functions so they can be used by case-insensitive filesystems that need something more custom than the default one set by `struct generic_ci_dentry_ops`. Reviewed-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: André Almeida <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 142fa60 commit 458532c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

fs/libfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,8 +1791,8 @@ bool is_empty_dir_inode(struct inode *inode)
17911791
*
17921792
* Return: 0 if names match, 1 if mismatch, or -ERRNO
17931793
*/
1794-
static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
1795-
const char *str, const struct qstr *name)
1794+
int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
1795+
const char *str, const struct qstr *name)
17961796
{
17971797
const struct dentry *parent;
17981798
const struct inode *dir;
@@ -1835,6 +1835,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
18351835

18361836
return utf8_strncasecmp(dentry->d_sb->s_encoding, name, &qstr);
18371837
}
1838+
EXPORT_SYMBOL(generic_ci_d_compare);
18381839

18391840
/**
18401841
* generic_ci_d_hash - generic d_hash implementation for casefolding filesystems
@@ -1843,7 +1844,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
18431844
*
18441845
* Return: 0 if hash was successful or unchanged, and -EINVAL on error
18451846
*/
1846-
static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
1847+
int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
18471848
{
18481849
const struct inode *dir = READ_ONCE(dentry->d_inode);
18491850
struct super_block *sb = dentry->d_sb;
@@ -1858,6 +1859,7 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
18581859
return -EINVAL;
18591860
return 0;
18601861
}
1862+
EXPORT_SYMBOL(generic_ci_d_hash);
18611863

18621864
static const struct dentry_operations generic_ci_dentry_ops = {
18631865
.d_hash = generic_ci_d_hash,

include/linux/fs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,6 +3458,10 @@ extern int generic_ci_match(const struct inode *parent,
34583458
const u8 *de_name, u32 de_name_len);
34593459

34603460
#if IS_ENABLED(CONFIG_UNICODE)
3461+
int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str);
3462+
int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
3463+
const char *str, const struct qstr *name);
3464+
34613465
/**
34623466
* generic_ci_validate_strict_name - Check if a given name is suitable
34633467
* for a directory

0 commit comments

Comments
 (0)