Re: [PATCH 2/5] cifsd: add server-side procedures for SMB3

From: Dan Carpenter
Date: Tue Mar 23 2021 - 03:21:34 EST


On Tue, Mar 23, 2021 at 08:17:47AM +0900, Namjae Jeon wrote:
> > > +
> > > +static int
> > > +compare_oid(unsigned long *oid1, unsigned int oid1len,
> > > + unsigned long *oid2, unsigned int oid2len) {
> > > + unsigned int i;
> > > +
> > > + if (oid1len != oid2len)
> > > + return 0;
> > > +
> > > + for (i = 0; i < oid1len; i++) {
> > > + if (oid1[i] != oid2[i])
> > > + return 0;
> > > + }
> > > + return 1;
> > > +}
> >
> > Call this oid_eq()?
> Why not compare_oid()? This code is come from cifs.
> I need clear reason to change both cifs/cifsd...
>

Boolean functions should tell you what they are testing in the name.
Without any context you can't know what if (compare_oid(one, two)) {
means, but if (oid_equal(one, two)) { is readable.

regards,
dan carpenter