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