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

Kirill Tkhai ktkhai at virtuozzo.com
Tue Dec 13 07:08:46 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 dc0cdf4..0338c1b 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -823,7 +823,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)
 {
@@ -977,7 +977,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;
@@ -986,7 +986,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 != ORV_OK)
 			return ret;
 		goto fixup_ctty;
@@ -1011,7 +1011,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;
 
@@ -1032,8 +1032,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;
@@ -1045,7 +1046,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 == ORV_ERR)
 				goto splice;
 			if (st != fle->stage || ret == ORV_OK)
@@ -1139,7 +1140,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