[CRIU] [PATCH 18/22] files: Move fanotify into files image
Pavel Emelyanov
xemul at virtuozzo.com
Fri Jun 30 14:01:47 MSK 2017
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/cr-restore.c | 4 ++--
criu/files.c | 3 +++
criu/fsnotify.c | 7 ++++++-
criu/include/image-desc.h | 2 +-
images/fdinfo.proto | 1 +
5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index abd95cb..cb47056 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,
- &fanotify_cinfo,
- &fanotify_mark_cinfo,
&ext_file_cinfo,
&file_locks_cinfo,
&pipe_data_cinfo,
@@ -285,6 +283,8 @@ static struct collect_image_info *cinfos_files[] = {
&timerfd_cinfo,
&inotify_cinfo,
&inotify_mark_cinfo,
+ &fanotify_cinfo,
+ &fanotify_mark_cinfo,
};
/* These images are requered to restore namespaces */
diff --git a/criu/files.c b/criu/files.c
index 7e79437..90eaa58 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1835,6 +1835,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__INOTIFY:
ret = collect_one_file_entry(fe, fe->ify->id, &fe->ify->base, &inotify_cinfo);
break;
+ case FD_TYPES__FANOTIFY:
+ ret = collect_one_file_entry(fe, fe->ffy->id, &fe->ffy->base, &fanotify_cinfo);
+ break;
}
return ret;
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index bd38562..54f70e6 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -422,6 +422,7 @@ static int check_one_mark(FanotifyMarkEntry *fme)
static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
{
+ FileEntry fle = FILE_ENTRY__INIT;
FanotifyFileEntry fe = FANOTIFY_FILE_ENTRY__INIT;
int ret = -1, i;
@@ -445,7 +446,11 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
pr_info("id %#08x flags %#08x\n", fe.id, fe.flags);
- ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
+ fle.type = FD_TYPES__FANOTIFY;
+ fle.id = fe.id;
+ fle.ffy = &fe;
+
+ ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fle, PB_FILE);
free:
for (i = 0; i < fe.n_mark; i++)
xfree(fe.mark[i]);
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 51227ce..06063eb 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_FANOTIFY_FILE,
CR_FD_CGROUP,
CR_FD_FILE_LOCKS,
CR_FD_SECCOMP,
@@ -106,6 +105,7 @@ enum {
CR_FD_TUNFILE,
CR_FD_TIMERFD,
CR_FD_INOTIFY_FILE,
+ CR_FD_FANOTIFY_FILE,
CR_FD_AUTOFS,
CR_FD_NS,
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index dd466a7..77328aa 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -57,4 +57,5 @@ message file_entry {
optional tunfile_entry tunf = 11;
optional timerfd_entry tfd = 12;
optional inotify_file_entry ify = 13;
+ optional fanotify_file_entry ffy = 14;
}
--
2.1.4
More information about the CRIU
mailing list