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 <gorcu...@virtuozzo.com>
Reviewed-by: Vladimir Davydov <vdavy...@virtuozzo.com>

https://jira.sw.ru/browse/PSBM-132299

(cherry-picked from ca82283e668fa36738231594f8d325ad5d3dad6a)
Signed-off-by: Valeriy Vdovin <valeriy.vdo...@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 c830fe09712c..6ed441f9c566 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -897,6 +897,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,
@@ -906,9 +913,12 @@ static const struct tty_operations vtty_ops = {
        .cleanup        = pty_cleanup,
        .write          = vtty_write,
        .write_room     = vtty_write_room,
+       .chars_in_buffer= tty_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)
@@ -978,8 +988,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";
@@ -990,12 +998,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))
-- 
2.31.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to