mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
Input: sysrq: mv sysrq into drivers/tty/sysrq.c
Move both sysrq ctl_table and supported sysrq_sysctl_handler helper function into drivers/tty/sysrq.c. Replaced the __do_proc_dointvec in helper function with do_proc_dointvec_minmax as the former is local to kernel/sysctl.c. Here we use the minmax version of do_proc_dointvec because do_proc_dointvec is static and calling do_proc_dointvec_minmax with a NULL min and max is the same as calling do_proc_dointvec. This is part of a greater effort to move ctl tables into their respective subsystems which will reduce the merge conflicts in kernel/sysctl.c. Reviewed-by: Kees Cook <kees@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Joel Granados <joel.granados@kernel.org>
This commit is contained in:
parent
8e5f04b0d5
commit
79ac8df974
2 changed files with 41 additions and 30 deletions
|
@ -1120,6 +1120,47 @@ int sysrq_toggle_support(int enable_mask)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(sysrq_toggle_support);
|
||||
|
||||
static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
|
||||
void *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
int tmp, ret;
|
||||
struct ctl_table t = *table;
|
||||
|
||||
tmp = sysrq_mask();
|
||||
t.data = &tmp;
|
||||
|
||||
/*
|
||||
* Behaves like do_proc_dointvec as t does not have min nor max.
|
||||
*/
|
||||
ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
|
||||
|
||||
if (ret || !write)
|
||||
return ret;
|
||||
|
||||
if (write)
|
||||
sysrq_toggle_support(tmp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ctl_table sysrq_sysctl_table[] = {
|
||||
{
|
||||
.procname = "sysrq",
|
||||
.data = NULL,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = sysrq_sysctl_handler,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init init_sysrq_sysctl(void)
|
||||
{
|
||||
register_sysctl_init("kernel", sysrq_sysctl_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
subsys_initcall(init_sysrq_sysctl);
|
||||
|
||||
static int __sysrq_swap_key_ops(u8 key, const struct sysrq_key_op *insert_op_p,
|
||||
const struct sysrq_key_op *remove_op_p)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/sysrq.h>
|
||||
#include <linux/highuid.h>
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
@ -964,26 +963,6 @@ int proc_dou8vec_minmax(const struct ctl_table *table, int write,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
|
||||
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
|
||||
void *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
int tmp, ret;
|
||||
|
||||
tmp = sysrq_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
|
||||
|
||||
static int __do_proc_doulongvec_minmax(void *data,
|
||||
const struct ctl_table *table, int write,
|
||||
void *buffer, size_t *lenp, loff_t *ppos,
|
||||
|
@ -1612,15 +1591,6 @@ static const struct ctl_table kern_table[] = {
|
|||
.proc_handler = proc_dostring,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
{
|
||||
.procname = "sysrq",
|
||||
.data = NULL,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = sysrq_sysctl_handler,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_PROC_SYSCTL
|
||||
{
|
||||
.procname = "cad_pid",
|
||||
|
|
Loading…
Add table
Reference in a new issue