Commit a8510f7d authored by Pavel Emelyanov's avatar Pavel Emelyanov

actions: Add rpc notify with separate call

This lets us clean the action-script.c eventually.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f2012edc
......@@ -32,6 +32,8 @@ struct script {
static LIST_HEAD(scripts);
#define SCRIPT_RPC_NOTIFY (char *)0x1
int run_scripts(enum script_actions act)
{
struct script *script;
......@@ -80,7 +82,7 @@ int run_scripts(enum script_actions act)
return ret;
}
int add_script(char *path, int arg)
int add_script(char *path)
{
struct script *script;
......@@ -89,7 +91,22 @@ int add_script(char *path, int arg)
return 1;
script->path = path;
script->arg = arg;
script->arg = 0;
list_add(&script->node, &scripts);
return 0;
}
int add_rpc_notify(int sk)
{
struct script *script;
script = xmalloc(sizeof(struct script));
if (script == NULL)
return 1;
script->path = SCRIPT_RPC_NOTIFY;
script->arg = sk;
list_add(&script->node, &scripts);
return 0;
......
......@@ -360,8 +360,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
}
}
if (req->notify_scripts &&
add_script(SCRIPT_RPC_NOTIFY, sk))
if (req->notify_scripts && add_rpc_notify(sk))
goto err;
for (i = 0; i < req->n_veths; i++) {
......
......@@ -390,7 +390,7 @@ int main(int argc, char *argv[], char *envp[])
}
break;
case 1049:
if (add_script(optarg, 0))
if (add_script(optarg))
return 1;
break;
......
#ifndef __CR_ACTION_SCRIPTS_H__
#define __CR_ACTION_SCRIPTS_H__
#define SCRIPT_RPC_NOTIFY (char *)0x1
enum script_actions {
ACT_PRE_DUMP = 0,
ACT_POST_DUMP = 1,
......@@ -17,7 +15,8 @@ enum script_actions {
ACT_MAX
};
extern int add_script(char *path, int arg);
extern int add_script(char *path);
extern int add_rpc_notify(int sk);
extern int run_scripts(enum script_actions);
extern int send_criu_rpc_script(enum script_actions act, char *name, int arg);
......
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