Commit f8143fd9 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

tty: Use generic list for tty files

Since tty opening order is set by dependencies,
we may safely store all ttys in generic list.

v4: New
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f139581a
...@@ -782,8 +782,6 @@ int prepare_fd_pid(struct pstree_item *item) ...@@ -782,8 +782,6 @@ int prepare_fd_pid(struct pstree_item *item)
INIT_LIST_HEAD(&rst_info->used); INIT_LIST_HEAD(&rst_info->used);
INIT_LIST_HEAD(&rst_info->fds); INIT_LIST_HEAD(&rst_info->fds);
INIT_LIST_HEAD(&rst_info->eventpoll); INIT_LIST_HEAD(&rst_info->eventpoll);
INIT_LIST_HEAD(&rst_info->tty_slaves);
INIT_LIST_HEAD(&rst_info->tty_ctty);
if (item->ids == NULL) /* zombie */ if (item->ids == NULL) /* zombie */
return 0; return 0;
...@@ -1189,14 +1187,6 @@ int prepare_fds(struct pstree_item *me) ...@@ -1189,14 +1187,6 @@ int prepare_fds(struct pstree_item *me)
if (ret) if (ret)
goto out_w; goto out_w;
/*
* Now handle TTYs. Slaves are delayed to be sure masters
* are already opened.
*/
ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->tty_slaves);
if (ret)
goto out_w;
/* /*
* The eventpoll descriptors require all the other ones * The eventpoll descriptors require all the other ones
* to be already restored, thus we store them in a separate * to be already restored, thus we store them in a separate
...@@ -1205,8 +1195,6 @@ int prepare_fds(struct pstree_item *me) ...@@ -1205,8 +1195,6 @@ int prepare_fds(struct pstree_item *me)
ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->eventpoll); ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->eventpoll);
if (ret) if (ret)
goto out_w; goto out_w;
ret = open_fdinfos(me->pid->ns[0].virt, &rsti(me)->tty_ctty);
out_w: out_w:
close_service_fd(TRANSPORT_FD_OFF); close_service_fd(TRANSPORT_FD_OFF);
if (rsti(me)->fdt) if (rsti(me)->fdt)
......
...@@ -29,8 +29,6 @@ struct rst_info { ...@@ -29,8 +29,6 @@ struct rst_info {
struct list_head used; struct list_head used;
struct list_head fds; struct list_head fds;
struct list_head eventpoll; struct list_head eventpoll;
struct list_head tty_slaves;
struct list_head tty_ctty;
void *premmapped_addr; void *premmapped_addr;
unsigned long premmapped_len; unsigned long premmapped_len;
......
...@@ -1152,29 +1152,6 @@ static int tty_open(struct file_desc *d, int *new_fd) ...@@ -1152,29 +1152,6 @@ static int tty_open(struct file_desc *d, int *new_fd)
return 0; return 0;
} }
static void tty_collect_fd(struct file_desc *d, struct fdinfo_list_entry *fle,
struct rst_info *ri)
{
struct tty_info *info = container_of(d, struct tty_info, d);
struct list_head *tgt;
/*
* Unix98 pty slave peers requires the master peers being
* opened before them. In turn, current ttys should be opened
* after the slave peers so session must alread exist.
*/
if (tty_is_master(info) && info->driver->type != TTY_TYPE__CTTY)
collect_gen_fd(fle, ri);
else {
if (info->driver->type == TTY_TYPE__CTTY)
tgt = &ri->tty_ctty;
else
tgt = &ri->tty_slaves;
list_add_tail(&fle->ps_list, tgt);
}
}
static char *tty_d_name(struct file_desc *d, char *buf, size_t s) static char *tty_d_name(struct file_desc *d, char *buf, size_t s)
{ {
struct tty_info *info = container_of(d, struct tty_info, d); struct tty_info *info = container_of(d, struct tty_info, d);
...@@ -1187,7 +1164,6 @@ static char *tty_d_name(struct file_desc *d, char *buf, size_t s) ...@@ -1187,7 +1164,6 @@ static char *tty_d_name(struct file_desc *d, char *buf, size_t s)
static struct file_desc_ops tty_desc_ops = { static struct file_desc_ops tty_desc_ops = {
.type = FD_TYPES__TTY, .type = FD_TYPES__TTY,
.open = tty_open, .open = tty_open,
.collect_fd = tty_collect_fd,
.name = tty_d_name, .name = tty_d_name,
}; };
......
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