fs: add ksys_mount() helper; remove in-kernel calls to sys_mount()
Using this helper allows us to avoid the in-kernel calls to the sys_mount() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_mount(). In the near future, all callers of ksys_mount() should be converted to call do_mount() directly. This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -43,7 +43,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new)
|
||||
sys_dup(0);
|
||||
/* move initrd over / and chdir/chroot in initrd root */
|
||||
sys_chdir("/root");
|
||||
sys_mount(".", "/", NULL, MS_MOVE, NULL);
|
||||
ksys_mount(".", "/", NULL, MS_MOVE, NULL);
|
||||
sys_chroot(".");
|
||||
sys_setsid();
|
||||
return 0;
|
||||
@@ -81,7 +81,7 @@ static void __init handle_initrd(void)
|
||||
current->flags &= ~PF_FREEZER_SKIP;
|
||||
|
||||
/* move initrd to rootfs' /old */
|
||||
sys_mount("..", ".", NULL, MS_MOVE, NULL);
|
||||
ksys_mount("..", ".", NULL, MS_MOVE, NULL);
|
||||
/* switch root and cwd back to / of rootfs */
|
||||
sys_chroot("..");
|
||||
|
||||
@@ -95,7 +95,7 @@ static void __init handle_initrd(void)
|
||||
mount_root();
|
||||
|
||||
printk(KERN_NOTICE "Trying to move old root to /initrd ... ");
|
||||
error = sys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL);
|
||||
error = ksys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL);
|
||||
if (!error)
|
||||
printk("okay\n");
|
||||
else {
|
||||
|
Reference in New Issue
Block a user