[CRIU] [PATCH] libcriu: add skip_mnt and enable_fs support
Ruslan Kuprieiev
rkuprieiev at cloudlinux.com
Wed May 6 02:22:25 PDT 2015
Signed-off-by: Ruslan Kuprieiev <rkuprieiev at cloudlinux.com>
---
lib/criu.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/criu.h | 2 ++
2 files changed, 64 insertions(+)
diff --git a/lib/criu.c b/lib/criu.c
index 1642fb1..fb82d93 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -328,6 +328,68 @@ er:
return -ENOMEM;
}
+int criu_add_enable_fs(char *fs)
+{
+ int nr;
+ char *str = NULL;
+ char **ptr = NULL;
+
+ str = strdup(fs);
+ if (!str)
+ goto err;
+
+ nr = opts->n_enable_fs + 1;
+ ptr = realloc(opts->enable_fs, nr * sizeof(*ptr));
+ if (!ptr)
+ goto err;
+
+ ptr[nr - 1] = str;
+
+ opts->n_enable_fs = nr;
+ opts->enable_fs = ptr;
+
+ return 0;
+
+err:
+ if (str)
+ free(str);
+ if (ptr)
+ free(ptr);
+
+ return -ENOMEM;
+}
+
+int criu_add_skip_mnt(char *mnt)
+{
+ int nr;
+ char *str = NULL;
+ char **ptr = NULL;
+
+ str = strdup(mnt);
+ if (!str)
+ goto err;
+
+ nr = opts->n_skip_mnt + 1;
+ ptr = realloc(opts->skip_mnt, nr * sizeof(*ptr));
+ if (!ptr)
+ goto err;
+
+ ptr[nr - 1] = str;
+
+ opts->n_skip_mnt = nr;
+ opts->skip_mnt = ptr;
+
+ return 0;
+
+err:
+ if (str)
+ free(str);
+ if (ptr)
+ free(ptr);
+
+ return -ENOMEM;
+}
+
static CriuResp *recv_resp(int socket_fd)
{
unsigned char *buf;
diff --git a/lib/criu.h b/lib/criu.h
index e1a602f..f8fce0b 100644
--- a/lib/criu.h
+++ b/lib/criu.h
@@ -55,6 +55,8 @@ int criu_set_exec_cmd(int argc, char *argv[]);
int criu_add_ext_mount(char *key, char *val);
int criu_add_veth_pair(char *in, char *out);
int criu_add_cg_root(char *ctrl, char *path);
+int criu_add_enable_fs(char *fs);
+int criu_add_skip_mnt(char *mnt);
/*
* The criu_notify_arg_t na argument is an opaque
--
1.8.3.1
More information about the CRIU
mailing list