Commit 7e93eb3b authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

make it possible to use --enable-fs more than once

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: 's avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 03cb8a0a
...@@ -1365,6 +1365,7 @@ static struct fstype fstypes[32] = { ...@@ -1365,6 +1365,7 @@ static struct fstype fstypes[32] = {
}, },
}; };
static char fsauto_all[] = "all";
static char *fsauto_names; static char *fsauto_names;
static bool css_contains(const char *css, const char *str) static bool css_contains(const char *css, const char *str)
...@@ -1391,7 +1392,7 @@ static bool fsname_is_auto(const char *name) ...@@ -1391,7 +1392,7 @@ static bool fsname_is_auto(const char *name)
if (!fsauto_names) if (!fsauto_names)
return false; return false;
if (strcmp(fsauto_names, "all") == 0) if (fsauto_names == fsauto_all)
return true; return true;
return css_contains(fsauto_names, name); return css_contains(fsauto_names, name);
...@@ -1399,8 +1400,21 @@ static bool fsname_is_auto(const char *name) ...@@ -1399,8 +1400,21 @@ static bool fsname_is_auto(const char *name)
bool add_fsname_auto(const char *names) bool add_fsname_auto(const char *names)
{ {
xfree(fsauto_names); char *old = fsauto_names;
fsauto_names = xstrdup(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; return fsauto_names != NULL;
} }
......
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