[Devel] [PATCH RHEL7 COMMIT] ve/vtty: Don't zap termios fields on slave peer

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 17 06:18:45 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.10
------>
commit 0eb5cec93f6d06b93c317795d636b68376e366f6
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Tue Nov 17 18:18:45 2015 +0400

    ve/vtty: Don't zap termios fields on slave peer
    
    These fields are sensitive to userspace so was a copy-paste
    bug in first place when I defined driver fields (the pty
    as well as vtty devices have same structure in drivers).
    
    Also I defined @chars_in_buffer, @flush_buffer and @resize
    methods for driver to be close to former pcs6 driver structure.
    
    Note there is still problem remains: upon vzctl console
    call the carrige return (enter press) is still required
    for login prompt to appear, I'm investigating it now.
    
    https://jira.sw.ru/browse/PSBM-41057
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 drivers/tty/pty.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 0ab36f9..b312635 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -1217,6 +1217,13 @@ static void vtty_remove(struct tty_driver *driver, struct tty_struct *tty)
 {
 }
 
+static int vtty_resize(struct tty_struct *tty, struct winsize *ws)
+{
+	if (tty->driver == vttym_driver)
+		return pty_resize(tty, ws);
+	return tty_do_resize(tty, ws);
+}
+
 static const struct tty_operations vtty_ops = {
 	.lookup		= vtty_lookup,
 	.install	= vtty_install,
@@ -1226,9 +1233,12 @@ static const struct tty_operations vtty_ops = {
 	.cleanup	= pty_cleanup,
 	.write		= vtty_write,
 	.write_room	= vtty_write_room,
+	.chars_in_buffer= pty_chars_in_buffer,
 	.set_termios	= pty_set_termios,
 	.unthrottle	= pty_unthrottle,
+	.flush_buffer	= pty_flush_buffer,
 	.remove		= vtty_remove,
+	.resize		= vtty_resize,
 };
 
 struct tty_driver *vtty_console_driver(int *index)
@@ -1301,8 +1311,6 @@ static int __init vtty_init(void)
 	/* 38400 boud rate, 8 bit char size, enable receiver */
 	vttym_driver->init_termios.c_cflag	= B38400 | CS8 | CREAD;
 	vttym_driver->init_termios.c_lflag	= 0;
-	vttym_driver->init_termios.c_ispeed	= 38400;
-	vttym_driver->init_termios.c_ospeed	= 38400;
 	tty_set_operations(vttym_driver, &vtty_ops);
 
 	vttys_driver->driver_name		= "vtty_slave";
@@ -1313,12 +1321,7 @@ static int __init vtty_init(void)
 	vttys_driver->type			= TTY_DRIVER_TYPE_PTY;
 	vttys_driver->subtype			= PTY_TYPE_SLAVE;
 	vttys_driver->init_termios		= tty_std_termios;
-	vttys_driver->init_termios.c_iflag	= 0;
-	vttys_driver->init_termios.c_oflag	= 0;
 	vttys_driver->init_termios.c_cflag	= B38400 | CS8 | CREAD;
-	vttys_driver->init_termios.c_lflag	= 0;
-	vttys_driver->init_termios.c_ispeed	= 38400;
-	vttys_driver->init_termios.c_ospeed	= 38400;
 	tty_set_operations(vttys_driver, &vtty_ops);
 
 	if (tty_register_driver(vttym_driver))


More information about the Devel mailing list