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

Sebastian Gottschall
2021-03-25T05:26:04Z

Am 23.03.2021 um 08:19 schrieb Dan Carpenter:
> 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
ahm just a pointless comment. but
return !memcmp(oid1,oid2, sizeof(long*)*oid1len);
looks much more efficient than this "for" loop
>
>
>