[lkml]   [2020]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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.


> 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.


 \ /
  Last update: 2020-02-23 13:09    [W:0.065 / U:11.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site