mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
mount: Split reading images and populating the ns
We will need images at hands while we do pivot_root (see further patches), so prepare the images reading routine. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
29
mount.c
29
mount.c
@@ -1209,7 +1209,7 @@ static void free_mounts(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int populate_mnt_ns(int ns_pid)
|
static int read_mnt_ns_img(int ns_pid)
|
||||||
{
|
{
|
||||||
MntEntry *me = NULL;
|
MntEntry *me = NULL;
|
||||||
int img, ret;
|
int img, ret;
|
||||||
@@ -1277,15 +1277,8 @@ static int populate_mnt_ns(int ns_pid)
|
|||||||
mntinfo_tree = NULL;
|
mntinfo_tree = NULL;
|
||||||
mntinfo = pms;
|
mntinfo = pms;
|
||||||
|
|
||||||
pms = mnt_build_tree(pms);
|
return 0;
|
||||||
if (!pms)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (validate_mounts(pms))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
mntinfo_tree = pms;
|
|
||||||
return mnt_tree_for_each(pms, do_mount_one);
|
|
||||||
err:
|
err:
|
||||||
while (pms) {
|
while (pms) {
|
||||||
struct mount_info *pm = pms;
|
struct mount_info *pm = pms;
|
||||||
@@ -1296,6 +1289,24 @@ err:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int populate_mnt_ns(int ns_pid)
|
||||||
|
{
|
||||||
|
struct mount_info *pms;
|
||||||
|
|
||||||
|
if (read_mnt_ns_img(ns_pid))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
pms = mnt_build_tree(mntinfo);
|
||||||
|
if (!pms)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (validate_mounts(pms))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
mntinfo_tree = pms;
|
||||||
|
return mnt_tree_for_each(pms, do_mount_one);
|
||||||
|
}
|
||||||
|
|
||||||
int prepare_mnt_ns(int ns_pid)
|
int prepare_mnt_ns(int ns_pid)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
Reference in New Issue
Block a user