[CRIU] [PATCH 9/9] tty: Add support of /dev/console
Pavel Emelyanov
xemul at parallels.com
Thu Oct 23 07:02:31 PDT 2014
On 10/16/2014 02:27 PM, Cyrill Gorcunov wrote:
> /dev/console is a system console which provided
> by the system with major 5 and minor 1. It's usually
> configured on system startup with console= option
> and underlied driver is resposible to deliver messages
> to the console user.
Why don't we have a test for it? Sine you're using the
regfiles engine you can just mknod("$test/foo", "c", 5, 1)
and go ahead with it.
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> @@ -1305,9 +1374,19 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
> return -1;
>
> type = tty_type(major(p->stat.st_rdev), minor(p->stat.st_rdev));
> - index = parse_pty_index(id, lfd, p, type);
> - if (index < 0)
> - return -1;
> + switch (type) {
Move this switch into parse_pty_index, it does switch (type) anyway.
> + case TTY_TYPE_PTM:
> + case TTY_TYPE_PTS:
> + index = parse_pty_index(id, lfd, p, type);
> + if (index < 0)
> + return -1;
> + break;
> + case TTY_TYPE_CONSOLE:
> + index = CONSOLE_INDEX;
> + break;
> + default:
> + BUG();
> + }
>
> e.id = id;
> e.tty_info_id = tty_gen_id(type, index);
> @@ -1335,7 +1414,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
> */
>
> if (!tty_test_and_set(e.tty_info_id, tty_bitmap))
> - ret = dump_pty_info(lfd, e.tty_info_id, p, type, index);
> + ret = dump_tty_info(lfd, e.tty_info_id, p, type, index);
>
> if (!ret)
> ret = pb_write_one(img_from_set(glob_imgset, CR_FD_TTY_FILES), &e, PB_TTY_FILE);
> @@ -1344,7 +1423,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
>
> const struct fdtype_ops tty_dump_ops = {
> .type = FD_TYPES__TTY,
> - .dump = dump_one_pty,
> + .dump = dump_one_tty,
> };
>
> int tty_prep_fds(void)
>
More information about the CRIU
mailing list