Commit a8ed43be authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Turn into --external

Make --external support --ext-mount-map. The syntax is

 --ext-mount-map KEY:VAL == --external mnt[KEY]:VAL

Old option is kept for backward compatibility.

travis-ci: success for mnt: Deprecate --ext-mount-map for --external
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 043a9c90
......@@ -827,10 +827,12 @@ usage:
" file[mnt_id:inode]\n"
" dev[maj:min]:VAL\n"
" unix[ino]\n"
" mnt[MOUNTPOINT]:COOKIE\n"
" Formats of RES on restore:\n"
" dev[VAL]:DEVPATH\n"
" veth[IFNAME]:OUTNAME{@BRIDGE}\n"
" macvlan[IFNAME]:OUTNAME\n"
" mnt[COOKIE]:ROOT\n"
"\n"
"* Special resources support:\n"
" --" SK_EST_PARAM " checkpoint/restore established TCP connections\n"
......@@ -847,8 +849,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 KEY:VALUE\n"
" add external mount mapping\n"
" -M|--ext-mount-map auto\n"
" attempt to autodetect external mount mappings\n"
" --enable-external-sharing\n"
......
......@@ -10,24 +10,6 @@ struct pstree_item;
struct fstype;
struct ns_id;
/*
* Structure to keep external mount points resolving info.
*
* On dump the key is the mountpoint as seen from the mount
* namespace, the val is some name that will be put into image
* instead of the mount point's root path.
*
* On restore the key is the name from the image (the one
* mentioned above) and the val is the path in criu's mount
* namespace that will become the mount point's root, i.e. --
* be bind mounted to the respective mountpoint.
*/
struct ext_mount {
struct list_head list;
char *key;
char *val;
};
#define MOUNT_INVALID_DEV (0)
struct mount_info {
......
......@@ -45,29 +45,40 @@
int ext_mount_add(char *key, char *val)
{
struct ext_mount *em;
char *e_str;
em = xmalloc(sizeof(*em));
if (!em)
e_str = xmalloc(strlen(key) + strlen(val) + 8);
if (!e_str)
return -1;
em->key = key;
em->val = val;
list_add_tail(&em->list, &opts.ext_mounts);
pr_info("Added %s:%s ext mount mapping\n", key, val);
return 0;
/*
* On dump the key is the mountpoint as seen from the mount
* namespace, the val is some name that will be put into image
* instead of the mount point's root path.
*
* On restore the key is the name from the image (the one
* mentioned above) and the val is the path in criu's mount
* namespace that will become the mount point's root, i.e. --
* be bind mounted to the respective mountpoint.
*/
sprintf(e_str, "mnt[%s]:%s", key, val);
return add_external(e_str);
}
/* Lookup ext_mount by key field */
static char *ext_mount_lookup(char *key)
{
struct ext_mount *em;
char *v;
int len = strlen(key);
char mkey[len + 8];
list_for_each_entry(em, &opts.ext_mounts, list)
if (!strcmp(em->key, key))
return em->val;
sprintf(mkey, "mnt[%s]", key);
v = external_lookup_by_key(mkey);
if (IS_ERR(v))
v = NULL;
return NULL;
return v;
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment