Commit fd39196d authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Move unix sk into files image

Reviewed-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 257e2e60
...@@ -257,7 +257,6 @@ static int crtools_prepare_shared(void) ...@@ -257,7 +257,6 @@ static int crtools_prepare_shared(void)
static struct collect_image_info *cinfos[] = { static struct collect_image_info *cinfos[] = {
&pipe_cinfo, &pipe_cinfo,
&fifo_cinfo, &fifo_cinfo,
&unix_sk_cinfo,
&file_locks_cinfo, &file_locks_cinfo,
&pipe_data_cinfo, &pipe_data_cinfo,
&fifo_data_cinfo, &fifo_data_cinfo,
...@@ -265,6 +264,7 @@ static struct collect_image_info *cinfos[] = { ...@@ -265,6 +264,7 @@ static struct collect_image_info *cinfos[] = {
}; };
static struct collect_image_info *cinfos_files[] = { static struct collect_image_info *cinfos_files[] = {
&unix_sk_cinfo,
&nsfile_cinfo, &nsfile_cinfo,
&packet_sk_cinfo, &packet_sk_cinfo,
&netlink_sk_cinfo, &netlink_sk_cinfo,
......
...@@ -1725,6 +1725,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -1725,6 +1725,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__EXT: case FD_TYPES__EXT:
ret = collect_one_file_entry(fe, fe->ext->id, &fe->ext->base, &ext_file_cinfo); ret = collect_one_file_entry(fe, fe->ext->id, &fe->ext->base, &ext_file_cinfo);
break; break;
case FD_TYPES__UNIXSK:
ret = collect_one_file_entry(fe, fe->usk->id, &fe->usk->base, &unix_sk_cinfo);
break;
} }
return ret; return ret;
......
...@@ -56,7 +56,6 @@ enum { ...@@ -56,7 +56,6 @@ enum {
_CR_FD_GLOB_FROM, _CR_FD_GLOB_FROM,
CR_FD_FILES, CR_FD_FILES,
CR_FD_SK_QUEUES, CR_FD_SK_QUEUES,
CR_FD_UNIXSK,
CR_FD_PIPES, CR_FD_PIPES,
CR_FD_PIPES_DATA, CR_FD_PIPES_DATA,
CR_FD_FIFO, CR_FD_FIFO,
...@@ -106,6 +105,7 @@ enum { ...@@ -106,6 +105,7 @@ enum {
CR_FD_INOTIFY_FILE, CR_FD_INOTIFY_FILE,
CR_FD_FANOTIFY_FILE, CR_FD_FANOTIFY_FILE,
CR_FD_EXT_FILES, CR_FD_EXT_FILES,
CR_FD_UNIXSK,
CR_FD_AUTOFS, CR_FD_AUTOFS,
......
...@@ -175,8 +175,13 @@ static bool unix_sk_exception_lookup_id(unsigned int ino) ...@@ -175,8 +175,13 @@ static bool unix_sk_exception_lookup_id(unsigned int ino)
static int write_unix_entry(struct unix_sk_desc *sk) static int write_unix_entry(struct unix_sk_desc *sk)
{ {
int ret; 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); show_one_unix_img("Dumped", sk->ue);
...@@ -739,6 +744,7 @@ int fix_external_unix_sockets(void) ...@@ -739,6 +744,7 @@ int fix_external_unix_sockets(void)
pr_debug("Dumping external sockets\n"); pr_debug("Dumping external sockets\n");
list_for_each_entry(sk, &unix_sockets, list) { list_for_each_entry(sk, &unix_sockets, list) {
FileEntry fe = FILE_ENTRY__INIT;
UnixSkEntry e = UNIX_SK_ENTRY__INIT; UnixSkEntry e = UNIX_SK_ENTRY__INIT;
FownEntry fown = FOWN_ENTRY__INIT; FownEntry fown = FOWN_ENTRY__INIT;
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT; SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
...@@ -760,7 +766,11 @@ int fix_external_unix_sockets(void) ...@@ -760,7 +766,11 @@ int fix_external_unix_sockets(void)
e.fown = &fown; e.fown = &fown;
e.opts = &skopts; 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; goto err;
show_one_unix_img("Dumped extern", &e); show_one_unix_img("Dumped extern", &e);
......
...@@ -12,6 +12,7 @@ import "tun.proto"; ...@@ -12,6 +12,7 @@ import "tun.proto";
import "timerfd.proto"; import "timerfd.proto";
import "fsnotify.proto"; import "fsnotify.proto";
import "ext-file.proto"; import "ext-file.proto";
import "sk-unix.proto";
enum fd_types { enum fd_types {
UND = 0; UND = 0;
...@@ -57,4 +58,5 @@ message file_entry { ...@@ -57,4 +58,5 @@ message file_entry {
optional inotify_file_entry ify = 13; optional inotify_file_entry ify = 13;
optional fanotify_file_entry ffy = 14; optional fanotify_file_entry ffy = 14;
optional ext_file_entry ext = 15; optional ext_file_entry ext = 15;
optional unix_sk_entry usk = 16;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment