diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-12-31 01:46:00 +0100 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2024-01-23 16:58:56 +0100 |
commit | 42c3732fa8073717dd7d924472f1c0bc5b452fdc (patch) | |
tree | d62658e93e5fe91a8e0e75b7c1ab90d384c90e54 /fs/crypto/fname.c | |
parent | exportfs: fix the fallback implementation of the get_name export operation (diff) | |
download | linux-42c3732fa8073717dd7d924472f1c0bc5b452fdc.tar.xz linux-42c3732fa8073717dd7d924472f1c0bc5b452fdc.zip |
fs: Create a generic is_dot_dotdot() utility
De-duplicate the same functionality in several places by hoisting
the is_dot_dotdot() utility function into linux/fs.h.
Suggested-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/crypto/fname.c')
-rw-r--r-- | fs/crypto/fname.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index 7b3fc189593a..0ad52fbe51c9 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -74,13 +74,7 @@ struct fscrypt_nokey_name { static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) { - if (str->len == 1 && str->name[0] == '.') - return true; - - if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') - return true; - - return false; + return is_dot_dotdot(str->name, str->len); } /** |