diff options
author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2008-10-13 05:42:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:43 -0400 |
commit | 15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c (patch) | |
tree | 301eea94cb514dc12b5070fc4b3ab33d3aab4322 /drivers/char/pty.c | |
parent | 4a2b5fddd53b80efcb3266ee36e23b8de28e761a (diff) |
Add an instance parameter devpts interfaces
Pass-in 'inode' or 'tty' parameter to devpts interfaces. With multiple
devpts instances, these parameters will be used in subsequent patches
to identify the instance of devpts mounted. The parameters also help
simplify devpts implementation.
Changelog[v3]:
- minor changes due to merge with ttydev updates
- rename parameters to emphasize they are ptmx or pts inodes
- pass-in tty_struct * to devpts_pty_kill() (this will help
cleanup the get_node() call in a subsequent patch)
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/pty.c')
-rw-r--r-- | drivers/char/pty.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index c5a192dd00db..a391badef52a 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -60,7 +60,7 @@ static void pty_close(struct tty_struct * tty, struct file * filp) | |||
60 | set_bit(TTY_OTHER_CLOSED, &tty->flags); | 60 | set_bit(TTY_OTHER_CLOSED, &tty->flags); |
61 | #ifdef CONFIG_UNIX98_PTYS | 61 | #ifdef CONFIG_UNIX98_PTYS |
62 | if (tty->driver == ptm_driver) | 62 | if (tty->driver == ptm_driver) |
63 | devpts_pty_kill(tty->index); | 63 | devpts_pty_kill(tty->link); |
64 | #endif | 64 | #endif |
65 | tty_vhangup(tty->link); | 65 | tty_vhangup(tty->link); |
66 | } | 66 | } |
@@ -453,9 +453,10 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, | |||
453 | * This provides our locking. | 453 | * This provides our locking. |
454 | */ | 454 | */ |
455 | 455 | ||
456 | static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, int idx) | 456 | static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, |
457 | struct inode *ptm_inode, int idx) | ||
457 | { | 458 | { |
458 | struct tty_struct *tty = devpts_get_tty(idx); | 459 | struct tty_struct *tty = devpts_get_tty(ptm_inode, idx); |
459 | if (tty) | 460 | if (tty) |
460 | tty = tty->link; | 461 | tty = tty->link; |
461 | return tty; | 462 | return tty; |
@@ -470,9 +471,10 @@ static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, int idx) | |||
470 | * This provides our locking. | 471 | * This provides our locking. |
471 | */ | 472 | */ |
472 | 473 | ||
473 | static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, int idx) | 474 | static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, |
475 | struct inode *pts_inode, int idx) | ||
474 | { | 476 | { |
475 | struct tty_struct *tty = devpts_get_tty(idx); | 477 | struct tty_struct *tty = devpts_get_tty(pts_inode, idx); |
476 | /* Master must be open before slave */ | 478 | /* Master must be open before slave */ |
477 | if (!tty) | 479 | if (!tty) |
478 | return ERR_PTR(-EIO); | 480 | return ERR_PTR(-EIO); |
@@ -602,7 +604,7 @@ static int __ptmx_open(struct inode *inode, struct file *filp) | |||
602 | nonseekable_open(inode, filp); | 604 | nonseekable_open(inode, filp); |
603 | 605 | ||
604 | /* find a device that is not in use. */ | 606 | /* find a device that is not in use. */ |
605 | index = devpts_new_index(); | 607 | index = devpts_new_index(inode); |
606 | if (index < 0) | 608 | if (index < 0) |
607 | return index; | 609 | return index; |
608 | 610 | ||
@@ -619,7 +621,7 @@ static int __ptmx_open(struct inode *inode, struct file *filp) | |||
619 | filp->private_data = tty; | 621 | filp->private_data = tty; |
620 | file_move(filp, &tty->tty_files); | 622 | file_move(filp, &tty->tty_files); |
621 | 623 | ||
622 | retval = devpts_pty_new(tty->link); | 624 | retval = devpts_pty_new(inode, tty->link); |
623 | if (retval) | 625 | if (retval) |
624 | goto out1; | 626 | goto out1; |
625 | 627 | ||
@@ -630,7 +632,7 @@ out1: | |||
630 | tty_release_dev(filp); | 632 | tty_release_dev(filp); |
631 | return retval; | 633 | return retval; |
632 | out: | 634 | out: |
633 | devpts_kill_index(index); | 635 | devpts_kill_index(inode, index); |
634 | return retval; | 636 | return retval; |
635 | } | 637 | } |
636 | 638 | ||