Commit 52bf8c4a authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Move packet sock 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 1564dd4e
...@@ -258,7 +258,6 @@ static struct collect_image_info *cinfos[] = { ...@@ -258,7 +258,6 @@ static struct collect_image_info *cinfos[] = {
&pipe_cinfo, &pipe_cinfo,
&fifo_cinfo, &fifo_cinfo,
&unix_sk_cinfo, &unix_sk_cinfo,
&packet_sk_cinfo,
&netlink_sk_cinfo, &netlink_sk_cinfo,
&eventfd_cinfo, &eventfd_cinfo,
&epoll_cinfo, &epoll_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, &nsfile_cinfo,
&packet_sk_cinfo,
}; };
/* These images are requered to restore namespaces */ /* These images are requered to restore namespaces */
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "eventfd.h" #include "eventfd.h"
#include "eventpoll.h" #include "eventpoll.h"
#include "fsnotify.h" #include "fsnotify.h"
#include "sk-packet.h"
#include "mount.h" #include "mount.h"
#include "signalfd.h" #include "signalfd.h"
#include "namespaces.h" #include "namespaces.h"
...@@ -1694,6 +1695,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -1694,6 +1695,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__NS: case FD_TYPES__NS:
ret = collect_one_file_entry(fe, fe->nsf->id, &fe->nsf->base, &nsfile_cinfo); ret = collect_one_file_entry(fe, fe->nsf->id, &fe->nsf->base, &nsfile_cinfo);
break; break;
case FD_TYPES__PACKETSK:
ret = collect_one_file_entry(fe, fe->psk->id, &fe->psk->base, &packet_sk_cinfo);
break;
} }
return ret; return ret;
......
...@@ -58,7 +58,6 @@ enum { ...@@ -58,7 +58,6 @@ enum {
CR_FD_SK_QUEUES, CR_FD_SK_QUEUES,
CR_FD_EXT_FILES, CR_FD_EXT_FILES,
CR_FD_UNIXSK, CR_FD_UNIXSK,
CR_FD_PACKETSK,
CR_FD_NETLINK_SK, CR_FD_NETLINK_SK,
CR_FD_PIPES, CR_FD_PIPES,
CR_FD_PIPES_DATA, CR_FD_PIPES_DATA,
...@@ -106,6 +105,7 @@ enum { ...@@ -106,6 +105,7 @@ enum {
CR_FD_REG_FILES, CR_FD_REG_FILES,
CR_FD_INETSK, CR_FD_INETSK,
CR_FD_NS_FILES, CR_FD_NS_FILES,
CR_FD_PACKETSK,
CR_FD_AUTOFS, CR_FD_AUTOFS,
......
...@@ -146,6 +146,7 @@ static int dump_rings(PacketSockEntry *psk, struct packet_sock_desc *sd) ...@@ -146,6 +146,7 @@ static int dump_rings(PacketSockEntry *psk, struct packet_sock_desc *sd)
static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p) static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
{ {
FileEntry fe = FILE_ENTRY__INIT;
PacketSockEntry psk = PACKET_SOCK_ENTRY__INIT; PacketSockEntry psk = PACKET_SOCK_ENTRY__INIT;
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT; SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
struct packet_sock_desc *sd; struct packet_sock_desc *sd;
...@@ -194,7 +195,11 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p) ...@@ -194,7 +195,11 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
if (ret) if (ret)
goto out; goto out;
ret = pb_write_one(img_from_set(glob_imgset, CR_FD_PACKETSK), &psk, PB_PACKET_SOCK); fe.type = FD_TYPES__PACKETSK;
fe.id = psk.id;
fe.psk = &psk;
ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
out: out:
release_skopts(&skopts); release_skopts(&skopts);
xfree(psk.rx_ring); xfree(psk.rx_ring);
......
...@@ -3,6 +3,7 @@ syntax = "proto2"; ...@@ -3,6 +3,7 @@ syntax = "proto2";
import "regfile.proto"; import "regfile.proto";
import "sk-inet.proto"; import "sk-inet.proto";
import "ns.proto"; import "ns.proto";
import "packet-sock.proto";
enum fd_types { enum fd_types {
UND = 0; UND = 0;
...@@ -38,4 +39,5 @@ message file_entry { ...@@ -38,4 +39,5 @@ message file_entry {
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; optional ns_file_entry nsf = 5;
optional packet_sock_entry psk = 6;
} }
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