summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-01-05 19:44:59 +0100
committerTheodore Ts'o <tytso@mit.edu>2018-01-12 04:06:19 +0100
commitdcf0db9e5df369461c9d55282abbf66d263ef2db (patch)
tree978917917ce988575ed66ce0bf45bd4008d8d13b /fs
parentfscrypt: move fscrypt_valid_enc_modes() to fscrypt_private.h (diff)
downloadlinux-dcf0db9e5df369461c9d55282abbf66d263ef2db.tar.xz
linux-dcf0db9e5df369461c9d55282abbf66d263ef2db.zip
fscrypt: move fscrypt_is_dot_dotdot() to fs/crypto/fname.c
Only fs/crypto/fname.c cares about treating the "." and ".." filenames specially with regards to encryption, so move fscrypt_is_dot_dotdot() from fscrypt.h to there. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/crypto/fname.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index 305541bcd108..b8c5061553b1 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -15,6 +15,17 @@
#include <linux/ratelimit.h>
#include "fscrypt_private.h"
+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;
+}
+
/**
* fname_encrypt() - encrypt a filename
*