[CRIU] [RFC PATCH 4/6] populate FSTYPE__AUTO fstypes during restore
Oleg Nesterov
oleg at redhat.com
Fri Mar 27 10:55:52 PDT 2015
Turn find_fstype_by_name(name) into __find_fstype_by_name(name, force_auto)
and reimplement find_fstype_by_name() as a trivial wrapper on top.
Change collect_mnt_from_image() to do __find_fstype_by_name(fsname, true)
when fstype = FSTYPE__AUTO.
TODO: Note the "#if 0" block in __find_fstype_by_name(), imo makes sense
but we don't have WARN_ON() yet.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
mount.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/mount.c b/mount.c
index e05b599..b44ed38 100644
--- a/mount.c
+++ b/mount.c
@@ -1100,7 +1100,7 @@ static bool fstype_is_auto(const char *name)
return false;
}
-struct fstype *find_fstype_by_name(char *fst)
+static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
{
int i;
@@ -1116,7 +1116,7 @@ struct fstype *find_fstype_by_name(char *fst)
struct fstype *fstype = fstypes + i;
if (!fstype->name) {
- if (!fstype_is_auto(fst))
+ if (!force_auto && !fstype_is_auto(fst))
break;
fstype->name = xstrdup(fst);
@@ -1128,9 +1128,18 @@ struct fstype *find_fstype_by_name(char *fst)
return fstype;
}
+#if 0
+ WARN_ON(i == ARRAY_SIZE(fstypes)); /* auto should have a room */
+ WARN_ON(force_auto);
+#endif
return &fstypes[0];
}
+struct fstype *find_fstype_by_name(char *fst)
+{
+ return __find_fstype_by_name(fst, false);
+}
+
static struct fstype *decode_fstype(u32 fst)
{
int i;
@@ -1891,14 +1900,9 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
/*
* TODO: this is ugly and suboptimal. We should dump
* the list of FSTYPE__AUTO fsnames and restore them
- * all once
- */
-
- /*
- * XXX: just print the dumped/restored ->fsname till
- * the next patch.
+ * all once. decode_fstype() below must find it.
*/
- pr_warn("XXX FSTYPE__AUTO name:[%s]\n", me->fsname);
+ __find_fstype_by_name(me->fsname, true);
}
/* FIXME: abort unsupported early */
--
1.5.5.1
More information about the CRIU
mailing list