Commit d47975b5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tty: Move image type onto tty_type

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3b913082
...@@ -135,6 +135,7 @@ struct tty_type { ...@@ -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 = { ...@@ -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 = { ...@@ -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 = { ...@@ -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 = { ...@@ -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 ...@@ -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;
info.locked = pti->st_lock;
info.exclusive = pti->st_excl;
info.packet_mode = pti->st_pckt;
switch (type->t) { info.type = type->img_type;
case TTY_TYPE_PTM: if (info.type == TTY_TYPE__PTY) {
case TTY_TYPE_PTS:
info.type = TTY_TYPE__PTY;
info.pty = &pty; info.pty = &pty;
pty.index = index; 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.exclusive = pti->st_excl;
info.packet_mode = pti->st_pckt;
/* /*
* 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment