From eaf3a03ced3ec9e704cabce4fb90b05c8b3655dd Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Thu, 9 Apr 2015 19:46:35 +0200 Subject: [PATCH] dump/restore fstype->name if FSTYPE__AUTO Add the new mnt_entry->fsname member and change dump_one_mountpoint() to save pm->fstype->name if fstype == FSTYPE__AUTO. Change collect_mnt_from_image() to pass this ->fsname to decode_fstype() which falls back to __find_fstype_by_name(fsname, true) if FSTYPE__AUTO. Signed-off-by: Oleg Nesterov Signed-off-by: Pavel Emelyanov --- mount.c | 10 ++++++++-- protobuf/mnt.proto | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mount.c b/mount.c index e1b6609a4..6fb9b03d2 100644 --- a/mount.c +++ b/mount.c @@ -1230,10 +1230,13 @@ struct fstype *find_fstype_by_name(char *fst) return __find_fstype_by_name(fst, false); } -static struct fstype *decode_fstype(u32 fst) +static struct fstype *decode_fstype(u32 fst, char *fsname) { int i; + if (fst == FSTYPE__AUTO) + return __find_fstype_by_name(fsname, true); + if (fst == FSTYPE__UNSUPPORTED) goto uns; @@ -1259,6 +1262,9 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img) me.fstype = pm->fstype->code; + if (me.fstype == FSTYPE__AUTO) + me.fsname = pm->fstype->name; + if (pm->parent && !pm->dumped && !pm->need_plugin && pm->fstype->dump && fsroot_mounted(pm)) { struct mount_info *t; @@ -1981,7 +1987,7 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid) pm->is_ns_root = is_root(me->mountpoint); /* FIXME: abort unsupported early */ - pm->fstype = decode_fstype(me->fstype); + pm->fstype = decode_fstype(me->fstype, me->fsname); if (me->ext_mount) { struct ext_mount *em; diff --git a/protobuf/mnt.proto b/protobuf/mnt.proto index 10fa374f9..313610eaf 100644 --- a/protobuf/mnt.proto +++ b/protobuf/mnt.proto @@ -37,4 +37,6 @@ message mnt_entry { optional bool with_plugin = 12; optional bool ext_mount = 13; + + optional string fsname = 14; }