Commit 26529414 authored by Pavel Emelyanov's avatar Pavel Emelyanov

unux: Make --external support --ext-unix-sk

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f2037e6d
......@@ -61,7 +61,6 @@ void init_opts(void)
/* Default options */
opts.final_state = TASK_DEAD;
INIT_LIST_HEAD(&opts.ext_unixsk_ids);
INIT_LIST_HEAD(&opts.ext_mounts);
INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.external);
......@@ -827,14 +826,12 @@ usage:
" tty[rdev:dev]\n"
" file[mnt_id:inode]\n"
" dev[maj:min]:VAL\n"
" unix[ino]\n"
" Formats of RES on restore:\n"
" dev[VAL]:DEVPATH\n"
" veth[IFNAME]:OUTNAME{@BRIDGE}\n"
"\n"
"* Special resources support:\n"
" -x|--" USK_EXT_PARAM " [inode,...]\n"
" allow external unix connections (optional arguments\n"
" are socketpair inode(s) that allow one-sided dump)\n"
" --" SK_EST_PARAM " checkpoint/restore established TCP connections\n"
" --" SK_INFLIGHT_PARAM " skip (ignore) in-flight TCP connections\n"
" -r|--root PATH change the root filesystem (when run in mount namespace)\n"
......
......@@ -60,7 +60,6 @@ struct cr_options {
};
bool restore_sibling;
bool ext_unix_sk;
struct list_head ext_unixsk_ids;
bool shell_job;
bool handle_file_locks;
bool tcp_established_ok;
......
......@@ -26,6 +26,7 @@
#include "plugin.h"
#include "namespaces.h"
#include "pstree.h"
#include "external.h"
#include "crtools.h"
#include "protobuf.h"
......@@ -94,11 +95,6 @@ struct unix_sk_listen_icon {
struct unix_sk_listen_icon *next;
};
struct unix_sk_exception {
struct list_head unix_sk_list;
ino_t unix_sk_ino;
};
#define SK_HASH_SIZE 32
static struct unix_sk_listen_icon *unix_listen_icons[SK_HASH_SIZE];
......@@ -165,18 +161,15 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk)
static bool unix_sk_exception_lookup_id(ino_t ino)
{
bool ret = false;
struct unix_sk_exception *sk;
list_for_each_entry(sk, &opts.ext_unixsk_ids, unix_sk_list) {
if (sk->unix_sk_ino == ino) {
pr_debug("Found ino %u in exception unix sk list\n", (unsigned int)ino);
ret = true;
break;
}
char id[20];
snprintf(id, sizeof(id), "unix[%lu]", ino);
if (external_lookup_id(id)) {
pr_debug("Found ino %u in exception unix sk list\n", (unsigned int)ino);
return true;
}
return ret;
return false;
}
static int write_unix_entry(struct unix_sk_desc *sk)
......@@ -1447,17 +1440,13 @@ static int resolve_unix_peers(void *unused)
int unix_sk_id_add(ino_t ino)
{
struct unix_sk_exception *unix_sk;
/* TODO: validate inode here? */
char *e_str;
unix_sk = xmalloc(sizeof *unix_sk);
if (unix_sk == NULL)
e_str = xmalloc(20);
if (!e_str)
return -1;
unix_sk->unix_sk_ino = ino;
list_add_tail(&unix_sk->unix_sk_list, &opts.ext_unixsk_ids);
return 0;
snprintf(e_str, 20, "unix[%lu]", ino);
return add_external(e_str);
}
int unix_sk_ids_parse(char *optarg)
......
......@@ -91,7 +91,7 @@ message criu_opts {
repeated string skip_mnt = 31;
repeated string enable_fs = 32;
repeated unix_sk unix_sk_ino = 33;
repeated unix_sk unix_sk_ino = 33; /* DEPRECATED, use external instead */
optional criu_cg_mode manage_cgroups_mode = 34;
optional uint32 ghost_limit = 35 [default = 0x100000];
......
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