[CRIU] [PATCH 5/7] mount: mounts_equal -- Fix comment and a few style nits

Cyrill Gorcunov gorcunov at openvz.org
Thu Sep 3 03:05:12 PDT 2015


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 mount.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/mount.c b/mount.c
index ba4a0e370bae..47786a655fda 100644
--- a/mount.c
+++ b/mount.c
@@ -275,23 +275,21 @@ bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev,
 }
 
 /*
- * Comparer two mounts. Return true if only mount points are differ.
- * Don't care about root and mountpoints, if bind is true.
+ * Two mountpoints are to be on the same device with same options
+ * mounted at least. For bind mounts we ignore @root and @mountpoint.
  */
 static bool mounts_equal(struct mount_info* mi, struct mount_info *c, bool bind)
 {
-	if (mi->s_dev != c->s_dev ||
-	    c->fstype != mi->fstype ||
-	    strcmp(c->source, mi->source) ||
+	if (mi->s_dev != c->s_dev		||
+	    c->fstype != mi->fstype		||
+	    strcmp(c->source, mi->source)	||
 	    strcmp(c->options, mi->options))
 		return false;
-
 	if (bind)
 		return true;
-
-	if (strcmp(c->root, mi->root))
-		return false;
-	if (strcmp(basename(c->mountpoint), basename(mi->mountpoint)))
+	if (strcmp(c->root, mi->root)		||
+	    strcmp(basename(c->mountpoint),
+		   basename(mi->mountpoint)))
 		return false;
 	return true;
 }
-- 
2.4.3



More information about the CRIU mailing list