mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
libcriu: Add add_ext_mount_map call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
3f4447d72e
commit
1a5a034413
35
lib/criu.c
35
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];
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user