[19/22] files: Move ext files into files image

Submitted by Pavel Emelianov on June 30, 2017, 11:02 a.m.

Details

Message ID d0c443b5-f877-1801-a547-1684c24b4c3c@virtuozzo.com
State Accepted
Series "Merge images with different files into one"
Headers show

Commit Message

Pavel Emelianov June 30, 2017, 11:02 a.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/cr-restore.c         |  2 +-
 criu/files-ext.c          | 10 +++++++---
 criu/files.c              |  3 +++
 criu/include/image-desc.h |  2 +-
 images/fdinfo.proto       |  2 ++
 5 files changed, 14 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index cb47056..7850c1c 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -264,7 +264,6 @@  static struct collect_image_info *cinfos[] = {
 	&pipe_cinfo,
 	&fifo_cinfo,
 	&unix_sk_cinfo,
-	&ext_file_cinfo,
 	&file_locks_cinfo,
 	&pipe_data_cinfo,
 	&fifo_data_cinfo,
@@ -285,6 +284,7 @@  static struct collect_image_info *cinfos_files[] = {
 	&inotify_mark_cinfo,
 	&fanotify_cinfo,
 	&fanotify_mark_cinfo,
+	&ext_file_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/files-ext.c b/criu/files-ext.c
index df23ec6..af9c268 100644
--- a/criu/files-ext.c
+++ b/criu/files-ext.c
@@ -13,7 +13,7 @@  static int dump_one_ext_file(int lfd, u32 id, const struct fd_parms *p)
 {
 	int ret;
 	struct cr_img *rimg;
-
+	FileEntry fe = FILE_ENTRY__INIT;
 	ExtFileEntry xfe = EXT_FILE_ENTRY__INIT;
 
 	ret = run_plugins(DUMP_EXT_FILE, lfd, id);
@@ -23,8 +23,12 @@  static int dump_one_ext_file(int lfd, u32 id, const struct fd_parms *p)
 	xfe.id		= id;
 	xfe.fown	= (FownEntry *)&p->fown;
 
-	rimg = img_from_set(glob_imgset, CR_FD_EXT_FILES);
-	return pb_write_one(rimg, &xfe, PB_EXT_FILE);
+	fe.type = FD_TYPES__EXT;
+	fe.id = xfe.id;
+	fe.ext = &xfe;
+
+	rimg = img_from_set(glob_imgset, CR_FD_FILES);
+	return pb_write_one(rimg, &fe, PB_FILE);
 }
 
 const struct fdtype_ops ext_dump_ops = {
diff --git a/criu/files.c b/criu/files.c
index 90eaa58..cbac743 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1838,6 +1838,9 @@  static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__FANOTIFY:
 		ret = collect_one_file_entry(fe, fe->ffy->id, &fe->ffy->base, &fanotify_cinfo);
 		break;
+	case FD_TYPES__EXT:
+		ret = collect_one_file_entry(fe, fe->ext->id, &fe->ext->base, &ext_file_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 06063eb..c5c860b 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -56,7 +56,6 @@  enum {
 	_CR_FD_GLOB_FROM,
 	CR_FD_FILES,
 	CR_FD_SK_QUEUES,
-	CR_FD_EXT_FILES,
 	CR_FD_UNIXSK,
 	CR_FD_PIPES,
 	CR_FD_PIPES_DATA,
@@ -106,6 +105,7 @@  enum {
 	CR_FD_TIMERFD,
 	CR_FD_INOTIFY_FILE,
 	CR_FD_FANOTIFY_FILE,
+	CR_FD_EXT_FILES,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 77328aa..d05151c 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -11,6 +11,7 @@  import "signalfd.proto";
 import "tun.proto";
 import "timerfd.proto";
 import "fsnotify.proto";
+import "ext-file.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -58,4 +59,5 @@  message file_entry {
 	optional timerfd_entry		tfd	= 12;
 	optional inotify_file_entry	ify	= 13;
 	optional fanotify_file_entry	ffy	= 14;
+	optional ext_file_entry		ext	= 15;
 }