[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9ce5cadb-5e00-a9cf-c22d-92f077141efa@arista.com>
Date: Sun, 23 Feb 2020 12:10:26 +0000
From: Dmitry Safonov <dima@...sta.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Iurii Zaikin <yzaikin@...gle.com>,
Jiri Slaby <jslaby@...e.com>, Joe Perches <joe@...ches.com>,
Randy Dunlap <rdunlap@...radead.org>,
Vasiliy Khoruzhick <vasilykh@...sta.com>,
linux-serial@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCHv2-next 1/3] sysctl/sysrq: Remove __sysrq_enabled copy
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
Powered by blists - more mailing lists