aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:54:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:46 -0400
commit3e8e88ca053150efdbecb45d8f481cf560ec808d (patch)
tree1a763eb645fabf5dfb869c6982bf6c8ab030982f /drivers
parentf2545a75632d18d62aa287b9e5d207255cc8bffc (diff)
pty: prepare for tty->ops changes
We are about to change the tty layer to avoid keeping private copies of all the methods in each tty. We have to update the pty layer first as it currently patches the ioctl method according to the tty type. Use multiple tty operations sets instead. Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/pty.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 6288356b769d..0a05c038ae6f 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -254,6 +254,18 @@ static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file,
254static int legacy_count = CONFIG_LEGACY_PTY_COUNT; 254static int legacy_count = CONFIG_LEGACY_PTY_COUNT;
255module_param(legacy_count, int, 0); 255module_param(legacy_count, int, 0);
256 256
257static const struct tty_operations pty_ops_bsd = {
258 .open = pty_open,
259 .close = pty_close,
260 .write = pty_write,
261 .write_room = pty_write_room,
262 .flush_buffer = pty_flush_buffer,
263 .chars_in_buffer = pty_chars_in_buffer,
264 .unthrottle = pty_unthrottle,
265 .set_termios = pty_set_termios,
266 .ioctl = pty_bsd_ioctl,
267};
268
257static void __init legacy_pty_init(void) 269static void __init legacy_pty_init(void)
258{ 270{
259 if (legacy_count <= 0) 271 if (legacy_count <= 0)
@@ -284,7 +296,6 @@ static void __init legacy_pty_init(void)
284 pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW; 296 pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
285 pty_driver->other = pty_slave_driver; 297 pty_driver->other = pty_slave_driver;
286 tty_set_operations(pty_driver, &pty_ops); 298 tty_set_operations(pty_driver, &pty_ops);
287 pty_driver->ioctl = pty_bsd_ioctl;
288 299
289 pty_slave_driver->owner = THIS_MODULE; 300 pty_slave_driver->owner = THIS_MODULE;
290 pty_slave_driver->driver_name = "pty_slave"; 301 pty_slave_driver->driver_name = "pty_slave";
@@ -377,6 +388,19 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file,
377 return -ENOIOCTLCMD; 388 return -ENOIOCTLCMD;
378} 389}
379 390
391static const struct tty_operations pty_unix98_ops = {
392 .open = pty_open,
393 .close = pty_close,
394 .write = pty_write,
395 .write_room = pty_write_room,
396 .flush_buffer = pty_flush_buffer,
397 .chars_in_buffer = pty_chars_in_buffer,
398 .unthrottle = pty_unthrottle,
399 .set_termios = pty_set_termios,
400 .ioctl = pty_unix98_ioctl
401};
402
403
380static void __init unix98_pty_init(void) 404static void __init unix98_pty_init(void)
381{ 405{
382 ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); 406 ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX);
@@ -403,8 +427,7 @@ static void __init unix98_pty_init(void)
403 ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | 427 ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW |
404 TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; 428 TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM;
405 ptm_driver->other = pts_driver; 429 ptm_driver->other = pts_driver;
406 tty_set_operations(ptm_driver, &pty_ops); 430 tty_set_operations(ptm_driver, &pty_unix98_ops);
407 ptm_driver->ioctl = pty_unix98_ioctl;
408 431
409 pts_driver->owner = THIS_MODULE; 432 pts_driver->owner = THIS_MODULE;
410 pts_driver->driver_name = "pty_slave"; 433 pts_driver->driver_name = "pty_slave";