[17/22] files: Move inotify into files image

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

Details

Message ID c67fa7b6-dea3-53d5-f68b-2fc0c429e19c@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         | 4 ++--
 criu/files.c              | 3 +++
 criu/fsnotify.c           | 7 ++++++-
 criu/include/image-desc.h | 2 +-
 images/fdinfo.proto       | 2 ++
 5 files changed, 14 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 3f1fc9c..abd95cb 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,
-	&inotify_cinfo,
-	&inotify_mark_cinfo,
 	&fanotify_cinfo,
 	&fanotify_mark_cinfo,
 	&ext_file_cinfo,
@@ -285,6 +283,8 @@  static struct collect_image_info *cinfos_files[] = {
 	&signalfd_cinfo,
 	&tunfile_cinfo,
 	&timerfd_cinfo,
+	&inotify_cinfo,
+	&inotify_mark_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/files.c b/criu/files.c
index e9f2b2c..7e79437 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1832,6 +1832,9 @@  static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__TIMERFD:
 		ret = collect_one_file_entry(fe, fe->tfd->id, &fe->tfd->base, &timerfd_cinfo);
 		break;
+	case FD_TYPES__INOTIFY:
+		ret = collect_one_file_entry(fe, fe->ify->id, &fe->ify->base, &inotify_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index 6ceafaa..bd38562 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -317,6 +317,7 @@  static int check_one_wd(InotifyWdEntry *we)
 
 static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
 {
+	FileEntry fe = FILE_ENTRY__INIT;
 	InotifyFileEntry ie = INOTIFY_FILE_ENTRY__INIT;
 	int exit_code = -1, i, ret;
 
@@ -337,8 +338,12 @@  static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
 		if (check_one_wd(ie.wd[i]))
 			goto free;
 
+	fe.type = FD_TYPES__INOTIFY;
+	fe.id = ie.id;
+	fe.ify = &ie;
+
 	pr_info("id %#08x flags %#08x\n", ie.id, ie.flags);
-	if (pb_write_one(img_from_set(glob_imgset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE))
+	if (pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE))
 		goto free;
 
 	exit_code = 0;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 976cd27..51227ce 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_INOTIFY_FILE,
 	CR_FD_FANOTIFY_FILE,
 	CR_FD_CGROUP,
 	CR_FD_FILE_LOCKS,
@@ -106,6 +105,7 @@  enum {
 	CR_FD_SIGNALFD,
 	CR_FD_TUNFILE,
 	CR_FD_TIMERFD,
+	CR_FD_INOTIFY_FILE,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 2993009..dd466a7 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -10,6 +10,7 @@  import "eventpoll.proto";
 import "signalfd.proto";
 import "tun.proto";
 import "timerfd.proto";
+import "fsnotify.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -55,4 +56,5 @@  message file_entry {
 	optional signalfd_entry		sgfd	= 10;
 	optional tunfile_entry		tunf	= 11;
 	optional timerfd_entry		tfd	= 12;
+	optional inotify_file_entry	ify	= 13;
 }