ext4: switch to using fscrypt_match_name()
Switch ext4 directory searches to use the fscrypt_match_name() helper function. There should be no functional change. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
17159420a6
commit
067d1023b6
@ -1245,29 +1245,17 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
|
|||||||
static inline int ext4_match(struct ext4_filename *fname,
|
static inline int ext4_match(struct ext4_filename *fname,
|
||||||
struct ext4_dir_entry_2 *de)
|
struct ext4_dir_entry_2 *de)
|
||||||
{
|
{
|
||||||
const void *name = fname_name(fname);
|
struct fscrypt_name f;
|
||||||
u32 len = fname_len(fname);
|
|
||||||
|
|
||||||
if (!de->inode)
|
if (!de->inode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
f.usr_fname = fname->usr_fname;
|
||||||
|
f.disk_name = fname->disk_name;
|
||||||
#ifdef CONFIG_EXT4_FS_ENCRYPTION
|
#ifdef CONFIG_EXT4_FS_ENCRYPTION
|
||||||
if (unlikely(!name)) {
|
f.crypto_buf = fname->crypto_buf;
|
||||||
if (fname->usr_fname->name[0] == '_') {
|
|
||||||
int ret;
|
|
||||||
if (de->name_len <= 32)
|
|
||||||
return 0;
|
|
||||||
ret = memcmp(de->name + ((de->name_len - 17) & ~15),
|
|
||||||
fname->crypto_buf.name + 8, 16);
|
|
||||||
return (ret == 0) ? 1 : 0;
|
|
||||||
}
|
|
||||||
name = fname->crypto_buf.name;
|
|
||||||
len = fname->crypto_buf.len;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (de->name_len != len)
|
return fscrypt_match_name(&f, de->name, de->name_len);
|
||||||
return 0;
|
|
||||||
return (memcmp(de->name, name, len) == 0) ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user