diff mbox series

[RFC,1/4] Revert "libfs: unexport generic_ci_d_compare() and generic_ci_d_hash()"

Message ID 20210323195941.69720-2-andrealmeid@collabora.com (mailing list archive)
State New, archived
Headers show
Series mm: shmem: Add case-insensitive support for tmpfs | expand

Commit Message

André Almeida March 23, 2021, 7:59 p.m. UTC
This reverts commit 794c43f716845e2d48ce195ed5c4179a4e05ce5f.

For implementing casefolding support at tmpfs, it needs to set dentry
operations at superblock level, given that tmpfs has no support for
fscrypt and we don't need to set operations on a per-dentry basis.
Revert this commit so we can access those exported function from tmpfs
code.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
 fs/libfs.c         | 8 +++++---
 include/linux/fs.h | 5 +++++
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

Matthew Wilcox March 23, 2021, 8:15 p.m. UTC | #1
On Tue, Mar 23, 2021 at 04:59:38PM -0300, André Almeida wrote:
> This reverts commit 794c43f716845e2d48ce195ed5c4179a4e05ce5f.
> 
> For implementing casefolding support at tmpfs, it needs to set dentry
> operations at superblock level, given that tmpfs has no support for
> fscrypt and we don't need to set operations on a per-dentry basis.
> Revert this commit so we can access those exported function from tmpfs
> code.

But tmpfs / shmem are Kconfig bools, not tristate.  They can't be built
as modules, so there's no need to export the symbols.

> +#ifdef CONFIG_UNICODE
> +extern int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str);
> +extern int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
> +				const char *str, const struct qstr *name);
> +#endif

There's no need for the ifdef (it only causes unnecessary rebuilds) and
the 'extern' keyword is also unwelcome.
André Almeida March 24, 2021, 8:09 p.m. UTC | #2
Hi Matthew,

Às 17:15 de 23/03/21, Matthew Wilcox escreveu:
> On Tue, Mar 23, 2021 at 04:59:38PM -0300, André Almeida wrote:
>> This reverts commit 794c43f716845e2d48ce195ed5c4179a4e05ce5f.
>>
>> For implementing casefolding support at tmpfs, it needs to set dentry
>> operations at superblock level, given that tmpfs has no support for
>> fscrypt and we don't need to set operations on a per-dentry basis.
>> Revert this commit so we can access those exported function from tmpfs
>> code.
> 
> But tmpfs / shmem are Kconfig bools, not tristate.  They can't be built
> as modules, so there's no need to export the symbols.
> 
>> +#ifdef CONFIG_UNICODE
>> +extern int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str);
>> +extern int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
>> +				const char *str, const struct qstr *name);
>> +#endif
> 
> There's no need for the ifdef (it only causes unnecessary rebuilds) and
> the 'extern' keyword is also unwelcome.
> 

Thank you. Instead of reverting the commit, I'll do a new commit doing 
this in a properly way.
diff mbox series

Patch

diff --git a/fs/libfs.c b/fs/libfs.c
index e2de5401abca..d1d06494463a 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1387,8 +1387,8 @@  static bool needs_casefold(const struct inode *dir)
  *
  * Return: 0 if names match, 1 if mismatch, or -ERRNO
  */
-static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
-				const char *str, const struct qstr *name)
+int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
+			  const char *str, const struct qstr *name)
 {
 	const struct dentry *parent = READ_ONCE(dentry->d_parent);
 	const struct inode *dir = READ_ONCE(parent->d_inode);
@@ -1425,6 +1425,7 @@  static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
 		return 1;
 	return !!memcmp(str, name->name, len);
 }
+EXPORT_SYMBOL(generic_ci_d_compare);
 
 /**
  * generic_ci_d_hash - generic d_hash implementation for casefolding filesystems
@@ -1433,7 +1434,7 @@  static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
  *
  * Return: 0 if hash was successful or unchanged, and -EINVAL on error
  */
-static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
+int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
 {
 	const struct inode *dir = READ_ONCE(dentry->d_inode);
 	struct super_block *sb = dentry->d_sb;
@@ -1448,6 +1449,7 @@  static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
 		return -EINVAL;
 	return 0;
 }
+EXPORT_SYMBOL(generic_ci_d_hash);
 
 static const struct dentry_operations generic_ci_dentry_ops = {
 	.d_hash = generic_ci_d_hash,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ec8f3ddf4a6a..29a0c6371f7d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3313,6 +3313,11 @@  extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
 
 extern int generic_check_addressable(unsigned, u64);
 
+#ifdef CONFIG_UNICODE
+extern int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str);
+extern int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
+				const char *str, const struct qstr *name);
+#endif
 extern void generic_set_encrypted_ci_d_ops(struct dentry *dentry);
 
 #ifdef CONFIG_MIGRATION