[16/22] files: Move timerfd into files image

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

Details

Message ID f355493c-c8ff-929b-9cc6-7336e6fd9dc8@virtuozzo.com
State Accepted
Series "Merge images with different files into one"
Headers show

Commit Message

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

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 24eb578..3f1fc9c 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -269,7 +269,6 @@  static struct collect_image_info *cinfos[] = {
 	&fanotify_cinfo,
 	&fanotify_mark_cinfo,
 	&ext_file_cinfo,
-	&timerfd_cinfo,
 	&file_locks_cinfo,
 	&pipe_data_cinfo,
 	&fifo_data_cinfo,
@@ -285,6 +284,7 @@  static struct collect_image_info *cinfos_files[] = {
 	&epoll_tfd_cinfo,
 	&signalfd_cinfo,
 	&tunfile_cinfo,
+	&timerfd_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/files.c b/criu/files.c
index 0dc43fa..e9f2b2c 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1829,6 +1829,9 @@  static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__TUNF:
 		ret = collect_one_file_entry(fe, fe->tunf->id, &fe->tunf->base, &tunfile_cinfo);
 		break;
+	case FD_TYPES__TIMERFD:
+		ret = collect_one_file_entry(fe, fe->tfd->id, &fe->tfd->base, &timerfd_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 4a3523e..976cd27 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -69,7 +69,6 @@  enum {
 	CR_FD_INOTIFY_FILE,
 	CR_FD_FANOTIFY_FILE,
 	CR_FD_CGROUP,
-	CR_FD_TIMERFD,
 	CR_FD_FILE_LOCKS,
 	CR_FD_SECCOMP,
 	_CR_FD_GLOB_TO,
@@ -106,6 +105,7 @@  enum {
 	CR_FD_EVENTPOLL_FILE,
 	CR_FD_SIGNALFD,
 	CR_FD_TUNFILE,
+	CR_FD_TIMERFD,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/criu/timerfd.c b/criu/timerfd.c
index aa2aae1..b5ee5d8 100644
--- a/criu/timerfd.c
+++ b/criu/timerfd.c
@@ -67,6 +67,7 @@  int is_timerfd_link(char *link)
 static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	TimerfdEntry tfe = TIMERFD_ENTRY__INIT;
+	FileEntry fe = FILE_ENTRY__INIT;
 
 	if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, &tfe))
 		return -1;
@@ -78,7 +79,11 @@  static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
 		tfe.id, tfe.clockid, (unsigned long long)tfe.vsec, (unsigned long long)tfe.vnsec,
 		(unsigned long long)tfe.isec, (unsigned long long)tfe.insec);
 
-	return pb_write_one(img_from_set(glob_imgset, CR_FD_TIMERFD), &tfe, PB_TIMERFD);
+	fe.type = FD_TYPES__TIMERFD;
+	fe.id = tfe.id;
+	fe.tfd = &tfe;
+
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
 }
 
 const struct fdtype_ops timerfd_dump_ops = {
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index e0caa67..2993009 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -9,6 +9,7 @@  import "eventfd.proto";
 import "eventpoll.proto";
 import "signalfd.proto";
 import "tun.proto";
+import "timerfd.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -53,4 +54,5 @@  message file_entry {
 	optional eventpoll_file_entry	epfd	= 9;
 	optional signalfd_entry		sgfd	= 10;
 	optional tunfile_entry		tunf	= 11;
+	optional timerfd_entry		tfd	= 12;
 }