Commit e24d12b7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

init: split get_fs_names

Split get_fs_names into one function that splits up the command line
argument, and one that gets the list of all registered file systems.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e73f0f0e
...@@ -338,30 +338,31 @@ __setup("rootflags=", root_data_setup); ...@@ -338,30 +338,31 @@ __setup("rootflags=", root_data_setup);
__setup("rootfstype=", fs_names_setup); __setup("rootfstype=", fs_names_setup);
__setup("rootdelay=", root_delay_setup); __setup("rootdelay=", root_delay_setup);
static void __init get_fs_names(char *page) static void __init split_fs_names(char *page, char *names)
{ {
char *s = page; strcpy(page, root_fs_names);
while (*page++) {
if (root_fs_names) { if (page[-1] == ',')
strcpy(page, root_fs_names); page[-1] = '\0';
while (*s++) { }
if (s[-1] == ',') *page = '\0';
s[-1] = '\0'; }
}
} else {
int len = get_filesystem_list(page);
char *p, *next;
page[len] = '\0'; static void __init get_all_fs_names(char *page)
for (p = page-1; p; p = next) { {
next = strchr(++p, '\n'); int len = get_filesystem_list(page);
if (*p++ != '\t') char *s = page, *p, *next;
continue;
while ((*s++ = *p++) != '\n') page[len] = '\0';
; for (p = page - 1; p; p = next) {
s[-1] = '\0'; next = strchr(++p, '\n');
} if (*p++ != '\t')
continue;
while ((*s++ = *p++) != '\n')
;
s[-1] = '\0';
} }
*s = '\0'; *s = '\0';
} }
...@@ -411,7 +412,10 @@ void __init mount_block_root(char *name, int flags) ...@@ -411,7 +412,10 @@ void __init mount_block_root(char *name, int flags)
scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)", scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)",
MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
get_fs_names(fs_names); if (root_fs_names)
split_fs_names(fs_names, root_fs_names);
else
get_all_fs_names(fs_names);
retry: retry:
for (p = fs_names; *p; p += strlen(p)+1) { for (p = fs_names; *p; p += strlen(p)+1) {
int err = do_mount_root(name, p, flags, root_mount_data); int err = do_mount_root(name, p, flags, root_mount_data);
......
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