summaryrefslogtreecommitdiff
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-10-19 00:26:31 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-23 03:50:13 +0400
commitfa2ecfc5a68d85624bbd84f7d010860776b7e602 (patch)
tree531ad8fdd185f96655f084a43ee1adb291941321 /drivers/tty/pty.c
parent1dcb8e6d1c23f2e021639199fdf64d5b42689207 (diff)
downloadlinux-fa2ecfc5a68d85624bbd84f7d010860776b7e602.tar.xz
TTY: move devpts kill to pty
Now that we have control over tty->driver_data in pty, we can just kill the /dev/pts/ in pty code too. Namely, in ->shutdown hook of tty. For pty, this is called only once, for whichever end is closed last. But we don't care, both driver_data are the inode as it used to be till now. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 559e5b27941a..2728afe52eea 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -363,6 +363,12 @@ err:
return retval;
}
+/* this is called once with whichever end is closed last */
+static void pty_unix98_shutdown(struct tty_struct *tty)
+{
+ devpts_kill_index(tty->driver_data, tty->index);
+}
+
static void pty_cleanup(struct tty_struct *tty)
{
kfree(tty->port);
@@ -578,6 +584,7 @@ static const struct tty_operations ptm_unix98_ops = {
.set_termios = pty_set_termios,
.ioctl = pty_unix98_ioctl,
.resize = pty_resize,
+ .shutdown = pty_unix98_shutdown,
.cleanup = pty_cleanup
};
@@ -593,6 +600,7 @@ static const struct tty_operations pty_unix98_ops = {
.chars_in_buffer = pty_chars_in_buffer,
.unthrottle = pty_unthrottle,
.set_termios = pty_set_termios,
+ .shutdown = pty_unix98_shutdown,
.cleanup = pty_cleanup,
};
@@ -661,6 +669,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
goto err_release;
tty_unlock(tty);
+ tty->driver_data = inode;
tty->link->driver_data = slave_inode;
return 0;
err_release: