2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 23:05:39 +00:00

tty: Move image type onto tty_type

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2015-02-18 18:29:14 +03:00
parent 3b913082ac
commit d47975b5ec

29
tty.c
View File

@@ -135,6 +135,7 @@ struct tty_type {
int t; int t;
char *name; char *name;
int index; int index;
int img_type;
unsigned flags; unsigned flags;
int (*fd_get_index)(int fd, const struct fd_parms *); int (*fd_get_index)(int fd, const struct fd_parms *);
int (*img_get_index)(struct tty_info *ti); int (*img_get_index)(struct tty_info *ti);
@@ -171,6 +172,7 @@ static struct tty_type ptm_type = {
.t = TTY_TYPE_PTM, .t = TTY_TYPE_PTM,
.flags = TTY_PAIR, .flags = TTY_PAIR,
.name = "ptmx", .name = "ptmx",
.img_type = TTY_TYPE__PTY,
.fd_get_index = ptm_fd_get_index, .fd_get_index = ptm_fd_get_index,
.img_get_index = pty_get_index, .img_get_index = pty_get_index,
.open = pty_open_ptmx, .open = pty_open_ptmx,
@@ -182,6 +184,7 @@ static struct tty_type console_type = {
.t = TTY_TYPE_CONSOLE, .t = TTY_TYPE_CONSOLE,
.flags = 0, .flags = 0,
.name = "console", .name = "console",
.img_type = TTY_TYPE__CONSOLE,
.index = CONSOLE_INDEX, .index = CONSOLE_INDEX,
.open = open_simple_tty, .open = open_simple_tty,
}; };
@@ -190,6 +193,7 @@ static struct tty_type vt_type = {
.t = TTY_TYPE_VT, .t = TTY_TYPE_VT,
.flags = 0, .flags = 0,
.name = "vt", .name = "vt",
.img_type = TTY_TYPE__VT,
.index = VT_INDEX, .index = VT_INDEX,
.open = open_simple_tty, .open = open_simple_tty,
}; };
@@ -218,6 +222,7 @@ static struct tty_type pts_type = {
.t = TTY_TYPE_PTS, .t = TTY_TYPE_PTS,
.flags = TTY_PAIR, .flags = TTY_PAIR,
.name = "pts", .name = "pts",
.img_type = TTY_TYPE__PTY,
.fd_get_index = pts_fd_get_index, .fd_get_index = pts_fd_get_index,
.img_get_index = pty_get_index, .img_get_index = pty_get_index,
.open = pty_open_ptmx, .open = pty_open_ptmx,
@@ -1438,28 +1443,16 @@ static int dump_tty_info(int lfd, u32 id, const struct fd_parms *p, struct tty_t
info.sid = pti->sid; info.sid = pti->sid;
info.pgrp = pti->pgrp; info.pgrp = pti->pgrp;
info.rdev = p->stat.st_rdev; info.rdev = p->stat.st_rdev;
switch (type->t) {
case TTY_TYPE_PTM:
case TTY_TYPE_PTS:
info.type = TTY_TYPE__PTY;
info.pty = &pty;
pty.index = index;
break;
case TTY_TYPE_CONSOLE:
info.type = TTY_TYPE__CONSOLE;
break;
case TTY_TYPE_VT:
info.type = TTY_TYPE__VT;
break;
default:
BUG();
}
info.locked = pti->st_lock; info.locked = pti->st_lock;
info.exclusive = pti->st_excl; info.exclusive = pti->st_excl;
info.packet_mode = pti->st_pckt; info.packet_mode = pti->st_pckt;
info.type = type->img_type;
if (info.type == TTY_TYPE__PTY) {
info.pty = &pty;
pty.index = index;
}
/* /*
* Nothing we can do on hanging up terminal, * Nothing we can do on hanging up terminal,
* just write out minimum information we can * just write out minimum information we can