[PATCH v3 5/9] libfs: Create the helper struct generic_ci_always_del_dentry_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
v3: New patch
---
 fs/libfs.c         | 15 +++++++++++++++
 include/linux/fs.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/fs/libfs.c b/fs/libfs.c
index 99fb36b48708..58b39640b686 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -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.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 937142950dfe..254a1dcf987b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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 *);
-- 
2.46.0





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux