提交 56992309 编写于 作者: E Eric W. Biederman

sysctl kernel: Remove binary sysctl logic

Now that sys_sysctl is a generic wrapper around /proc/sys  .ctl_name
and .strategy members of sysctl tables are dead code.  Remove them.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
上级 ab09203e
...@@ -7373,17 +7373,16 @@ static struct ctl_table sd_ctl_dir[] = { ...@@ -7373,17 +7373,16 @@ static struct ctl_table sd_ctl_dir[] = {
.procname = "sched_domain", .procname = "sched_domain",
.mode = 0555, .mode = 0555,
}, },
{0, }, {}
}; };
static struct ctl_table sd_ctl_root[] = { static struct ctl_table sd_ctl_root[] = {
{ {
.ctl_name = CTL_KERN,
.procname = "kernel", .procname = "kernel",
.mode = 0555, .mode = 0555,
.child = sd_ctl_dir, .child = sd_ctl_dir,
}, },
{0, }, {}
}; };
static struct ctl_table *sd_alloc_ctl_entry(int n) static struct ctl_table *sd_alloc_ctl_entry(int n)
......
...@@ -52,7 +52,6 @@ static const int slow_work_max_vslow = 99; ...@@ -52,7 +52,6 @@ static const int slow_work_max_vslow = 99;
ctl_table slow_work_sysctls[] = { ctl_table slow_work_sysctls[] = {
{ {
.ctl_name = CTL_UNNUMBERED,
.procname = "min-threads", .procname = "min-threads",
.data = &slow_work_min_threads, .data = &slow_work_min_threads,
.maxlen = sizeof(unsigned), .maxlen = sizeof(unsigned),
...@@ -62,7 +61,6 @@ ctl_table slow_work_sysctls[] = { ...@@ -62,7 +61,6 @@ ctl_table slow_work_sysctls[] = {
.extra2 = &slow_work_max_threads, .extra2 = &slow_work_max_threads,
}, },
{ {
.ctl_name = CTL_UNNUMBERED,
.procname = "max-threads", .procname = "max-threads",
.data = &slow_work_max_threads, .data = &slow_work_max_threads,
.maxlen = sizeof(unsigned), .maxlen = sizeof(unsigned),
...@@ -72,7 +70,6 @@ ctl_table slow_work_sysctls[] = { ...@@ -72,7 +70,6 @@ ctl_table slow_work_sysctls[] = {
.extra2 = (void *) &slow_work_max_max_threads, .extra2 = (void *) &slow_work_max_max_threads,
}, },
{ {
.ctl_name = CTL_UNNUMBERED,
.procname = "vslow-percentage", .procname = "vslow-percentage",
.data = &vslow_work_proportion, .data = &vslow_work_proportion,
.maxlen = sizeof(unsigned), .maxlen = sizeof(unsigned),
...@@ -81,7 +78,7 @@ ctl_table slow_work_sysctls[] = { ...@@ -81,7 +78,7 @@ ctl_table slow_work_sysctls[] = {
.extra1 = (void *) &slow_work_min_vslow, .extra1 = (void *) &slow_work_min_vslow,
.extra2 = (void *) &slow_work_max_vslow, .extra2 = (void *) &slow_work_max_vslow,
}, },
{ .ctl_name = 0 } {}
}; };
#endif #endif
......
...@@ -57,78 +57,47 @@ static int proc_do_uts_string(ctl_table *table, int write, ...@@ -57,78 +57,47 @@ static int proc_do_uts_string(ctl_table *table, int write,
#define proc_do_uts_string NULL #define proc_do_uts_string NULL
#endif #endif
#ifdef CONFIG_SYSCTL_SYSCALL
/* The generic string strategy routine: */
static int sysctl_uts_string(ctl_table *table,
void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen)
{
struct ctl_table uts_table;
int r, write;
write = newval && newlen;
memcpy(&uts_table, table, sizeof(uts_table));
uts_table.data = get_uts(table, write);
r = sysctl_string(&uts_table, oldval, oldlenp, newval, newlen);
put_uts(table, write, uts_table.data);
return r;
}
#else
#define sysctl_uts_string NULL
#endif
static struct ctl_table uts_kern_table[] = { static struct ctl_table uts_kern_table[] = {
{ {
.ctl_name = KERN_OSTYPE,
.procname = "ostype", .procname = "ostype",
.data = init_uts_ns.name.sysname, .data = init_uts_ns.name.sysname,
.maxlen = sizeof(init_uts_ns.name.sysname), .maxlen = sizeof(init_uts_ns.name.sysname),
.mode = 0444, .mode = 0444,
.proc_handler = proc_do_uts_string, .proc_handler = proc_do_uts_string,
.strategy = sysctl_uts_string,
}, },
{ {
.ctl_name = KERN_OSRELEASE,
.procname = "osrelease", .procname = "osrelease",
.data = init_uts_ns.name.release, .data = init_uts_ns.name.release,
.maxlen = sizeof(init_uts_ns.name.release), .maxlen = sizeof(init_uts_ns.name.release),
.mode = 0444, .mode = 0444,
.proc_handler = proc_do_uts_string, .proc_handler = proc_do_uts_string,
.strategy = sysctl_uts_string,
}, },
{ {
.ctl_name = KERN_VERSION,
.procname = "version", .procname = "version",
.data = init_uts_ns.name.version, .data = init_uts_ns.name.version,
.maxlen = sizeof(init_uts_ns.name.version), .maxlen = sizeof(init_uts_ns.name.version),
.mode = 0444, .mode = 0444,
.proc_handler = proc_do_uts_string, .proc_handler = proc_do_uts_string,
.strategy = sysctl_uts_string,
}, },
{ {
.ctl_name = KERN_NODENAME,
.procname = "hostname", .procname = "hostname",
.data = init_uts_ns.name.nodename, .data = init_uts_ns.name.nodename,
.maxlen = sizeof(init_uts_ns.name.nodename), .maxlen = sizeof(init_uts_ns.name.nodename),
.mode = 0644, .mode = 0644,
.proc_handler = proc_do_uts_string, .proc_handler = proc_do_uts_string,
.strategy = sysctl_uts_string,
}, },
{ {
.ctl_name = KERN_DOMAINNAME,
.procname = "domainname", .procname = "domainname",
.data = init_uts_ns.name.domainname, .data = init_uts_ns.name.domainname,
.maxlen = sizeof(init_uts_ns.name.domainname), .maxlen = sizeof(init_uts_ns.name.domainname),
.mode = 0644, .mode = 0644,
.proc_handler = proc_do_uts_string, .proc_handler = proc_do_uts_string,
.strategy = sysctl_uts_string,
}, },
{} {}
}; };
static struct ctl_table uts_root_table[] = { static struct ctl_table uts_root_table[] = {
{ {
.ctl_name = CTL_KERN,
.procname = "kernel", .procname = "kernel",
.mode = 0555, .mode = 0555,
.child = uts_kern_table, .child = uts_kern_table,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册