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

Kirill Tkhai ktkhai at virtuozzo.com
Mon Dec 26 06:29:43 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 26ff5a90c..841ee518d 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -782,8 +782,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;
@@ -1177,14 +1175,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.
@@ -1192,8 +1182,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 26f61bcf3..056d7db88 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 09723d7f5..08dad1cb6 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 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)
 {
 	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