summaryrefslogtreecommitdiff
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2008-10-13 10:42:59 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 09:51:43 -0700
commit15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c (patch)
tree301eea94cb514dc12b5070fc4b3ab33d3aab4322 /drivers/char/tty_io.c
parent4a2b5fddd53b80efcb3266ee36e23b8de28e761a (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/tty_io.c')
-rw-r--r--drivers/char/tty_io.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 36098ee8fe65..959083961024 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1213,12 +1213,13 @@ static void tty_line_name(struct tty_driver *driver, int index, char *p)
* be held until the 'fast-open' is also done. Will change once we
* have refcounting in the driver and per driver locking
*/
-struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver, int idx)
+struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver,
+ struct inode *inode, int idx)
{
struct tty_struct *tty;
if (driver->ops->lookup)
- return driver->ops->lookup(driver, idx);
+ return driver->ops->lookup(driver, inode, idx);
tty = driver->ttys[idx];
return tty;
@@ -1539,10 +1540,11 @@ void tty_release_dev(struct file *filp)
int devpts;
int idx;
char buf[64];
+ struct inode *inode;
+ inode = filp->f_path.dentry->d_inode;
tty = (struct tty_struct *)filp->private_data;
- if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode,
- "tty_release_dev"))
+ if (tty_paranoia_check(tty, inode, "tty_release_dev"))
return;
check_tty_count(tty, "tty_release_dev");
@@ -1751,7 +1753,7 @@ void tty_release_dev(struct file *filp)
/* Make this pty number available for reallocation */
if (devpts)
- devpts_kill_index(idx);
+ devpts_kill_index(inode, idx);
}
/**
@@ -1836,7 +1838,7 @@ retry_open:
got_driver:
if (!tty) {
/* check whether we're reopening an existing tty */
- tty = tty_driver_lookup_tty(driver, index);
+ tty = tty_driver_lookup_tty(driver, inode, index);
if (IS_ERR(tty))
return PTR_ERR(tty);