[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <289b2d65-bf28-1246-7f4f-2411e3f27e16@huawei.com>
Date: Fri, 29 May 2020 20:09:01 +0800
From: Xiaoming Ni <nixiaoming@...wei.com>
To: Greg KH <gregkh@...uxfoundation.org>,
Luis Chamberlain <mcgrof@...nel.org>
CC: <keescook@...omium.org>, <yzaikin@...gle.com>,
<ebiederm@...ssion.com>, <axboe@...nel.dk>, <clemens@...isch.de>,
<arnd@...db.de>, <jani.nikula@...ux.intel.com>,
<joonas.lahtinen@...ux.intel.com>, <rodrigo.vivi@...el.com>,
<airlied@...ux.ie>, <daniel@...ll.ch>, <benh@...nel.crashing.org>,
<rdna@...com>, <viro@...iv.linux.org.uk>, <mark@...heh.com>,
<jlbec@...lplan.org>, <joseph.qi@...ux.alibaba.com>,
<vbabka@...e.cz>, <sfr@...b.auug.org.au>, <jack@...e.cz>,
<amir73il@...il.com>, <rafael@...nel.org>, <tytso@....edu>,
<julia.lawall@...6.fr>, <akpm@...ux-foundation.org>,
<intel-gfx@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>, <linuxppc-dev@...ts.ozlabs.org>,
<ocfs2-devel@....oracle.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/13] random: simplify sysctl declaration with
register_sysctl_subdir()
On 2020/5/29 18:26, Greg KH wrote:
> On Fri, May 29, 2020 at 07:41:06AM +0000, Luis Chamberlain wrote:
>> From: Xiaoming Ni <nixiaoming@...wei.com>
>>
>> Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c
>> and use register_sysctl_subdir() to help remove the clutter out of
>> kernel/sysctl.c.
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
>> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
>> ---
>> drivers/char/random.c | 14 ++++++++++++--
>> include/linux/sysctl.h | 1 -
>> kernel/sysctl.c | 5 -----
>> 3 files changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/char/random.c b/drivers/char/random.c
>> index a7cf6aa65908..73fd4b6e9c18 100644
>> --- a/drivers/char/random.c
>> +++ b/drivers/char/random.c
>> @@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
>> }
>>
>> static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
>> -extern struct ctl_table random_table[];
>> -struct ctl_table random_table[] = {
>> +static struct ctl_table random_table[] = {
>> {
>> .procname = "poolsize",
>> .data = &sysctl_poolsize,
>> @@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = {
>> #endif
>> { }
>> };
>> +
>> +/*
>> + * rand_initialize() is called before sysctl_init(),
>> + * so we cannot call register_sysctl_init() in rand_initialize()
>> + */
>> +static int __init random_sysctls_init(void)
>> +{
>> + register_sysctl_subdir("kernel", "random", random_table);
>
> No error checking?
>
> :(
It was my mistake, I forgot to add a comment here.
Same as the comment of register_sysctl_init(),
There is almost no failure here during the system initialization phase,
and failure in time does not affect the main function.
Thanks
Xiaoming Ni
Powered by blists - more mailing lists