[CRIU] [PATCH 3/4] libcriu: Add add_ext_mount_map call
Pavel Emelyanov
xemul at parallels.com
Wed Jun 25 06:46:18 PDT 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
lib/criu.c | 35 +++++++++++++++++++++++++++++++++++
lib/criu.h | 1 +
2 files changed, 36 insertions(+)
diff --git a/lib/criu.c b/lib/criu.c
index 11ff59b..4a6ee2a 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -170,6 +170,41 @@ out:
return -ENOMEM;
}
+int criu_add_ext_mount(char *key, char *val)
+{
+ int nr;
+ ExtMountMap **a, *m;
+
+ m = malloc(sizeof(*m));
+ if (!m)
+ goto er;
+ m->key = strdup(key);
+ if (!m->key)
+ goto er_n;
+ m->val = strdup(val);
+ if (!m->val)
+ goto er_k;
+
+ nr = opts->n_ext_mnt + 1;
+ a = realloc(opts->ext_mnt, nr * sizeof(m));
+ if (!a)
+ goto er_v;
+
+ a[nr - 1] = m;
+ opts->ext_mnt = a;
+ opts->n_ext_mnt = nr;
+ return 0;
+
+er_v:
+ free(m->val);
+er_k:
+ free(m->key);
+er_n:
+ free(m);
+er:
+ return -ENOMEM;
+}
+
static CriuResp *recv_resp(int socket_fd)
{
unsigned char buf[CR_MAX_MSG_SIZE];
diff --git a/lib/criu.h b/lib/criu.h
index 3bbad48..37ad072 100644
--- a/lib/criu.h
+++ b/lib/criu.h
@@ -48,6 +48,7 @@ void criu_set_log_file(char *log_file);
void criu_set_cpu_cap(unsigned int cap);
void criu_set_root(char *root);
int criu_set_exec_cmd(int argc, char *argv[]);
+int criu_add_ext_mount(char *key, char *val);
/* Here is a table of return values and errno's of functions
* from the list down below.
--
1.8.4.2
More information about the CRIU
mailing list