On Tue, Jun 4, 2024 at 9:46 AM Jani Nikula jani.nikula@linux.intel.com wrote:
[Maybe slightly off-topic, ranty]
Why do we think it's a good idea to increase and normalize the use of double-underscore function names across the kernel, like __match_string() in this case? It should mean "reserved for the implementation, not to be called directly".
If it's to be used directly, it should be named accordingly, right?
It's a huge mess. "__" prefix is just so ambiguous I think it just shouldn't be used or prolifierated, and it usually breaks Rusty Russells API rules times over.
Consider __set_bit() from <linux/bitops.h>, used all over the place, in contrast with set_bit() for example, what does "__" represent in this context that makes __set_bit() different from set_bit()?
It means "non-atomic"...
How does a random contributor know this?
Yeah, you guess it. By the token of "everybody knows that". (Grep, google, repeat for the number of contributors to the kernel.)
I was considering to send a script to Torvalds to just change all this to set_bit_nonatomic() (etc) but was hesitating because that makes the name unambiguous but long. I think I stayed off it because changing stuff like that all over the place creates churn and churn is bad.
Yours, Linus Walleij