aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2008-10-13 05:42:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:43 -0400
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)
1213 * be held until the 'fast-open' is also done. Will change once we 1213 * be held until the 'fast-open' is also done. Will change once we
1214 * have refcounting in the driver and per driver locking 1214 * have refcounting in the driver and per driver locking
1215 */ 1215 */
1216struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver, int idx) 1216struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver,
1217 struct inode *inode, int idx)
1217{ 1218{
1218 struct tty_struct *tty; 1219 struct tty_struct *tty;
1219 1220
1220 if (driver->ops->lookup) 1221 if (driver->ops->lookup)
1221 return driver->ops->lookup(driver, idx); 1222 return driver->ops->lookup(driver, inode, idx);
1222 1223
1223 tty = driver->ttys[idx]; 1224 tty = driver->ttys[idx];
1224 return tty; 1225 return tty;
@@ -1539,10 +1540,11 @@ void tty_release_dev(struct file *filp)
1539 int devpts; 1540 int devpts;
1540 int idx; 1541 int idx;
1541 char buf[64]; 1542 char buf[64];
1543 struct inode *inode;
1542 1544
1545 inode = filp->f_path.dentry->d_inode;
1543 tty = (struct tty_struct *)filp->private_data; 1546 tty = (struct tty_struct *)filp->private_data;
1544 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, 1547 if (tty_paranoia_check(tty, inode, "tty_release_dev"))
1545 "tty_release_dev"))
1546 return; 1548 return;
1547 1549
1548 check_tty_count(tty, "tty_release_dev"); 1550 check_tty_count(tty, "tty_release_dev");
@@ -1751,7 +1753,7 @@ void tty_release_dev(struct file *filp)
1751 1753
1752 /* Make this pty number available for reallocation */ 1754 /* Make this pty number available for reallocation */
1753 if (devpts) 1755 if (devpts)
1754 devpts_kill_index(idx); 1756 devpts_kill_index(inode, idx);
1755} 1757}
1756 1758
1757/** 1759/**
@@ -1836,7 +1838,7 @@ retry_open:
1836got_driver: 1838got_driver:
1837 if (!tty) { 1839 if (!tty) {
1838 /* check whether we're reopening an existing tty */ 1840 /* check whether we're reopening an existing tty */
1839 tty = tty_driver_lookup_tty(driver, index); 1841 tty = tty_driver_lookup_tty(driver, inode, index);
1840 1842
1841 if (IS_ERR(tty)) 1843 if (IS_ERR(tty))
1842 return PTR_ERR(tty); 1844 return PTR_ERR(tty);