On Mon, Jan 04, 2021 at 01:17:55AM +0200, Kari Argillander wrote: > On Thu, Dec 31, 2020 at 06:23:52PM +0300, Konstantin Komarov wrote: > > > +int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2, > > + const u16 *upcase) > > +{ > > + int diff; > > + size_t len = l1 < l2 ? l1 : l2; > > + > > + if (upcase) { > > + while (len--) { > > + diff = upcase_unicode_char(upcase, le16_to_cpu(*s1++)) - > > + upcase_unicode_char(upcase, le16_to_cpu(*s2++)); > > + if (diff) > > + return diff; > > + } > > + } else { > > + while (len--) { > > + diff = le16_to_cpu(*s1++) - le16_to_cpu(*s2++); > > + if (diff) > > + return diff; > > + } > > + } > > + > > + return (int)(l1 - l2); > > +} > > I notice that these functions might call both ignore case and upcase in a row. > record.c - compare_attr() > index.c - cmp_fnames() > > So maybe we can add bool bothcases. > > int ntfs_cmp_names(const __le16 *s1, size_t l1, const __le16 *s2, size_t l2, > const u16 *upcase, bool bothcase) > { > int diff1 = 0; > int diff2; > size_t len = l1 < l2 ? l1 : l2; size_t len = min(l1, l2); I wonder if this could be a Coccinelle script? regards, dan carpenter