diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-10-18 06:05:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:23 -0400 |
commit | 35834ca1e4bda56d252aa2024a283d631f0e5ac6 (patch) | |
tree | 4f73a27db7de4ced7b39907fe958498a3ff7ef4b /drivers/char | |
parent | 25398a158d86b993fa5bf36f5a6752134b584d60 (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>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/pty.c | 24 |
1 files changed, 23 insertions, 1 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; | |||
318 | static int pty_limit_min = 0; | 318 | static int pty_limit_min = 0; |
319 | static int pty_limit_max = NR_UNIX98_PTY_MAX; | 319 | static int pty_limit_max = NR_UNIX98_PTY_MAX; |
320 | 320 | ||
321 | ctl_table pty_table[] = { | 321 | static 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 | ||
343 | static 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 | |||
353 | static 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 | |||
343 | static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, | 364 | static 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 |
409 | static inline void unix98_pty_init(void) { } | 431 | static inline void unix98_pty_init(void) { } |