[CRIU] [PATCH 05/22] file: Introduce prepare_files()

Pavel Emelyanov xemul at virtuozzo.com
Fri Jun 30 13:57:06 MSK 2017


I'm about to merge all the file images into one big image,
so here's the place that would read it and collect.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-restore.c    |  2 +-
 criu/files.c         | 10 +++++++---
 criu/include/files.h |  2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 2c505f6..e6c1cac 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -228,7 +228,7 @@ static int restore_finish_ns_stage(int from, int to)
 
 static int crtools_prepare_shared(void)
 {
-	if (prepare_shared_fdinfo())
+	if (prepare_files())
 		return -1;
 
 	/* We might want to remove ghost files on failed restore */
diff --git a/criu/files.c b/criu/files.c
index a36eb36..b83901f 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -56,14 +56,12 @@ static struct hlist_head file_desc_hash[FDESC_HASH_SIZE];
 /* file_desc's, which fle is not owned by a process, that is able to open them */
 static LIST_HEAD(fake_master_head);
 
-int prepare_shared_fdinfo(void)
+static void init_fdesc_hash(void)
 {
 	int i;
 
 	for (i = 0; i < FDESC_HASH_SIZE; i++)
 		INIT_HLIST_HEAD(&file_desc_hash[i]);
-
-	return 0;
 }
 
 void file_desc_init(struct file_desc *d, u32 id, struct file_desc_ops *ops)
@@ -1781,3 +1779,9 @@ err:
 	pr_err("Can't prepare fds masters\n");
 	return -1;
 }
+
+int prepare_files(void)
+{
+	init_fdesc_hash();
+	return 0;
+}
diff --git a/criu/include/files.h b/criu/include/files.h
index 6f65182..c19f10d 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -155,7 +155,7 @@ extern int add_fake_fds_masters(void);
 extern int prepare_fds(struct pstree_item *me);
 extern int prepare_fd_pid(struct pstree_item *me);
 extern int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id);
-extern int prepare_shared_fdinfo(void);
+extern int prepare_files(void);
 extern int restore_fs(struct pstree_item *);
 extern int prepare_fs_pid(struct pstree_item *);
 extern int set_fd_flags(int fd, int flags);
-- 
2.1.4



More information about the CRIU mailing list