diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-11 07:48:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 11:51:01 -0400 |
commit | e8b70e7d3e86319a8b2aaabde3866833d92cd80f (patch) | |
tree | dac8e7b42f553ee3a9a0920e20b5a39da197b13a /drivers/char/tty_io.c | |
parent | 5f0878acba7db24323f5ba4055ec9a96895bb150 (diff) |
tty: Extract various bits of ldisc code
Before trying to tackle the ldisc bugs the code needs to be a good deal
more readable, so do the simple extractions of routines first.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 6c817398232e..be49d0730bb9 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2481,6 +2481,24 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int | |||
2481 | return tty->ops->tiocmset(tty, file, set, clear); | 2481 | return tty->ops->tiocmset(tty, file, set, clear); |
2482 | } | 2482 | } |
2483 | 2483 | ||
2484 | struct tty_struct *tty_pair_get_tty(struct tty_struct *tty) | ||
2485 | { | ||
2486 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | ||
2487 | tty->driver->subtype == PTY_TYPE_MASTER) | ||
2488 | tty = tty->link; | ||
2489 | return tty; | ||
2490 | } | ||
2491 | EXPORT_SYMBOL(tty_pair_get_tty); | ||
2492 | |||
2493 | struct tty_struct *tty_pair_get_pty(struct tty_struct *tty) | ||
2494 | { | ||
2495 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | ||
2496 | tty->driver->subtype == PTY_TYPE_MASTER) | ||
2497 | return tty; | ||
2498 | return tty->link; | ||
2499 | } | ||
2500 | EXPORT_SYMBOL(tty_pair_get_pty); | ||
2501 | |||
2484 | /* | 2502 | /* |
2485 | * Split this up, as gcc can choke on it otherwise.. | 2503 | * Split this up, as gcc can choke on it otherwise.. |
2486 | */ | 2504 | */ |
@@ -2496,11 +2514,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2496 | if (tty_paranoia_check(tty, inode, "tty_ioctl")) | 2514 | if (tty_paranoia_check(tty, inode, "tty_ioctl")) |
2497 | return -EINVAL; | 2515 | return -EINVAL; |
2498 | 2516 | ||
2499 | real_tty = tty; | 2517 | real_tty = tty_pair_get_tty(tty); |
2500 | if (tty->driver->type == TTY_DRIVER_TYPE_PTY && | ||
2501 | tty->driver->subtype == PTY_TYPE_MASTER) | ||
2502 | real_tty = tty->link; | ||
2503 | |||
2504 | 2518 | ||
2505 | /* | 2519 | /* |
2506 | * Factor out some common prep work | 2520 | * Factor out some common prep work |