Re: [PATCH] lib/string: sysfs_streq works case insensitively

From: Rasmus Villemoes
Date: Wed Apr 28 2021 - 05:13:12 EST


On 28/04/2021 10.31, Gioh Kim wrote:
> On Wed, Apr 28, 2021 at 9:47 AM Rasmus Villemoes
> <linux@xxxxxxxxxxxxxxxxxx> wrote:
>>
>> On 28/04/2021 09.31, Gioh Kim wrote:
>>> On Wed, Apr 28, 2021 at 8:42 AM Andy Shevchenko
>>> <andy.shevchenko@xxxxxxxxx> wrote:
>>>>
>>
>>>>
>>>> Are you sure it’s good change? Sysfs is used for an ABI and you are opening a can of worms. From me NAK to this change without a very good background description that tells why it is safe to do.
>>>
>>> https://www.spinics.net/lists/kernel/msg3898123.html
>>> My initial idea was making a new function: sysfs_streqcase.
>>> Andrew and Greg suggested making sysfs_streq to be case-insensitive.
>>> I would like to have a discussion about it.
>>
>> 1. That information should be in the commit log, not some random
>> babbling about case sensitivity of file systems.
>
> I don't think it is a good idea to write who suggested the concept of the patch.

Sorry if it wasn't clear. I was referring to the information in that
link (i.e., your commit log for the first suggested patch).

>> Sorry, I really think you need a lot stronger motivation for introducing
>> either this change or a sysfs_strcaseeq().
>
> I found out a problem of sysfs_streq when I tried to use it for
> modules I am working on (RTRS/RNBD).

Again, this is the kind of motivation that would need to be in the
commit log. What problem are you solving in those modules that warrants
changing the semantics of sysfs_streq()? Why does that module's sysfs
interface need case-insensitive string comparison?

> Then I thought it would be better if there is something like sysfs_streqcase.
> That's why I sent the path.
> If nobody needs the change, it is ok for me to ignore the patch.

It's a lot easier to assess the merits of this new functionality
(whether in the form of a new separate function, or changed semantics of
sysfs_streq()) if we also see a few use cases. New functions are not
added without users. Bells and whistles are not added without users.

> Maybe I misunderstand when I can send a patch to Linux kernel community.
> But the only motivation of me is sharing my idea just in case there is
> someone who also needs it.

That's fine, but you need to include proper information on why a new
function is added or semantics of an existing one is changed (and for
the latter, some words on why you believe all existing callers would be
ok with that).

Rasmus