[CRIU] [PATCH 4/6] mnt: rename roots_mp into root_yard_mp and make it global

Andrei Vagin avagin at openvz.org
Wed Sep 21 23:16:39 PDT 2016


From: Andrei Vagin <avagin at virtuozzo.com>

It is preparation to handle over-mounts.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/mount.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/criu/mount.c b/criu/mount.c
index 6717b96..a64671f 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -49,6 +49,10 @@ struct binfmt_misc_info {
 };
 
 static LIST_HEAD(binfmt_misc_list);
+
+/* A helper mount_info entry for the roots yard */
+static struct mount_info *root_yard_mp = NULL;
+
 static struct fstype fstypes[];
 
 int ext_mount_add(char *key, char *val)
@@ -99,7 +103,8 @@ static void mntinfo_add_list(struct mount_info *new)
 
 static int open_mountpoint(struct mount_info *pm);
 
-static struct mount_info *mnt_build_tree(struct mount_info *list, struct mount_info *roots_mp);
+static struct mount_info *mnt_build_tree(struct mount_info *list,
+					 struct mount_info *root_yard_mp);
 static int validate_mounts(struct mount_info *info, bool for_dump);
 
 static struct mount_info *__lookup_overlayfs(struct mount_info *list, char *rpath,
@@ -970,7 +975,8 @@ static int resolve_shared_mounts(struct mount_info *info, int root_master_id)
 	return 0;
 }
 
-static struct mount_info *mnt_build_tree(struct mount_info *list, struct mount_info *roots_mp)
+static struct mount_info *mnt_build_tree(struct mount_info *list,
+					 struct mount_info *root_yard_mp)
 {
 	struct mount_info *tree;
 
@@ -979,7 +985,7 @@ static struct mount_info *mnt_build_tree(struct mount_info *list, struct mount_i
 	 */
 
 	pr_info("Building mountpoints tree\n");
-	tree = mnt_build_ids_tree(list, roots_mp);
+	tree = mnt_build_ids_tree(list, root_yard_mp);
 	if (!tree)
 		return NULL;
 
@@ -3415,20 +3421,19 @@ static int populate_mnt_ns(void)
 {
 	struct mount_info *pms;
 	struct ns_id *nsid;
-	struct mount_info *roots_mp = NULL;
 	int ret;
 
 	if (mnt_roots) {
 		/* mnt_roots is a tmpfs mount and it's private */
-		roots_mp = mnt_entry_alloc();
-		if (!roots_mp)
+		root_yard_mp = mnt_entry_alloc();
+		if (!root_yard_mp)
 			return -1;
 
-		roots_mp->mountpoint = mnt_roots;
-		roots_mp->mounted = true;
+		root_yard_mp->mountpoint = mnt_roots;
+		root_yard_mp->mounted = true;
 	}
 
-	pms = mnt_build_tree(mntinfo, roots_mp);
+	pms = mnt_build_tree(mntinfo, root_yard_mp);
 	if (!pms)
 		return -1;
 
-- 
2.7.4



More information about the CRIU mailing list