Commit 1564dd4e authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Move ns files 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 55519df9
...@@ -255,7 +255,6 @@ static int crtools_prepare_shared(void) ...@@ -255,7 +255,6 @@ static int crtools_prepare_shared(void)
*/ */
static struct collect_image_info *cinfos[] = { static struct collect_image_info *cinfos[] = {
&nsfile_cinfo,
&pipe_cinfo, &pipe_cinfo,
&fifo_cinfo, &fifo_cinfo,
&unix_sk_cinfo, &unix_sk_cinfo,
...@@ -279,6 +278,7 @@ static struct collect_image_info *cinfos[] = { ...@@ -279,6 +278,7 @@ static struct collect_image_info *cinfos[] = {
}; };
static struct collect_image_info *cinfos_files[] = { static struct collect_image_info *cinfos_files[] = {
&nsfile_cinfo,
}; };
/* These images are requered to restore namespaces */ /* These images are requered to restore namespaces */
......
...@@ -1691,6 +1691,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -1691,6 +1691,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__INETSK: case FD_TYPES__INETSK:
ret = collect_one_file_entry(fe, fe->isk->id, &fe->isk->base, &inet_sk_cinfo); ret = collect_one_file_entry(fe, fe->isk->id, &fe->isk->base, &inet_sk_cinfo);
break; break;
case FD_TYPES__NS:
ret = collect_one_file_entry(fe, fe->nsf->id, &fe->nsf->base, &nsfile_cinfo);
break;
} }
return ret; return ret;
......
...@@ -57,7 +57,6 @@ enum { ...@@ -57,7 +57,6 @@ enum {
CR_FD_FILES, CR_FD_FILES,
CR_FD_SK_QUEUES, CR_FD_SK_QUEUES,
CR_FD_EXT_FILES, CR_FD_EXT_FILES,
CR_FD_NS_FILES,
CR_FD_UNIXSK, CR_FD_UNIXSK,
CR_FD_PACKETSK, CR_FD_PACKETSK,
CR_FD_NETLINK_SK, CR_FD_NETLINK_SK,
...@@ -106,6 +105,7 @@ enum { ...@@ -106,6 +105,7 @@ enum {
CR_FD_EVENTPOLL_TFD, CR_FD_EVENTPOLL_TFD,
CR_FD_REG_FILES, CR_FD_REG_FILES,
CR_FD_INETSK, CR_FD_INETSK,
CR_FD_NS_FILES,
CR_FD_AUTOFS, CR_FD_AUTOFS,
......
...@@ -464,7 +464,8 @@ static unsigned int get_ns_id(int pid, struct ns_desc *nd, protobuf_c_boolean *s ...@@ -464,7 +464,8 @@ static unsigned int get_ns_id(int pid, struct ns_desc *nd, protobuf_c_boolean *s
int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p) int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p)
{ {
struct cr_img *img = img_from_set(glob_imgset, CR_FD_NS_FILES); struct cr_img *img;
FileEntry fe = FILE_ENTRY__INIT;
NsFileEntry nfe = NS_FILE_ENTRY__INIT; NsFileEntry nfe = NS_FILE_ENTRY__INIT;
struct fd_link *link = p->link; struct fd_link *link = p->link;
struct ns_id *nsid; struct ns_id *nsid;
...@@ -480,7 +481,12 @@ int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p) ...@@ -480,7 +481,12 @@ int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p)
nfe.ns_cflag = link->ns_d->cflag; nfe.ns_cflag = link->ns_d->cflag;
nfe.flags = p->flags; nfe.flags = p->flags;
return pb_write_one(img, &nfe, PB_NS_FILE); fe.type = FD_TYPES__NS;
fe.id = nfe.id;
fe.nsf = &nfe;
img = img_from_set(glob_imgset, CR_FD_FILES);
return pb_write_one(img, &fe, PB_FILE);
} }
const struct fdtype_ops nsfile_dump_ops = { const struct fdtype_ops nsfile_dump_ops = {
......
...@@ -2,6 +2,7 @@ syntax = "proto2"; ...@@ -2,6 +2,7 @@ syntax = "proto2";
import "regfile.proto"; import "regfile.proto";
import "sk-inet.proto"; import "sk-inet.proto";
import "ns.proto";
enum fd_types { enum fd_types {
UND = 0; UND = 0;
...@@ -36,4 +37,5 @@ message file_entry { ...@@ -36,4 +37,5 @@ message file_entry {
required uint32 id = 2; required uint32 id = 2;
optional reg_file_entry reg = 3; optional reg_file_entry reg = 3;
optional inet_sk_entry isk = 4; optional inet_sk_entry isk = 4;
optional ns_file_entry nsf = 5;
} }
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