@@ -1855,6 +1855,21 @@ static const struct dentry_operations generic_ci_dentry_ops = {
#endif
};
+/*
+ * Same as generic_ci_dentry_ops, but also set d_delete. Useful for in-memory
+ * casefold filesystems.
+ */
+const struct dentry_operations generic_ci_always_del_dentry_ops = {
+ .d_hash = generic_ci_d_hash,
+ .d_compare = generic_ci_d_compare,
+#ifdef CONFIG_FS_ENCRYPTION
+ .d_revalidate = fscrypt_d_revalidate,
+#endif
+ .d_delete = always_delete_dentry,
+};
+EXPORT_SYMBOL(generic_ci_always_del_dentry_ops);
+
+
/**
* generic_ci_match() - Match a name (case-insensitively) with a dirent.
* This is a filesystem helper for comparison with directory entries.
@@ -3337,6 +3337,7 @@ extern int always_delete_dentry(const struct dentry *);
extern struct inode *alloc_anon_inode(struct super_block *);
extern int simple_nosetlease(struct file *, int, struct file_lease **, void **);
extern const struct dentry_operations simple_dentry_operations;
+extern const struct dentry_operations generic_ci_always_del_dentry_ops;
extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
Create a helper to assign dentry_operations with the generic case insensitive functions plus setting .d_delete as always_delete_dentry. This is useful to in-memory casefold filesystems like tmpfs. Signed-off-by: André Almeida <andrealmeid@igalia.com> --- v3: New patch --- fs/libfs.c | 15 +++++++++++++++ include/linux/fs.h | 1 + 2 files changed, 16 insertions(+)