mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 09:10:10 +00:00
mount: Make auto options into --external mnt
The syntax for --ext-mount-map auto is
--external mnt[]{:ms}
where optional 'm' means --enable-external-masters and optional
's' means --enable-external-sharing.
travis-ci: success for mnt: Deprecate --ext-mount-map for --external
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
a8ed43bed5
commit
f725bfee8b
4 changed files with 29 additions and 11 deletions
|
|
@ -624,11 +624,6 @@ int main(int argc, char *argv[], char *envp[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!opts.autodetect_ext_mounts && (opts.enable_external_masters || opts.enable_external_sharing)) {
|
||||
pr_msg("must specify --ext-mount-map auto with --enable-external-{sharing|masters}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (opts.work_dir == NULL)
|
||||
opts.work_dir = imgs_dir;
|
||||
|
||||
|
|
@ -828,6 +823,7 @@ usage:
|
|||
" dev[maj:min]:VAL\n"
|
||||
" unix[ino]\n"
|
||||
" mnt[MOUNTPOINT]:COOKIE\n"
|
||||
" mnt[]{:AUTO_OPTIONS}\n"
|
||||
" Formats of RES on restore:\n"
|
||||
" dev[VAL]:DEVPATH\n"
|
||||
" veth[IFNAME]:OUTNAME{@BRIDGE}\n"
|
||||
|
|
@ -849,12 +845,6 @@ usage:
|
|||
" --force-irmap force resolving names for inotify/fsnotify watches\n"
|
||||
" --irmap-scan-path FILE\n"
|
||||
" add a path the irmap hints to scan\n"
|
||||
" -M|--ext-mount-map auto\n"
|
||||
" attempt to autodetect external mount mappings\n"
|
||||
" --enable-external-sharing\n"
|
||||
" allow autoresolving mounts with external sharing\n"
|
||||
" --enable-external-masters\n"
|
||||
" allow autoresolving mounts with external masters\n"
|
||||
" --manage-cgroups [m] dump/restore process' cgroups; argument can be one of\n"
|
||||
" 'none', 'props', 'soft' (default), 'full' or 'strict'\n"
|
||||
" --cgroup-root [controller:]/newroot\n"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "common/list.h"
|
||||
#include "cr_options.h"
|
||||
#include "xmalloc.h"
|
||||
#include "mount.h"
|
||||
#include "external.h"
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -21,6 +22,11 @@ int add_external(char *key)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (strstartswith(key, "mnt[]")) {
|
||||
xfree(ext);
|
||||
return ext_mount_parse_auto(key + 5);
|
||||
}
|
||||
|
||||
list_add(&ext->node, &opts.external);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ extern int depopulate_roots_yard(int mntns_root, bool clean_remaps);
|
|||
|
||||
extern int rst_get_mnt_root(int mnt_id, char *path, int plen);
|
||||
extern int ext_mount_add(char *key, char *val);
|
||||
extern int ext_mount_parse_auto(char *key);
|
||||
extern int mntns_maybe_create_roots(void);
|
||||
extern int read_mnt_ns_img(void);
|
||||
extern void cleanup_mnt_ns(void);
|
||||
|
|
|
|||
21
criu/mount.c
21
criu/mount.c
|
|
@ -66,6 +66,27 @@ int ext_mount_add(char *key, char *val)
|
|||
return add_external(e_str);
|
||||
}
|
||||
|
||||
int ext_mount_parse_auto(char *key)
|
||||
{
|
||||
opts.autodetect_ext_mounts = true;
|
||||
|
||||
if (*key == ':') {
|
||||
while (1) {
|
||||
key++;
|
||||
if (*key == '\0')
|
||||
break;
|
||||
else if (*key == 'm')
|
||||
opts.enable_external_masters = true;
|
||||
else if (*key == 's')
|
||||
opts.enable_external_sharing = true;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Lookup ext_mount by key field */
|
||||
static char *ext_mount_lookup(char *key)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue