[12/22] files: Move eventfd into files image

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

Details

Message ID 874e3939-dd5b-2975-6260-065dae3a03ac@virtuozzo.com
State Accepted
Series "Merge images with different files into one"
Headers show

Commit Message

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

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 653b8c0..d43152f 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,
-	&eventfd_cinfo,
 	&epoll_cinfo,
 	&epoll_tfd_cinfo,
 	&signalfd_cinfo,
@@ -285,6 +284,7 @@  static struct collect_image_info *cinfos_files[] = {
 	&nsfile_cinfo,
 	&packet_sk_cinfo,
 	&netlink_sk_cinfo,
+	&eventfd_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/eventfd.c b/criu/eventfd.c
index b3c76e3..a3facad 100644
--- a/criu/eventfd.c
+++ b/criu/eventfd.c
@@ -46,6 +46,7 @@  static void pr_info_eventfd(char *action, EventfdFileEntry *efe)
 static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	EventfdFileEntry efd = EVENTFD_FILE_ENTRY__INIT;
+	FileEntry fe = FILE_ENTRY__INIT;
 
 	if (parse_fdinfo(lfd, FD_TYPES__EVENTFD, &efd))
 		return -1;
@@ -54,9 +55,12 @@  static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p)
 	efd.flags = p->flags;
 	efd.fown = (FownEntry *)&p->fown;
 
+	fe.type = FD_TYPES__EVENTFD;
+	fe.id = efd.id;
+	fe.efd = &efd;
+
 	pr_info_eventfd("Dumping ", &efd);
-	return pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTFD_FILE),
-			&efd, PB_EVENTFD_FILE);
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
 }
 
 const struct fdtype_ops eventfd_dump_ops = {
diff --git a/criu/files.c b/criu/files.c
index aaca0d1..b5c81fe 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1817,6 +1817,9 @@  static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__NETLINKSK:
 		ret = collect_one_file_entry(fe, fe->nlsk->id, &fe->nlsk->base, &netlink_sk_cinfo);
 		break;
+	case FD_TYPES__EVENTFD:
+		ret = collect_one_file_entry(fe, fe->efd->id, &fe->efd->base, &eventfd_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 3dad32a..1822693 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -66,7 +66,6 @@  enum {
 	CR_FD_TTY_INFO,
 	CR_FD_TTY_DATA,
 	CR_FD_REMAP_FPATH,
-	CR_FD_EVENTFD_FILE,
 	CR_FD_EVENTPOLL_FILE,
 	CR_FD_SIGNALFD,
 	CR_FD_INOTIFY_FILE,
@@ -106,6 +105,7 @@  enum {
 	CR_FD_NS_FILES,
 	CR_FD_PACKETSK,
 	CR_FD_NETLINK_SK,
+	CR_FD_EVENTFD_FILE,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index cbfb3b7..41461f1 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -5,6 +5,7 @@  import "sk-inet.proto";
 import "ns.proto";
 import "packet-sock.proto";
 import "sk-netlink.proto";
+import "eventfd.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -45,4 +46,5 @@  message file_entry {
 	optional ns_file_entry		nsf	= 5;
 	optional packet_sock_entry	psk	= 6;
 	optional netlink_sk_entry	nlsk	= 7;
+	optional eventfd_file_entry	efd	= 8;
 }