On Wed, May 11, 2022 at 03:31:43PM -0400, Gabriel Krisman Bertazi wrote: > Matching case-insensitive names is a generic operation and can be shared > with f2fs. Move it next to the rest of the shared casefold fs code. > > Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx> > --- > fs/ext4/namei.c | 62 +--------------------------------------------- > fs/libfs.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ > include/linux/fs.h | 3 +++ > 3 files changed, 65 insertions(+), 61 deletions(-) It might be a good idea to split this into two patches, one for the libfs part and one for the ext4 part. That would make sorting out the dependencies of this series easier in case it doesn't all go in in one cycle. > +/** > + * generic_ci_match() - Match (case-insensitive) a name with a dirent. > + * @parent: Inode of the parent of the dentry. > + * @uname: name under lookup. > + * @de_name: Dirent name. > + * @de_name_len: dirent name length. > + * > + * Test whether a case-insensitive directory entry matches the filename > + * being searched. > + * > + * Return: > 0 if the directory entry matches, 0 if it doesn't match, or > + * < 0 on error. > + */ > +int generic_ci_match(const struct inode *parent, > + const struct unicode_name *uname, > + u8 *de_name, size_t de_name_len) de_name should be const, like it is in the f2fs version. It does get cast away temporarily when it is stored in a fscrypt_str, but it never gets modified (and must not be) so const is appropriate. - Eric