[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eef8e82a-c254-9391-506b-c9de8e52ee0f@arista.com>
Date: Sun, 23 Feb 2020 12:08:23 +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 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.
Thanks,
Dmitry
Powered by blists - more mailing lists