aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-10-18 06:05:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:23 -0400
commit35834ca1e4bda56d252aa2024a283d631f0e5ac6 (patch)
tree4f73a27db7de4ced7b39907fe958498a3ff7ef4b
parent25398a158d86b993fa5bf36f5a6752134b584d60 (diff)
sysctl: simplify the pty sysctl logic
Instead of having a bunch of ifdefs in sysctl.c move all of the pty sysctl logic into drivers/char/pty.c As well as cleaning up the logic this prevents sysctl_check_table from complaining that the root table has a NULL data pointer on something with generic methods. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/pty.c24
-rw-r--r--kernel/sysctl.c11
2 files changed, 23 insertions, 12 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 73de77105fea..706ff34728f1 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -318,7 +318,7 @@ int pty_limit = NR_UNIX98_PTY_DEFAULT;
318static int pty_limit_min = 0; 318static int pty_limit_min = 0;
319static int pty_limit_max = NR_UNIX98_PTY_MAX; 319static int pty_limit_max = NR_UNIX98_PTY_MAX;
320 320
321ctl_table pty_table[] = { 321static struct ctl_table pty_table[] = {
322 { 322 {
323 .ctl_name = PTY_MAX, 323 .ctl_name = PTY_MAX,
324 .procname = "max", 324 .procname = "max",
@@ -340,6 +340,27 @@ ctl_table pty_table[] = {
340 } 340 }
341}; 341};
342 342
343static struct ctl_table pty_kern_table[] = {
344 {
345 .ctl_name = KERN_PTY,
346 .procname = "pty",
347 .mode = 0555,
348 .child = pty_table,
349 },
350 {}
351};
352
353static struct ctl_table pty_root_table[] = {
354 {
355 .ctl_name = CTL_KERN,
356 .procname = "kernel",
357 .mode = 0555,
358 .child = pty_kern_table,
359 },
360 {}
361};
362
363
343static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, 364static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file,
344 unsigned int cmd, unsigned long arg) 365 unsigned int cmd, unsigned long arg)
345{ 366{
@@ -404,6 +425,7 @@ static void __init unix98_pty_init(void)
404 panic("Couldn't register Unix98 pts driver"); 425 panic("Couldn't register Unix98 pts driver");
405 426
406 pty_table[1].data = &ptm_driver->refcount; 427 pty_table[1].data = &ptm_driver->refcount;
428 register_sysctl_table(pty_root_table);
407} 429}
408#else 430#else
409static inline void unix98_pty_init(void) { } 431static inline void unix98_pty_init(void) { }
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index bed6cdb3e47a..0278f52c4b04 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -163,9 +163,6 @@ static struct ctl_table fs_table[];
163static struct ctl_table debug_table[]; 163static struct ctl_table debug_table[];
164static struct ctl_table dev_table[]; 164static struct ctl_table dev_table[];
165extern struct ctl_table random_table[]; 165extern struct ctl_table random_table[];
166#ifdef CONFIG_UNIX98_PTYS
167extern struct ctl_table pty_table[];
168#endif
169#ifdef CONFIG_INOTIFY_USER 166#ifdef CONFIG_INOTIFY_USER
170extern struct ctl_table inotify_table[]; 167extern struct ctl_table inotify_table[];
171#endif 168#endif
@@ -534,14 +531,6 @@ static struct ctl_table kern_table[] = {
534 .mode = 0555, 531 .mode = 0555,
535 .child = random_table, 532 .child = random_table,
536 }, 533 },
537#ifdef CONFIG_UNIX98_PTYS
538 {
539 .ctl_name = KERN_PTY,
540 .procname = "pty",
541 .mode = 0555,
542 .child = pty_table,
543 },
544#endif
545 { 534 {
546 .ctl_name = KERN_OVERFLOWUID, 535 .ctl_name = KERN_OVERFLOWUID,
547 .procname = "overflowuid", 536 .procname = "overflowuid",