[CRIU] [PATCH 15/22] files: Move tunfile into files image
Pavel Emelyanov
xemul at virtuozzo.com
Fri Jun 30 14:00:58 MSK 2017
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/cr-restore.c | 2 +-
criu/files.c | 3 +++
criu/include/image-desc.h | 2 +-
criu/tun.c | 9 +++++++--
images/fdinfo.proto | 2 ++
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index f637ba2..24eb578 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -268,7 +268,6 @@ static struct collect_image_info *cinfos[] = {
&inotify_mark_cinfo,
&fanotify_cinfo,
&fanotify_mark_cinfo,
- &tunfile_cinfo,
&ext_file_cinfo,
&timerfd_cinfo,
&file_locks_cinfo,
@@ -285,6 +284,7 @@ static struct collect_image_info *cinfos_files[] = {
&epoll_cinfo,
&epoll_tfd_cinfo,
&signalfd_cinfo,
+ &tunfile_cinfo,
};
/* These images are requered to restore namespaces */
diff --git a/criu/files.c b/criu/files.c
index 2d5ec5e..0dc43fa 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1826,6 +1826,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__SIGNALFD:
ret = collect_one_file_entry(fe, fe->sgfd->id, &fe->sgfd->base, &signalfd_cinfo);
break;
+ case FD_TYPES__TUNF:
+ ret = collect_one_file_entry(fe, fe->tunf->id, &fe->tunf->base, &tunfile_cinfo);
+ break;
}
return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index 0b9ad00..4a3523e 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -68,7 +68,6 @@ enum {
CR_FD_REMAP_FPATH,
CR_FD_INOTIFY_FILE,
CR_FD_FANOTIFY_FILE,
- CR_FD_TUNFILE,
CR_FD_CGROUP,
CR_FD_TIMERFD,
CR_FD_FILE_LOCKS,
@@ -106,6 +105,7 @@ enum {
CR_FD_EVENTFD_FILE,
CR_FD_EVENTPOLL_FILE,
CR_FD_SIGNALFD,
+ CR_FD_TUNFILE,
CR_FD_AUTOFS,
CR_FD_NS,
diff --git a/criu/tun.c b/criu/tun.c
index 3b93bb95..acd40ea 100644
--- a/criu/tun.c
+++ b/criu/tun.c
@@ -268,6 +268,7 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
{
int ret;
struct cr_img *img;
+ FileEntry fe = FILE_ENTRY__INIT;
TunfileEntry tfe = TUNFILE_ENTRY__INIT;
struct ifreq ifr;
@@ -306,8 +307,12 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
return -1;
}
- img = img_from_set(glob_imgset, CR_FD_TUNFILE);
- return pb_write_one(img, &tfe, PB_TUNFILE);
+ fe.type = FD_TYPES__TUNF;
+ fe.id = tfe.id;
+ fe.tunf = &tfe;
+
+ img = img_from_set(glob_imgset, CR_FD_FILES);
+ return pb_write_one(img, &fe, PB_FILE);
}
const struct fdtype_ops tunfile_dump_ops = {
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 89b7e3b..e0caa67 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -8,6 +8,7 @@ import "sk-netlink.proto";
import "eventfd.proto";
import "eventpoll.proto";
import "signalfd.proto";
+import "tun.proto";
enum fd_types {
UND = 0;
@@ -51,4 +52,5 @@ message file_entry {
optional eventfd_file_entry efd = 8;
optional eventpoll_file_entry epfd = 9;
optional signalfd_entry sgfd = 10;
+ optional tunfile_entry tunf = 11;
}
--
2.1.4
More information about the CRIU
mailing list