lkml.org 
[lkml]   [2021]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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)
)

\
 
 \ /
  Last update: 2021-01-19 21:39    [W:0.071 / U:1.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site