summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-01 20:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-01 20:28:52 -0500
commitdaa727a83fff0160cbd9e13fd4d831fb869ea8a8 (patch)
treec5cfa0e912a0682f0f37df0dc4244a215c4440df /sys/kern
parentf07313259fa422581b64b5b22d1de575d710df52 (diff)
kernel: vfs_init: Add root vnode
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_init.c6
1 files changed, 6 insertions, 0 deletions
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 <sys/cdefs.h>
#include <sys/mount.h>
#include <sys/types.h>
+#include <sys/vnode.h>
#include <fs/initramfs.h>
#include <assert.h>
#include <string.h>
@@ -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;
}