init: add an init_dup helper

Add a simple helper to grab a reference to a file and install it at
the next available fd, and switch the early init code over to it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
这个提交包含在:
Christoph Hellwig
2020-07-28 17:49:47 +02:00
提交者 Al Viro
父节点 235e57935b
当前提交 f073531070
修改 3 个文件,包含 17 行新增4 行删除

查看文件

@@ -1467,10 +1467,10 @@ void __init console_on_rootfs(void)
pr_err("Warning: unable to open an initial console.\n");
return;
}
get_file_rcu_many(file, 2);
fd_install(get_unused_fd_flags(0), file);
fd_install(get_unused_fd_flags(0), file);
fd_install(get_unused_fd_flags(0), file);
init_dup(file);
init_dup(file);
init_dup(file);
fput(file);
}
static noinline void __init kernel_init_freeable(void)