[CRIU] [PATCH 9/9] mount: Remove the len variable

Pavel Emelyanov xemul at parallels.com
Tue Nov 11 06:51:29 PST 2014


And use the expression for it, it's quite short. This
makes the amount of variables in the code fit into brains.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 mount.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mount.c b/mount.c
index c7a8594..8385ad9 100644
--- a/mount.c
+++ b/mount.c
@@ -428,7 +428,7 @@ static inline int path_length(char *path)
 static int validate_shared(struct mount_info *m)
 {
 	struct mount_info *t, *ct;
-	int t_root_l, m_root_l, t_mpnt_l, m_mpnt_l, len;
+	int t_root_l, m_root_l, t_mpnt_l, m_mpnt_l;
 	char *m_root_rpath;
 	LIST_HEAD(children);
 
@@ -480,7 +480,6 @@ static int validate_shared(struct mount_info *m)
 	 */
 
 	m_root_rpath = m->root + t_root_l;	/* path from t->root to m->root */
-	len = m_root_l - t_root_l;		/* its length */
 
 	/* Search a child, which is visiable in both mounts. */
 	list_for_each_entry(ct, &t->children, siblings) {
@@ -502,11 +501,11 @@ static int validate_shared(struct mount_info *m)
 
 		/*
 		 * The ct has peer in m but with the mount path deeper according
-		 * to m's depth relavie to t. Thus -- trim this difference from
-		 * ct's mountpoint path.
+		 * to m's depth relavie to t. Thus -- trim this difference (the
+		 * lenght of m_root_rpath) from ct's mountpoint path.
 		 */
 
-		ct_mpnt_rpath += len;
+		ct_mpnt_rpath += m_root_l - t_root_l;
 
 		/*
 		 * Find in m the mountpoint that fully matches with ct (with the
-- 
1.8.4.2




More information about the CRIU mailing list