Re: [PATCHv2-next 1/3] sysctl/sysrq: Remove __sysrq_enabled copy
From: Dmitry Safonov
Date: Sun Feb 23 2020 - 07:10:36 EST
On 2/23/20 12:08 PM, Dmitry Safonov wrote:
>
> On 1/15/20 12:36 PM, Greg Kroah-Hartman wrote:
>> On Tue, Jan 14, 2020 at 05:19:10PM +0000, Dmitry Safonov wrote:
> [..]
>>> +int sysrq_get_mask(void)
>>> +{
>>> + if (sysrq_always_enabled)
>>> + return 1;
>>> + return sysrq_enabled;
>>> +}
>>
>> Naming is hard. And this name is really hard to understand.
>
> Agree.
>
>
>> Traditionally get/put are used for incrementing reference counts. You
>> don't have a sysrq_put_mask() call, right? :)
>
> Yes, fair point
>
>
>> I think what you want this function to do is, "is sysrq enabled right
>> now" (hint, it's a global function, add kernel-doc to it so we know what
>> it does...). If so, it should maybe be something like:
>>
>> bool sysrq_is_enabled(void);
>>
>> which to me makes more sense.
>
> Err, not exactly: there is a function for that which is sysrq_on().
> But for sysctl the value of the mask (or 1 for always_enabled) is
> actually needed to show a proper value back to the userspace reader.
I'll call it sysrq_mask(), add the kernel-doc to it in v3.
Thanks again,
Dmitry