diff options
| author | Eric Biggers <ebiggers@google.com> | 2017-04-24 10:00:12 -0700 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-05-21 18:45:24 +0200 |
| commit | 9463ff35f8e31e6c88866dfc236c95a66747190c (patch) | |
| tree | c8ffbaf4836bc9d307d76c2b4a9757a2cc9d5340 /fs/f2fs/dir.c | |
| parent | 32c44b9d026211e8160ca083049b38d437e8b3e1 (diff) | |
f2fs: switch to using fscrypt_match_name()
Switch f2fs directory searches to use the fscrypt_match_name() helper
function. There should be no functional change.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/f2fs/dir.c')
| -rw-r--r-- | fs/f2fs/dir.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 4ca57e3a3..7c7699597 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -112,8 +112,6 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname, struct f2fs_dir_entry *de; unsigned long bit_pos = 0; int max_len = 0; - struct fscrypt_str de_name = FSTR_INIT(NULL, 0); - struct fscrypt_str *name = &fname->disk_name; if (max_slots) *max_slots = 0; @@ -131,29 +129,11 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname, continue; } - if (de->hash_code != namehash) - goto not_match; - - de_name.name = d->filename[bit_pos]; - de_name.len = le16_to_cpu(de->name_len); - -#ifdef CONFIG_F2FS_FS_ENCRYPTION - if (unlikely(!name->name)) { - if (fname->usr_fname->name[0] == '_') { - if (de_name.len > 32 && - !memcmp(de_name.name + ((de_name.len - 17) & ~15), - fname->crypto_buf.name + 8, 16)) - goto found; - goto not_match; - } - name->name = fname->crypto_buf.name; - name->len = fname->crypto_buf.len; - } -#endif - if (de_name.len == name->len && - !memcmp(de_name.name, name->name, name->len)) + if (de->hash_code == namehash && + fscrypt_match_name(fname, d->filename[bit_pos], + le16_to_cpu(de->name_len))) goto found; -not_match: + if (max_slots && max_len > *max_slots) *max_slots = max_len; max_len = 0; |
