[CRIU] [PATCH 2/2] rpc: Add skip_fsize_paths option
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 23 08:20:17 PDT 2017
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
criu/cr-service.c | 9 +++++++++
images/rpc.proto | 1 +
lib/c/criu.c | 25 +++++++++++++++++++++++++
lib/c/criu.h | 2 ++
4 files changed, 37 insertions(+)
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 78142b081d0a..584283b183cd 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -534,6 +534,15 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (req->orphan_pts_master)
opts.orphan_pts_master = true;
+ if (req->n_skip_fsize_paths) {
+ opts.skip_fsize_paths = xmalloc(sizeof(opts.skip_fsize_paths) *
+ req->n_skip_fsize_paths);
+ if (!opts.skip_fsize_paths)
+ goto err;
+ for (i = 0; i < req->n_skip_fsize_paths; i++)
+ opts.skip_fsize_paths[i] = req->skip_fsize_paths[i];
+ }
+
if (check_namespace_opts())
goto err;
diff --git a/images/rpc.proto b/images/rpc.proto
index f894ae1fdbb2..ce299fa55a49 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -111,6 +111,7 @@ message criu_opts {
optional bool lazy_pages = 48;
optional int32 status_fd = 49;
optional bool orphan_pts_master = 50;
+ repeated string skip_fsize_paths = 51;
}
message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index 08806c6ea837..c3737894dd6e 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -880,6 +880,31 @@ int criu_add_external(char *key)
return criu_local_add_external(global_opts, key);
}
+int criu_local_add_skip_fsize_path(criu_opts *opts, char *path)
+{
+ char **new;
+ size_t nr;
+
+ nr = opts->rpc->n_skip_fsize_paths + 1;
+ new = realloc(opts->rpc->skip_fsize_paths, nr * sizeof(char *));
+ if (!new)
+ return -ENOMEM;
+
+ new[opts->rpc->n_skip_fsize_paths] = strdup(path);
+ if (!new[opts->rpc->n_skip_fsize_paths])
+ return -ENOMEM;
+
+ opts->rpc->n_skip_fsize_paths = nr;
+ opts->rpc->skip_fsize_paths = new;
+
+ return 0;
+}
+
+int criu_add_skip_fsize_path(char *path)
+{
+ return criu_local_add_skip_fsize_path(global_opts, path);
+}
+
static CriuResp *recv_resp(int socket_fd)
{
unsigned char *buf = NULL;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 5d0b5b6c04b1..627bcca883be 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -95,6 +95,7 @@ void criu_set_ghost_limit(unsigned int limit);
int criu_add_irmap_path(char *path);
int criu_add_inherit_fd(int fd, char *key);
int criu_add_external(char *key);
+int criu_add_skip_fsize_path(char *path);
/*
* The criu_notify_arg_t na argument is an opaque
@@ -206,6 +207,7 @@ int criu_local_add_cg_props_file(criu_opts *opts, char *path);
int criu_local_add_cg_dump_controller(criu_opts *opts, char *name);
int criu_local_add_inherit_fd(criu_opts *opts, int fd, char *key);
int criu_local_add_external(criu_opts *opts, char *key);
+int criu_local_add_skip_fsize_path(criu_opts *opts, char *path);
void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));
--
2.7.4
More information about the CRIU
mailing list