[CRIU] [PATCH v5 31/33] files: Kill pid parameter of open_fdinfos()

Kirill Tkhai ktkhai at virtuozzo.com
Mon Dec 26 06:30:01 PST 2016


Nobody uses pid, so let's kill it. Also, pass pstree_item parameter
to open_fdinfos() instead of list, as this function operates on fds
list only.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 2cfe24d48..a38e3a9fc 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -853,7 +853,7 @@ struct fd_open_state {
 	int (*cb)(int, struct fdinfo_list_entry *);
 };
 
-static int receive_fd(int pid, struct fdinfo_list_entry *fle);
+static int receive_fd(struct fdinfo_list_entry *fle);
 
 static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid)
 {
@@ -1007,7 +1007,7 @@ static int setup_and_serve_out(struct fdinfo_list_entry *fle, int new_fd)
 	return 0;
 }
 
-static int open_fd(int pid, struct fdinfo_list_entry *fle)
+static int open_fd(struct fdinfo_list_entry *fle)
 {
 	struct file_desc *d = fle->desc;
 	struct fdinfo_list_entry *flem;
@@ -1016,7 +1016,7 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
 	flem = file_master(d);
 	if (fle != flem) {
 		BUG_ON (fle->stage != FLE_INITIALIZED);
-		ret = receive_fd(pid, fle);
+		ret = receive_fd(fle);
 		if (ret != 0)
 			return ret;
 		goto fixup_ctty;
@@ -1040,7 +1040,7 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
 	return ret;
 }
 
-static int receive_fd(int pid, struct fdinfo_list_entry *fle)
+static int receive_fd(struct fdinfo_list_entry *fle)
 {
 	int ret;
 
@@ -1061,8 +1061,9 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle)
 	return 0;
 }
 
-static int open_fdinfos(int pid, struct list_head *list)
+static int open_fdinfos(struct pstree_item *me)
 {
+	struct list_head *list = &rsti(me)->fds;
 	struct fdinfo_list_entry *fle, *tmp;
 	LIST_HEAD(completed);
 	bool progress, again;
@@ -1075,7 +1076,7 @@ static int open_fdinfos(int pid, struct list_head *list)
 		list_for_each_entry_safe(fle, tmp, list, ps_list) {
 			st = fle->stage;
 			BUG_ON(st == FLE_RESTORED);
-			ret = open_fd(pid, fle);
+			ret = open_fd(fle);
 			if (ret == -1)
 				goto splice;
 			if (st != fle->stage || ret == 0)
@@ -1169,7 +1170,7 @@ int prepare_fds(struct pstree_item *me)
 		}
 	}
 
-	ret = open_fdinfos(me->pid.virt, &rsti(me)->fds);
+	ret = open_fdinfos(me);
 
 	close_service_fd(TRANSPORT_FD_OFF);
 	if (rsti(me)->fdt)



More information about the CRIU mailing list