[CRIU] [PATCH v4 29/33] tty: Use generic list for tty files

Kirill Tkhai ktkhai at virtuozzo.com
Tue Dec 13 07:08:28 PST 2016


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

v4: New

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c            |   12 ------------
 criu/include/rst_info.h |    2 --
 criu/tty.c              |   24 ------------------------
 3 files changed, 38 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 95f3912..2c1fb6f 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -752,8 +752,6 @@ int prepare_fd_pid(struct pstree_item *item)
 	INIT_LIST_HEAD(&rst_info->used);
 	INIT_LIST_HEAD(&rst_info->fds);
 	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 */
 		return 0;
@@ -1147,14 +1145,6 @@ int prepare_fds(struct pstree_item *me)
 		goto out_w;
 
 	/*
-	 * Now handle TTYs. Slaves are delayed to be sure masters
-	 * are already opened.
-	 */
-	ret = open_fdinfos(me->pid.virt, &rsti(me)->tty_slaves);
-	if (ret)
-		goto out_w;
-
-	/*
 	 * The eventpoll descriptors require all the other ones
 	 * to be already restored, thus we store them in a separate
 	 * list and restore at the very end.
@@ -1162,8 +1152,6 @@ int prepare_fds(struct pstree_item *me)
 	ret = open_fdinfos(me->pid.virt, &rsti(me)->eventpoll);
 	if (ret)
 		goto out_w;
-
-	ret = open_fdinfos(me->pid.virt, &rsti(me)->tty_ctty);
 out_w:
 	close_service_fd(TRANSPORT_FD_OFF);
 	if (rsti(me)->fdt)
diff --git a/criu/include/rst_info.h b/criu/include/rst_info.h
index 26f61bc..056d7db 100644
--- a/criu/include/rst_info.h
+++ b/criu/include/rst_info.h
@@ -29,8 +29,6 @@ struct rst_info {
 	struct list_head	used;
 	struct list_head	fds;
 	struct list_head	eventpoll;
-	struct list_head	tty_slaves;
-	struct list_head	tty_ctty;
 
 	void			*premmapped_addr;
 	unsigned long		premmapped_len;
diff --git a/criu/tty.c b/criu/tty.c
index 3fc178d..ea2cf47 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1152,29 +1152,6 @@ static int tty_open(struct file_desc *d, int *new_fd)
 	return ORV_OK;
 }
 
-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)
 {
 	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)
 static struct file_desc_ops tty_desc_ops = {
 	.type		= FD_TYPES__TTY,
 	.open		= tty_open,
-	.collect_fd	= tty_collect_fd,
 	.name		= tty_d_name,
 };
 



More information about the CRIU mailing list