[CRIU] [PATCH 21/22] files: Move fifo into files image

Pavel Emelyanov xemul at virtuozzo.com
Fri Jun 30 14:02:38 MSK 2017


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-restore.c         | 2 +-
 criu/fifo.c               | 9 +++++++--
 criu/files.c              | 3 +++
 criu/include/image-desc.h | 2 +-
 images/fdinfo.proto       | 2 ++
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index ee46fd4..5535a4d 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -262,7 +262,6 @@ static int crtools_prepare_shared(void)
 
 static struct collect_image_info *cinfos[] = {
 	&pipe_cinfo,
-	&fifo_cinfo,
 	&file_locks_cinfo,
 	&pipe_data_cinfo,
 	&fifo_data_cinfo,
@@ -271,6 +270,7 @@ static struct collect_image_info *cinfos[] = {
 
 static struct collect_image_info *cinfos_files[] = {
 	&unix_sk_cinfo,
+	&fifo_cinfo,
 	&nsfile_cinfo,
 	&packet_sk_cinfo,
 	&netlink_sk_cinfo,
diff --git a/criu/fifo.c b/criu/fifo.c
index 238acec..d0728e1 100644
--- a/criu/fifo.c
+++ b/criu/fifo.c
@@ -40,7 +40,8 @@ static struct pipe_data_dump pd_fifo = { .img_type = CR_FD_FIFO_DATA, };
 
 static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
 {
-	struct cr_img *img = img_from_set(glob_imgset, CR_FD_FIFO);
+	struct cr_img *img = img_from_set(glob_imgset, CR_FD_FILES);
+	FileEntry fe = FILE_ENTRY__INIT;
 	FifoEntry e = FIFO_ENTRY__INIT;
 
 	/*
@@ -57,7 +58,11 @@ static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
 	e.id		= id;
 	e.pipe_id	= pipe_id(p);
 
-	if (pb_write_one(img, &e, PB_FIFO))
+	fe.type = FD_TYPES__FIFO;
+	fe.id = e.id;
+	fe.fifo = &e;
+
+	if (pb_write_one(img, &fe, PB_FILE))
 		return -1;
 
 	return dump_one_pipe_data(&pd_fifo, lfd, p);
diff --git a/criu/files.c b/criu/files.c
index 1a65003..76a2ddc 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1844,6 +1844,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__UNIXSK:
 		ret = collect_one_file_entry(fe, fe->usk->id, &fe->usk->base, &unix_sk_cinfo);
 		break;
+	case FD_TYPES__FIFO:
+		ret = collect_one_file_entry(fe, fe->fifo->id, &fe->fifo->base, &fifo_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 85e6818..0df3592 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -58,7 +58,6 @@ enum {
 	CR_FD_SK_QUEUES,
 	CR_FD_PIPES,
 	CR_FD_PIPES_DATA,
-	CR_FD_FIFO,
 	CR_FD_FIFO_DATA,
 	CR_FD_TTY_FILES,
 	CR_FD_TTY_INFO,
@@ -106,6 +105,7 @@ enum {
 	CR_FD_FANOTIFY_FILE,
 	CR_FD_EXT_FILES,
 	CR_FD_UNIXSK,
+	CR_FD_FIFO,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 38b69b2..53bb5fc 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -13,6 +13,7 @@ import "timerfd.proto";
 import "fsnotify.proto";
 import "ext-file.proto";
 import "sk-unix.proto";
+import "fifo.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -62,4 +63,5 @@ message file_entry {
 	optional fanotify_file_entry	ffy	= 14;
 	optional ext_file_entry		ext	= 15;
 	optional unix_sk_entry		usk	= 16;
+	optional fifo_entry		fifo	= 17;
 }
-- 
2.1.4



More information about the CRIU mailing list