[CRIU] [PATCH 4/4] dump: open global image files with global helpers

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Mar 16 06:25:54 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

Now global image files has not pid numbers in it's name.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c    |    5 +++--
 cr-restore.c |    4 ++--
 cr-show.c    |    2 +-
 sockets.c    |    2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index ef72471..cd1b839 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1434,7 +1434,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
 
 	collect_sockets();
 
-	cr_fdset = cr_dump_fdset_open(pid, CR_FD_DESC_USE(CR_FD_PSTREE), cr_fdset);
+	cr_fdset = cr_glob_fdset_open(CR_FD_DESC_PSTREE, NULL);
 	if (!cr_fdset)
 		goto err;
 	if (dump_pstree(pid, &pstree_list, cr_fdset))
@@ -1452,8 +1452,9 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
 		 * them in "global" image.
 		 * That's why we open the file with tree leader's pid for any
 		 * of it's children.
+		 * The file will be created only if it's not exist.
 		 */
-		if (!cr_dump_fdset_open(pid, CR_FD_DESC_USE(CR_FD_SK_QUEUES), cr_fdset))
+		if (!cr_glob_fdset_open(CR_FD_DESC_SK_QUEUES, cr_fdset))
 			goto err;
 
 		if (dump_one_task(item, cr_fdset))
diff --git a/cr-restore.c b/cr-restore.c
index f53f5cb..6cd8c5e 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1335,7 +1335,7 @@ static int restore_task_with_children(void *_arg)
 
 	pr_info("%d: Starting restore\n", me->pid);
 
-	fd = open_image_ro_nocheck(FMT_FNAME_PSTREE, pstree_pid);
+	fd = open_glob_image_ro_nocheck(FMT_FNAME_PSTREE);
 	if (fd < 0) {
 		pr_perror("%d: Can't reopen pstree image", me->pid);
 		exit(1);
@@ -1458,7 +1458,7 @@ static int restore_all_tasks(pid_t pid, struct cr_options *opts)
 	int pstree_fd = -1;
 	u32 type = 0;
 
-	pstree_fd = open_image_ro(CR_FD_PSTREE, pstree_pid);
+	pstree_fd = open_glob_image_ro(CR_FD_PSTREE);
 	if (pstree_fd < 0)
 		return -1;
 
diff --git a/cr-show.c b/cr-show.c
index eeb7042..2852389 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -551,7 +551,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
 	LIST_HEAD(pstree_list);
 	int i, ret = -1;
 
-	cr_fdset = cr_show_fdset_open(pid, CR_FD_DESC_PSTREE | CR_FD_DESC_SK_QUEUES);
+	cr_fdset = cr_glob_fdset_open(CR_FD_DESC_PSTREE | CR_FD_DESC_SK_QUEUES, NULL);
 	if (!cr_fdset)
 		goto out;
 
diff --git a/sockets.c b/sockets.c
index f1896fa..8bf4c15 100644
--- a/sockets.c
+++ b/sockets.c
@@ -1186,7 +1186,7 @@ err:
 	if (ret)
 		return ret;
 
-	unix_pool.img_fd = open_image_ro(CR_FD_SK_QUEUES, pstree_pid);
+	unix_pool.img_fd = open_glob_image_ro(CR_FD_SK_QUEUES);
 	if (unix_pool.img_fd < 0)
 		return -1;
 	ret = read_sockets_queues(&unix_pool);


More information about the CRIU mailing list