[CRIU] [PATCH 20/22] files: Move unix sk into files image
Pavel Emelyanov
xemul at virtuozzo.com
Fri Jun 30 14:02:20 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/sk-unix.c | 14 ++++++++++++--
images/fdinfo.proto | 2 ++
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 7850c1c..ee46fd4 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -263,7 +263,6 @@ static int crtools_prepare_shared(void)
static struct collect_image_info *cinfos[] = {
&pipe_cinfo,
&fifo_cinfo,
- &unix_sk_cinfo,
&file_locks_cinfo,
&pipe_data_cinfo,
&fifo_data_cinfo,
@@ -271,6 +270,7 @@ static struct collect_image_info *cinfos[] = {
};
static struct collect_image_info *cinfos_files[] = {
+ &unix_sk_cinfo,
&nsfile_cinfo,
&packet_sk_cinfo,
&netlink_sk_cinfo,
diff --git a/criu/files.c b/criu/files.c
index cbac743..1a65003 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1841,6 +1841,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__EXT:
ret = collect_one_file_entry(fe, fe->ext->id, &fe->ext->base, &ext_file_cinfo);
break;
+ case FD_TYPES__UNIXSK:
+ ret = collect_one_file_entry(fe, fe->usk->id, &fe->usk->base, &unix_sk_cinfo);
+ break;
}
return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index c5c860b..85e6818 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -56,7 +56,6 @@ enum {
_CR_FD_GLOB_FROM,
CR_FD_FILES,
CR_FD_SK_QUEUES,
- CR_FD_UNIXSK,
CR_FD_PIPES,
CR_FD_PIPES_DATA,
CR_FD_FIFO,
@@ -106,6 +105,7 @@ enum {
CR_FD_INOTIFY_FILE,
CR_FD_FANOTIFY_FILE,
CR_FD_EXT_FILES,
+ CR_FD_UNIXSK,
CR_FD_AUTOFS,
CR_FD_NS,
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 69c1d14..765d9ae 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -176,8 +176,13 @@ static bool unix_sk_exception_lookup_id(unsigned int ino)
static int write_unix_entry(struct unix_sk_desc *sk)
{
int ret;
+ FileEntry fe = FILE_ENTRY__INIT;
- ret = pb_write_one(img_from_set(glob_imgset, CR_FD_UNIXSK), sk->ue, PB_UNIX_SK);
+ fe.type = FD_TYPES__UNIXSK;
+ fe.id = sk->ue->id;
+ fe.usk = sk->ue;
+
+ ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
show_one_unix_img("Dumped", sk->ue);
@@ -742,6 +747,7 @@ int fix_external_unix_sockets(void)
pr_debug("Dumping external sockets\n");
list_for_each_entry(sk, &unix_sockets, list) {
+ FileEntry fe = FILE_ENTRY__INIT;
UnixSkEntry e = UNIX_SK_ENTRY__INIT;
FownEntry fown = FOWN_ENTRY__INIT;
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
@@ -763,7 +769,11 @@ int fix_external_unix_sockets(void)
e.fown = &fown;
e.opts = &skopts;
- if (pb_write_one(img_from_set(glob_imgset, CR_FD_UNIXSK), &e, PB_UNIX_SK))
+ fe.type = FD_TYPES__UNIXSK;
+ fe.id = e.id;
+ fe.usk = &e;
+
+ if (pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE))
goto err;
show_one_unix_img("Dumped extern", &e);
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index d05151c..38b69b2 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -12,6 +12,7 @@ import "tun.proto";
import "timerfd.proto";
import "fsnotify.proto";
import "ext-file.proto";
+import "sk-unix.proto";
enum fd_types {
UND = 0;
@@ -60,4 +61,5 @@ message file_entry {
optional inotify_file_entry ify = 13;
optional fanotify_file_entry ffy = 14;
optional ext_file_entry ext = 15;
+ optional unix_sk_entry usk = 16;
}
--
2.1.4
More information about the CRIU
mailing list