2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-04 16:25:31 +00:00

irmap: add --irmap-scan-path option

This option allows users to specify their own irmap paths to scan in the event
that they don't have a path in one of the hard coded hints.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Tycho Andersen
2015-09-16 07:27:00 +03:00
committed by Pavel Emelyanov
parent d3be641acd
commit 4f2e4ab3be
8 changed files with 102 additions and 0 deletions

View File

@@ -669,6 +669,40 @@ err:
return -ENOMEM;
}
int criu_local_add_irmap_path(criu_opts *opts, char *path)
{
int nr;
char *my_path;
char **m;
if (!opts)
return -1;
my_path = strdup(path);
if (!my_path)
goto err;
nr = opts->rpc->n_irmap_scan_paths + 1;
m = realloc(opts->rpc->irmap_scan_paths, nr * sizeof(*m));
if (!m)
goto err;
m[nr - 1] = my_path;
opts->rpc->n_irmap_scan_paths = nr;
opts->rpc->irmap_scan_paths = m;
return 0;
err:
if (my_path)
free(my_path);
if (m)
free(m);
return -ENOMEM;
}
int criu_add_skip_mnt(char *mnt)
{
return criu_local_add_skip_mnt(global_opts, mnt);
@@ -685,6 +719,11 @@ void criu_set_ghost_limit(unsigned int limit)
criu_local_set_ghost_limit(global_opts, limit);
}
int criu_add_irmap_path(char *path)
{
return criu_local_add_irmap_path(global_opts, path);
}
static CriuResp *recv_resp(int socket_fd)
{
unsigned char *buf;