Skip to content

Commit e24d12b

Browse files
Christoph HellwigAl Viro
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent e73f0f0 commit e24d12b

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

init/do_mounts.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -338,30 +338,31 @@ __setup("rootflags=", root_data_setup);
338338
__setup("rootfstype=", fs_names_setup);
339339
__setup("rootdelay=", root_delay_setup);
340340

341-
static void __init get_fs_names(char *page)
341+
static void __init split_fs_names(char *page, char *names)
342342
{
343-
char *s = page;
344-
345-
if (root_fs_names) {
346-
strcpy(page, root_fs_names);
347-
while (*s++) {
348-
if (s[-1] == ',')
349-
s[-1] = '\0';
350-
}
351-
} else {
352-
int len = get_filesystem_list(page);
353-
char *p, *next;
343+
strcpy(page, root_fs_names);
344+
while (*page++) {
345+
if (page[-1] == ',')
346+
page[-1] = '\0';
347+
}
348+
*page = '\0';
349+
}
354350

355-
page[len] = '\0';
356-
for (p = page-1; p; p = next) {
357-
next = strchr(++p, '\n');
358-
if (*p++ != '\t')
359-
continue;
360-
while ((*s++ = *p++) != '\n')
361-
;
362-
s[-1] = '\0';
363-
}
351+
static void __init get_all_fs_names(char *page)
352+
{
353+
int len = get_filesystem_list(page);
354+
char *s = page, *p, *next;
355+
356+
page[len] = '\0';
357+
for (p = page - 1; p; p = next) {
358+
next = strchr(++p, '\n');
359+
if (*p++ != '\t')
360+
continue;
361+
while ((*s++ = *p++) != '\n')
362+
;
363+
s[-1] = '\0';
364364
}
365+
365366
*s = '\0';
366367
}
367368

@@ -411,7 +412,10 @@ void __init mount_block_root(char *name, int flags)
411412

412413
scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)",
413414
MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
414-
get_fs_names(fs_names);
415+
if (root_fs_names)
416+
split_fs_names(fs_names, root_fs_names);
417+
else
418+
get_all_fs_names(fs_names);
415419
retry:
416420
for (p = fs_names; *p; p += strlen(p)+1) {
417421
int err = do_mount_root(name, p, flags, root_mount_data);

0 commit comments

Comments
 (0)