Commit 38e148e5 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

introduce fsname_is_auto(name) and FSTYPE__AUTO

The comment in find_fstype_by_name() says:

	just mounting anything is wrong

and this is true in general, but:

	almost every fs has its own features

this is not true in a sense that a lot of supported filesystems do not
need any special processing: FSTYPE__PROC, FSTYPE__SYSFS, and more. More
importantly, this logic does not allow to spicify from the command line
that (say) currently unsupported hugetlbfs can "just work", do_new_mount()
should only pass the right name/options.

This patch adds the new FSTYPE__AUTO code, find_fstype_by_name(name) adds
the new entry if fsname_is_auto(name) returns true. We do not care that
different fstype's can have the same FSTYPE__AUTO code, fstype->code has
no meaning unless we need to do something special with this fs, but in
this case it should not be FSTYPE__AUTO by definition.

Note: currently find_fstype_by_name() just returns true, it is obviously
pointless to "dump" until we teach "restore" to handle FSTYPE__AUTO.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1f9798a6
......@@ -1172,6 +1172,11 @@ static struct fstype fstypes[32] = {
},
};
static bool fsname_is_auto(const char *name)
{
return false;
}
struct fstype *find_fstype_by_name(char *_fst)
{
int i;
......@@ -1201,13 +1206,22 @@ struct fstype *find_fstype_by_name(char *_fst)
for (i = 1; i < ARRAY_SIZE(fstypes); i++) {
struct fstype *fstype = fstypes + i;
if (!fstype->name)
if (!fstype->name) {
if (!fsname_is_auto(fst))
break;
fstype->name = xstrdup(fst);
fstype->code = FSTYPE__AUTO;
return fstype;
}
if (!strcmp(fstype->name, fst))
return fstype;
}
if (i == ARRAY_SIZE(fstypes)) /* ensure we have a room for auto */
pr_err_once("fstypes[] overflow!\n");
return &fstypes[0];
}
......
......@@ -17,6 +17,7 @@ enum fstype {
AUFS = 13;
MQUEUE = 14;
FUSE = 15;
AUTO = 16;
};
message mnt_entry {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment