Skip to content

Commit

Permalink
make it possible to use --enable-fs more than once
Browse files Browse the repository at this point in the history
Change add_fsname_auto() to join multiple --enable-fs options.

Note: "all" always wins, and "--enable-fs foo,all,bar" results
in fsauto_names = "all" too.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
  • Loading branch information
oleg-nesterov authored and xemul committed Apr 21, 2015
1 parent 03cb8a0 commit 7e93eb3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions mount.c
Expand Up @@ -1365,6 +1365,7 @@ static struct fstype fstypes[32] = {
},
};

static char fsauto_all[] = "all";
static char *fsauto_names;

static bool css_contains(const char *css, const char *str)
Expand All @@ -1391,16 +1392,29 @@ static bool fsname_is_auto(const char *name)
if (!fsauto_names)
return false;

if (strcmp(fsauto_names, "all") == 0)
if (fsauto_names == fsauto_all)
return true;

return css_contains(fsauto_names, name);
}

bool add_fsname_auto(const char *names)
{
xfree(fsauto_names);
fsauto_names = xstrdup(names);
char *old = fsauto_names;

if (old == fsauto_all)
return true;

if (css_contains(names, fsauto_all))
fsauto_names = fsauto_all;
else if (!old)
fsauto_names = xstrdup(names);
else {
fsauto_names = NULL;
asprintf(&fsauto_names, "%s,%s", old, names);
}

xfree(old);
return fsauto_names != NULL;
}

Expand Down

0 comments on commit 7e93eb3

Please sign in to comment.