[13/22] files: Move epoll into files image

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

Details

Message ID 80528709-f020-6f34-0e84-5ff33c65a79c@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         | 4 ++--
 criu/eventpoll.c          | 8 ++++++--
 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 d43152f..4fd30f8 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -264,8 +264,6 @@  static struct collect_image_info *cinfos[] = {
 	&pipe_cinfo,
 	&fifo_cinfo,
 	&unix_sk_cinfo,
-	&epoll_cinfo,
-	&epoll_tfd_cinfo,
 	&signalfd_cinfo,
 	&inotify_cinfo,
 	&inotify_mark_cinfo,
@@ -285,6 +283,8 @@  static struct collect_image_info *cinfos_files[] = {
 	&packet_sk_cinfo,
 	&netlink_sk_cinfo,
 	&eventfd_cinfo,
+	&epoll_cinfo,
+	&epoll_tfd_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/eventpoll.c b/criu/eventpoll.c
index b58e068..f0265ce 100644
--- a/criu/eventpoll.c
+++ b/criu/eventpoll.c
@@ -53,6 +53,7 @@  static void pr_info_eventpoll(char *action, EventpollFileEntry *e)
 
 static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
 {
+	FileEntry fe = FILE_ENTRY__INIT;
 	EventpollFileEntry e = EVENTPOLL_FILE_ENTRY__INIT;
 	int i, ret = -1;
 
@@ -63,9 +64,12 @@  static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
 	if (parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, &e))
 		goto out;
 
+	fe.type = FD_TYPES__EVENTPOLL;
+	fe.id = e.id;
+	fe.epfd = &e;
+
 	pr_info_eventpoll("Dumping ", &e);
-	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTPOLL_FILE),
-		     &e, PB_EVENTPOLL_FILE);
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
 out:
 	for (i = 0; i < e.n_tfd; i++) {
 		if (!ret)
diff --git a/criu/files.c b/criu/files.c
index b5c81fe..fee032c 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1820,6 +1820,9 @@  static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__EVENTFD:
 		ret = collect_one_file_entry(fe, fe->efd->id, &fe->efd->base, &eventfd_cinfo);
 		break;
+	case FD_TYPES__EVENTPOLL:
+		ret = collect_one_file_entry(fe, fe->epfd->id, &fe->epfd->base, &epoll_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 1822693..bd18050 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_EVENTPOLL_FILE,
 	CR_FD_SIGNALFD,
 	CR_FD_INOTIFY_FILE,
 	CR_FD_FANOTIFY_FILE,
@@ -106,6 +105,7 @@  enum {
 	CR_FD_PACKETSK,
 	CR_FD_NETLINK_SK,
 	CR_FD_EVENTFD_FILE,
+	CR_FD_EVENTPOLL_FILE,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 41461f1..011c55c 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -6,6 +6,7 @@  import "ns.proto";
 import "packet-sock.proto";
 import "sk-netlink.proto";
 import "eventfd.proto";
+import "eventpoll.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -47,4 +48,5 @@  message file_entry {
 	optional packet_sock_entry	psk	= 6;
 	optional netlink_sk_entry	nlsk	= 7;
 	optional eventfd_file_entry	efd	= 8;
+	optional eventpoll_file_entry	epfd	= 9;
 }