[Devel] [PATCH rh7] vtty: Don't zap termios fields on slave peer

Cyrill Gorcunov gorcunov at virtuozzo.com
Wed Nov 11 04:25:36 PST 2015


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>
CC: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/tty/pty.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Index: linux-pcs7.git/drivers/tty/pty.c
===================================================================
--- linux-pcs7.git.orig/drivers/tty/pty.c
+++ linux-pcs7.git/drivers/tty/pty.c
@@ -1217,6 +1217,13 @@ static void vtty_remove(struct tty_drive
 {
 }
 
+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_
 	.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