init: add an init_chroot helper

Add a simple helper to chroot with a kernel space file name and switch
the early init code over to it.  Remove the now unused ksys_chroot.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Этот коммит содержится в:
Christoph Hellwig
2020-07-22 11:26:13 +02:00
родитель db63f1e315
Коммит 4b7ca5014c
7 изменённых файлов: 30 добавлений и 12 удалений

Просмотреть файл

@@ -629,7 +629,7 @@ void __init prepare_namespace(void)
out:
devtmpfs_mount();
init_mount(".", "/", NULL, MS_MOVE, NULL);
ksys_chroot(".");
init_chroot(".");
}
static bool is_tmpfs;

Просмотреть файл

@@ -63,7 +63,7 @@ static int __init init_linuxrc(struct subprocess_info *info, struct cred *new)
/* move initrd over / and chdir/chroot in initrd root */
init_chdir("/root");
init_mount(".", "/", NULL, MS_MOVE, NULL);
ksys_chroot(".");
init_chroot(".");
ksys_setsid();
return 0;
}
@@ -101,7 +101,7 @@ static void __init handle_initrd(void)
/* move initrd to rootfs' /old */
init_mount("..", ".", NULL, MS_MOVE, NULL);
/* switch root and cwd back to / of rootfs */
ksys_chroot("..");
init_chroot("..");
if (new_decode_dev(real_root_dev) == Root_RAM0) {
init_chdir("/old");