aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fscrypt_notsupp.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-04-24 10:00:10 -0700
committerTheodore Ts'o <tytso@mit.edu>2017-05-04 11:44:37 -0400
commit17159420a6c18bb3515ff85598b5ccf1a572763d (patch)
tree562afc39b20e061cbdfaaf6e2db7854da95fbb45 /include/linux/fscrypt_notsupp.h
parentfscrypt: avoid collisions when presenting long encrypted filenames (diff)
downloadlinux-dev-17159420a6c18bb3515ff85598b5ccf1a572763d.tar.xz
linux-dev-17159420a6c18bb3515ff85598b5ccf1a572763d.zip
fscrypt: introduce helper function for filename matching
Introduce a helper function fscrypt_match_name() which tests whether a fscrypt_name matches a directory entry. Also clean up the magic numbers and document things properly. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/linux/fscrypt_notsupp.h')
-rw-r--r--include/linux/fscrypt_notsupp.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h
index 3511ca798804..ec406aed2f2f 100644
--- a/include/linux/fscrypt_notsupp.h
+++ b/include/linux/fscrypt_notsupp.h
@@ -147,6 +147,15 @@ static inline int fscrypt_fname_usr_to_disk(struct inode *inode,
return -EOPNOTSUPP;
}
+static inline bool fscrypt_match_name(const struct fscrypt_name *fname,
+ const u8 *de_name, u32 de_name_len)
+{
+ /* Encryption support disabled; use standard comparison */
+ if (de_name_len != fname->disk_name.len)
+ return false;
+ return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
+}
+
/* bio.c */
static inline void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *ctx,
struct bio *bio)