diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/pty.c | 18 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 14 |
2 files changed, 18 insertions, 14 deletions
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index c5a192dd00d..a391badef52 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) set_bit(TTY_OTHER_CLOSED, &tty->flags); #ifdef CONFIG_UNIX98_PTYS if (tty->driver == ptm_driver) - devpts_pty_kill(tty->index); + devpts_pty_kill(tty->link); #endif tty_vhangup(tty->link); } @@ -453,9 +453,10 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, * This provides our locking. */ -static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, int idx) +static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, + struct inode *ptm_inode, int idx) { - struct tty_struct *tty = devpts_get_tty(idx); + struct tty_struct *tty = devpts_get_tty(ptm_inode, idx); if (tty) tty = tty->link; return tty; @@ -470,9 +471,10 @@ static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, int idx) * This provides our locking. */ -static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, int idx) +static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, + struct inode *pts_inode, int idx) { - struct tty_struct *tty = devpts_get_tty(idx); + struct tty_struct *tty = devpts_get_tty(pts_inode, idx); /* Master must be open before slave */ if (!tty) return ERR_PTR(-EIO); @@ -602,7 +604,7 @@ static int __ptmx_open(struct inode *inode, struct file *filp) nonseekable_open(inode, filp); /* find a device that is not in use. */ - index = devpts_new_index(); + index = devpts_new_index(inode); if (index < 0) return index; @@ -619,7 +621,7 @@ static int __ptmx_open(struct inode *inode, struct file *filp) filp->private_data = tty; file_move(filp, &tty->tty_files); - retval = devpts_pty_new(tty->link); + retval = devpts_pty_new(inode, tty->link); if (retval) goto out1; @@ -630,7 +632,7 @@ out1: tty_release_dev(filp); return retval; out: - devpts_kill_index(index); + devpts_kill_index(inode, index); return retval; } diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 36098ee8fe6..95908396102 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); |