Commit 76017ec5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

scripts: Use numeric action val in RPC notifications

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 17d44de9
......@@ -42,7 +42,7 @@ int run_scripts(enum script_actions act)
list_for_each_entry(script, &opts.scripts, node) {
if (script->path == SCRIPT_RPC_NOTIFY) {
pr_debug("\tRPC\n");
ret |= send_criu_rpc_script(action, script->arg);
ret |= send_criu_rpc_script(act, action, script->arg);
} else {
pr_debug("\t[%s]\n", script->path);
ret |= system(script->path);
......
......@@ -129,7 +129,7 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
return send_criu_msg(socket_fd, &msg);
}
int send_criu_rpc_script(char *script, int fd)
int send_criu_rpc_script(enum script_actions act, char *name, int fd)
{
int ret;
CriuResp msg = CRIU_RESP__INIT;
......@@ -139,9 +139,10 @@ int send_criu_rpc_script(char *script, int fd)
msg.type = CRIU_REQ_TYPE__NOTIFY;
msg.success = true;
msg.notify = &cn;
cn.script = script;
cn.script = name;
if (!strcmp(script, "setup-namespaces")) {
switch (act) {
case ACT_SETUP_NS:
/*
* FIXME pid is required only once on
* restore. Need some more sane way of
......@@ -149,6 +150,9 @@ int send_criu_rpc_script(char *script, int fd)
*/
cn.has_pid = true;
cn.pid = root_item->pid.real;
break;
default:
break;
}
ret = send_criu_msg(fd, &msg);
......
......@@ -19,5 +19,6 @@ enum script_actions {
extern int add_script(char *path, int arg);
extern int run_scripts(enum script_actions);
extern int send_criu_rpc_script(enum script_actions act, char *name, int arg);
#endif /* __CR_ACTION_SCRIPTS_H__ */
......@@ -7,7 +7,6 @@ extern int cr_service(bool deamon_mode);
int cr_service_work(int sk);
extern int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern int send_criu_rpc_script(char *name, int arg);
extern struct _cr_service_client *cr_service_client;
extern unsigned int service_sk_ino;
......
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