mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 20:42:49 +00:00
files: Move inet sockets into files image
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
bee9eacad4
commit
55519df9f1
6 changed files with 14 additions and 9 deletions
|
|
@ -230,7 +230,7 @@ static int crtools_prepare_shared(void)
|
|||
return -1;
|
||||
|
||||
/* Connections are unlocked from criu */
|
||||
if (collect_inet_sockets())
|
||||
if (!files_collected() && collect_image(&inet_sk_cinfo))
|
||||
return -1;
|
||||
|
||||
if (collect_binfmt_misc())
|
||||
|
|
|
|||
|
|
@ -1688,6 +1688,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
|
|||
case FD_TYPES__REG:
|
||||
ret = collect_one_file_entry(fe, fe->reg->id, &fe->reg->base, ®_file_cinfo);
|
||||
break;
|
||||
case FD_TYPES__INETSK:
|
||||
ret = collect_one_file_entry(fe, fe->isk->id, &fe->isk->base, &inet_sk_cinfo);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ enum {
|
|||
CR_FD_SK_QUEUES,
|
||||
CR_FD_EXT_FILES,
|
||||
CR_FD_NS_FILES,
|
||||
CR_FD_INETSK,
|
||||
CR_FD_UNIXSK,
|
||||
CR_FD_PACKETSK,
|
||||
CR_FD_NETLINK_SK,
|
||||
|
|
@ -106,6 +105,7 @@ enum {
|
|||
CR_FD_FANOTIFY_MARK,
|
||||
CR_FD_EVENTPOLL_TFD,
|
||||
CR_FD_REG_FILES,
|
||||
CR_FD_INETSK,
|
||||
|
||||
CR_FD_AUTOFS,
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ extern bool socket_test_collect_bit(unsigned int family, unsigned int proto);
|
|||
extern int sk_collect_one(unsigned ino, int family, struct socket_desc *d);
|
||||
struct ns_id;
|
||||
extern int collect_sockets(struct ns_id *);
|
||||
extern int collect_inet_sockets(void);
|
||||
extern struct collect_image_info inet_sk_cinfo;
|
||||
extern struct collect_image_info unix_sk_cinfo;
|
||||
extern int fix_external_unix_sockets(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ static bool needs_scope_id(uint32_t *src_addr)
|
|||
static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int family)
|
||||
{
|
||||
struct inet_sk_desc *sk;
|
||||
FileEntry fe = FILE_ENTRY__INIT;
|
||||
InetSkEntry ie = INET_SK_ENTRY__INIT;
|
||||
IpOptsEntry ipopts = IP_OPTS_ENTRY__INIT;
|
||||
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
|
||||
|
|
@ -419,7 +420,11 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
|
|||
|
||||
ie.state = sk->state;
|
||||
|
||||
if (pb_write_one(img_from_set(glob_imgset, CR_FD_INETSK), &ie, PB_INET_SK))
|
||||
fe.type = FD_TYPES__INETSK;
|
||||
fe.id = ie.id;
|
||||
fe.isk = &ie;
|
||||
|
||||
if (pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE))
|
||||
goto err;
|
||||
err:
|
||||
release_skopts(&skopts);
|
||||
|
|
@ -522,11 +527,6 @@ struct collect_image_info inet_sk_cinfo = {
|
|||
.collect = collect_one_inetsk,
|
||||
};
|
||||
|
||||
int collect_inet_sockets(void)
|
||||
{
|
||||
return collect_image(&inet_sk_cinfo);
|
||||
}
|
||||
|
||||
static int inet_validate_address(InetSkEntry *ie)
|
||||
{
|
||||
if ((ie->family == AF_INET) &&
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
syntax = "proto2";
|
||||
|
||||
import "regfile.proto";
|
||||
import "sk-inet.proto";
|
||||
|
||||
enum fd_types {
|
||||
UND = 0;
|
||||
|
|
@ -34,4 +35,5 @@ message file_entry {
|
|||
required fd_types type = 1;
|
||||
required uint32 id = 2;
|
||||
optional reg_file_entry reg = 3;
|
||||
optional inet_sk_entry isk = 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue