From: Dmitry Safonov <dima@arista.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Dmitry Safonov <0x7f454c46@gmail.com>,
Iurii Zaikin <yzaikin@google.com>, Jiri Slaby <jslaby@suse.com>,
Joe Perches <joe@perches.com>,
Randy Dunlap <rdunlap@infradead.org>,
Vasiliy Khoruzhick <vasilykh@arista.com>,
linux-serial@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>,
Kees Cook <keescook@chromium.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCHv2-next 1/3] sysctl/sysrq: Remove __sysrq_enabled copy
Date: Sun, 23 Feb 2020 12:10:26 +0000 [thread overview]
Message-ID: <9ce5cadb-5e00-a9cf-c22d-92f077141efa@arista.com> (raw)
In-Reply-To: <eef8e82a-c254-9391-506b-c9de8e52ee0f@arista.com>
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
prev parent reply other threads:[~2020-02-23 12:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 17:19 [PATCHv2-next 0/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-01-14 17:19 ` [PATCHv2-next 1/3] sysctl/sysrq: Remove __sysrq_enabled copy Dmitry Safonov
2020-01-15 12:36 ` Greg Kroah-Hartman
2020-02-23 12:08 ` Dmitry Safonov
2020-02-23 12:10 ` Dmitry Safonov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ce5cadb-5e00-a9cf-c22d-92f077141efa@arista.com \
--to=dima@arista.com \
--cc=0x7f454c46@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=rdunlap@infradead.org \
--cc=vasilykh@arista.com \
--cc=yzaikin@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).