From daa727a83fff0160cbd9e13fd4d831fb869ea8a8 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 1 Mar 2024 20:28:52 -0500 Subject: kernel: vfs_init: Add root vnode Signed-off-by: Ian Moffett --- sys/kern/vfs_init.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys') diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index fb71317..18ab3ac 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,8 @@ static struct fs_info filesystems[] = { { "initramfs", &g_initramfs_ops } }; +struct vnode *g_root_vnode = NULL; + struct fs_info * vfs_byname(const char *name) { @@ -62,6 +65,7 @@ vfs_init(void) struct vfsops *vfsops; vfs_mount_init(); + __assert(vfs_alloc_vnode(&g_root_vnode, NULL, VDIR) == 0); for (int i = 0; i < __ARRAY_COUNT(filesystems); ++i) { info = &filesystems[i]; @@ -70,4 +74,6 @@ vfs_init(void) __assert(vfsops->init != NULL); vfsops->init(info); } + + g_root_vnode->vops = &g_initramfs_vops; } -- cgit v1.2.3