[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210119104339.GA2674@kadam>
Date: Tue, 19 Jan 2021 13:43:39 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Kari Argillander <kari.argillander@...il.com>,
Julia Lawall <Julia.Lawall@...ia.fr>
Cc: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>,
linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, pali@...nel.org, dsterba@...e.cz,
aaptel@...e.com, willy@...radead.org, rdunlap@...radead.org,
joe@...ches.com, mark@...mstone.com, nborisov@...e.com,
linux-ntfs-dev@...ts.sourceforge.net, anton@...era.com, hch@....de,
ebiggers@...nel.org, andy.lavr@...il.com
Subject: Re: [PATCH v17 01/10] fs/ntfs3: Add headers and misc files
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
Powered by blists - more mailing lists