Commit 6400fc95 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

simplify the "ignore filesystem-subtype" logic

We can simply overwrite the dot symbol right after the kernel reports
it to us.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 323726b7
......@@ -1344,7 +1344,7 @@ bool add_fsname_auto(const char *names)
return fsauto_names != NULL;
}
static struct fstype *__find_fstype_by_name(char *_fst, bool force_auto)
static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
{
int i;
......@@ -1354,22 +1354,7 @@ static struct fstype *__find_fstype_by_name(char *_fst, bool force_auto)
* anything is wrong, almost every fs has its own features)
* 2nd -- save some space in the image (since we scan all
* names anyway)
*
* The kernel reports "subtypes" sometimes and the valid
* type-vs-subtype delimiter is the dot symbol. We disregard any
* subtypes for the purpose of finding the fstype.
*/
char fst[1024];
for (i = 0; _fst[i] && i < sizeof(fst) - 1; i++) {
if (_fst[i] == '.')
break;
fst[i] = _fst[i];
}
fst[i] = 0;
for (i = 1; i < ARRAY_SIZE(fstypes); i++) {
struct fstype *fstype = fstypes + i;
......
......@@ -947,7 +947,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
{
unsigned int kmaj, kmin;
int ret, n;
char *opt = NULL;
char *sub, *opt = NULL;
new->mountpoint = xmalloc(PATH_MAX);
if (new->mountpoint == NULL)
......@@ -981,6 +981,14 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
ret = sscanf(str, "%ms %ms %ms", fsname, &new->source, &opt);
if (ret != 3)
goto err;
/*
* The kernel reports "subtypes" sometimes and the valid
* type-vs-subtype delimiter is the dot symbol. We disregard
* any subtypes for the purpose of finding the fstype.
*/
sub = strchr(*fsname, '.');
if (sub)
*sub = 0;
new->fstype = find_fstype_by_name(*fsname);
......
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