summaryrefslogtreecommitdiff
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-01-23 19:25:51 +0300
committerChristian Brauner <brauner@kernel.org>2024-01-23 19:56:30 +0300
commit0000ff2523df42bcf3c2fe3e8daaeca038835487 (patch)
tree1be5d8f49a61fe06ce678aba9fa55cf513caf7c0 /include/linux/fs.h
parentbd46543d7f9a8b2c03420499b1885287e96aaf28 (diff)
parent42c3732fa8073717dd7d924472f1c0bc5b452fdc (diff)
downloadlinux-0000ff2523df42bcf3c2fe3e8daaeca038835487.tar.xz
Merge tag 'exportfs-6.9' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/cel/linux
Merge exportfs fixes from Chuck Lever: * tag 'exportfs-6.9' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/cel/linux: fs: Create a generic is_dot_dotdot() utility exportfs: fix the fallback implementation of the get_name export operation Link: https://lore.kernel.org/r/BDC2AEB4-7085-4A7C-8DE8-A659FE1DBA6A@oracle.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f7cfda29143..4f6669147b9e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2928,6 +2928,17 @@ extern bool path_is_under(const struct path *, const struct path *);
extern char *file_path(struct file *, char *, int);
+/**
+ * is_dot_dotdot - returns true only if @name is "." or ".."
+ * @name: file name to check
+ * @len: length of file name, in bytes
+ */
+static inline bool is_dot_dotdot(const char *name, size_t len)
+{
+ return len && unlikely(name[0] == '.') &&
+ (len == 1 || (len == 2 && name[1] == '.'));
+}
+
#include <linux/err.h>
/* needed for stackable file system support */