mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
init: add an init_mount helper
Like do_mount, but takes a kernel pointer for the destination path. Switch over the mounts in the init code and devtmpfs to it, which just happen to work due to the implicit set_fs(KERNEL_DS) during early init right now. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
09cbcec07b
commit
c60166f042
9 changed files with 46 additions and 11 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/init_syscalls.h>
|
||||
#include <uapi/linux/mount.h>
|
||||
#include "base.h"
|
||||
|
||||
|
@ -359,7 +360,7 @@ int __init devtmpfs_mount(void)
|
|||
if (!thread)
|
||||
return 0;
|
||||
|
||||
err = do_mount("devtmpfs", "dev", "devtmpfs", MS_SILENT, NULL);
|
||||
err = init_mount("devtmpfs", "dev", "devtmpfs", MS_SILENT, NULL);
|
||||
if (err)
|
||||
printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
|
||||
else
|
||||
|
@ -408,7 +409,7 @@ static int __init devtmpfs_setup(void *p)
|
|||
err = ksys_unshare(CLONE_NEWNS);
|
||||
if (err)
|
||||
goto out;
|
||||
err = do_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, NULL);
|
||||
err = init_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, NULL);
|
||||
if (err)
|
||||
goto out;
|
||||
ksys_chdir("/.."); /* will traverse into overmounted root */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue