lkml.org 
[lkml]   [2020]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy
From
Date
Hi Greg,

On 1/10/20 4:40 PM, Greg Kroah-Hartman wrote:
> On Thu, Jan 09, 2020 at 09:54:43PM +0000, Dmitry Safonov wrote:
[..]
>> @@ -2844,6 +2827,26 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
>> }
>> #endif
>>
>> +#ifdef CONFIG_MAGIC_SYSRQ
>> +static int sysrq_sysctl_handler(struct ctl_table *table, int write,
>> + void __user *buffer, size_t *lenp, loff_t *ppos)
>> +{
>> + int tmp, ret;
>> +
>> + tmp = sysrq_get_mask();
>> +
>> + ret = __do_proc_dointvec(&tmp, table, write, buffer,
>> + lenp, ppos, NULL, NULL);
>> + if (ret || !write)
>> + return ret;
>> +
>> + if (write)
>> + sysrq_toggle_support(tmp);
>> +
>> + return 0;
>> +}
>> +#endif
>
> Why did you move this function down here? Can't it stay where it is and
> you can just fix the logic there? Now you have two different #ifdef
> blocks intead of just one :(

Yeah, well __do_proc_dointvec() made me do it.

sysrq_sysctl_handler() declaration should be before ctl_table array of
sysctls, so I couldn't remove the forward-declaration.

So, I could forward-declare __do_proc_dointvec() instead, but looking at
the neighborhood, I decided to follow the file-style (there is a couple
of forward-declarations before the sysctl array, some under ifdefs).

I admit that the result is imperfect and can put __do_proc_dointvec()
definition before instead, no hard feelings.

Thanks,
Dmitry

\
 
 \ /
  Last update: 2020-01-10 22:47    [W:0.067 / U:10.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site