[CRIU] [PATCH v6 2/7] mount: Collect new type binfmt_misc.img image entries

Kirill Tkhai ktkhai at virtuozzo.com
Tue Aug 23 09:16:31 PDT 2016


v6: New
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c    |    3 +++
 criu/include/mount.h |    1 +
 criu/mount.c         |   29 +++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 6ad8253..b757413 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -141,6 +141,9 @@ static int crtools_prepare_shared(void)
 	if (collect_inet_sockets())
 		return -1;
 
+	if (collect_binfmt_misc())
+		return -1;
+
 	if (tty_prep_fds())
 		return -1;
 
diff --git a/criu/include/mount.h b/criu/include/mount.h
index a266cd0..a3833f5 100644
--- a/criu/include/mount.h
+++ b/criu/include/mount.h
@@ -90,6 +90,7 @@ struct mount_info {
 
 extern struct mount_info *mntinfo;
 extern struct ns_desc mnt_ns_desc;
+extern int collect_binfmt_misc(void);
 
 extern struct mount_info *mnt_entry_alloc();
 extern void mnt_entry_free(struct mount_info *mi);
diff --git a/criu/mount.c b/criu/mount.c
index fb05299..206a8e2 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -40,6 +40,12 @@
 #undef	LOG_PREFIX
 #define LOG_PREFIX "mnt: "
 
+struct binfmt_misc_info {
+	BinfmtMiscEntry *bme;
+	struct list_head list;
+};
+
+static LIST_HEAD(binfmt_misc_list);
 static struct fstype fstypes[];
 
 int ext_mount_add(char *key, char *val)
@@ -1537,6 +1543,29 @@ static int binfmt_misc_restore(struct mount_info *mi)
 	return ret;
 }
 
+static int collect_one_binfmt_misc_entry(void *o, ProtobufCMessage *msg, struct cr_img *img)
+{
+	struct binfmt_misc_info *bmi = o;
+
+	bmi->bme = pb_msg(msg, BinfmtMiscEntry);
+	list_add_tail(&bmi->list, &binfmt_misc_list);
+
+	return 0;
+}
+
+struct collect_image_info binfmt_misc_cinfo = {
+	.fd_type = CR_FD_BINFMT_MISC,
+	.pb_type = PB_BINFMT_MISC,
+	.priv_size = sizeof(struct binfmt_misc_info),
+	.collect = collect_one_binfmt_misc_entry,
+};
+
+int collect_binfmt_misc(void)
+{
+	return collect_image(&binfmt_misc_cinfo);
+}
+
+
 static int fusectl_dump(struct mount_info *pm)
 {
 	int fd, ret = -1;



More information about the CRIU mailing list