[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210119203442.ricoppwmw662bjkd@kari-VirtualBox>
Date: Tue, 19 Jan 2021 22:34:42 +0200
From: Kari Argillander <kari.argillander@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.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 Tue, Jan 19, 2021 at 01:43:39PM +0300, Dan Carpenter wrote:
> 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;
> >
> > 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?
Yeah I have to also confess that I just copy paste that. Didn't use
brain yet. Atleast to me it wasn't crystal clear right away what that
does. So Coccinelle script would definetly be good idea.
Someone has atleast made it https://github.com/bhumikagoyal/coccinelle_scripts
I wonder if we need to add cases also in "backwards". Haven't test these.
If patch is prefered from me then I can send it but someone else can
also send it.
@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
|
- x < y ? y : x
+ max(x,y)
|
- x > y ? y : x
+ min(x,y)
)
Powered by blists - more mailing lists