[CRIU] [PATCH 12/28] rst: replace old shared files handling routines with new ones

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Mar 22 13:58:51 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 files.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
-------------- next part --------------
diff --git a/files.c b/files.c
index feff47b..c0fa093 100644
--- a/files.c
+++ b/files.c
@@ -261,7 +261,7 @@ int prepare_fd_pid(int pid)
 		if (fd_is_special(&e.fde))
 			continue;
 
-		ret = collect_fd(pid, &e);
+		ret = collect_fd_pid(pid, &e.fde);
 		if (ret < 0)
 			break;
 	}
@@ -653,27 +653,33 @@ static int open_fdinfo(int pid, struct fdinfo_entry *fe, int *fdinfo_fd, int sta
 {
 	u32 mag;
 	int ret = 0;
-
-	struct fdinfo_desc *fi = find_fd(fe->fde.id);
+	struct file_info *fi;
+	struct fd_entry *fde = &fe->fde;
 
 	if (move_img_fd(fdinfo_fd, (int)fe->addr))
 		return -1;
 
-	pr_info("\t%d: Got fd for %lx type %d namelen %d users %d\n", pid,
-			(unsigned long)fe->addr, fe->fde.type, fe->len, fi->users);
+	pr_info("\t%d: Got fd for %lx type %d namelen %d\n", pid,
+			(unsigned long)fe->addr, fe->fde.type, fe->len);
 
 	BUG_ON(fe->fde.type != FDINFO_REG);
 
+	fi = file_search(fde->type, fde->id);
+	if (fi == NULL) {
+		pr_err("Failed to find shared file: type %d, id %ld, fd %d\n",
+				fde->type, fde->id, fde->fd);
+		return -1;
+	}
 
 	switch (state) {
 	case FD_STATE_PREP:
-		ret = open_transport_fd(pid, fe, fi);
+		ret = open_fd_transport(pid, fi, fde);
 		break;
 	case FD_STATE_CREATE:
-		ret = open_fd(pid, fe, fi, *fdinfo_fd);
+		ret = open_fd_and_send(pid, fi, fde);
 		break;
 	case FD_STATE_RECV:
-		ret = receive_fd(pid, fe, fi);
+		ret = receive_shared_fd(pid, fi, fde);
 		break;
 	}
 


More information about the CRIU mailing list