diff options
author | Ian Moffett <ian@osmora.org> | 2024-03-01 20:28:52 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-03-01 20:28:52 -0500 |
commit | daa727a83fff0160cbd9e13fd4d831fb869ea8a8 (patch) | |
tree | c5cfa0e912a0682f0f37df0dc4244a215c4440df | |
parent | f07313259fa422581b64b5b22d1de575d710df52 (diff) |
kernel: vfs_init: Add root vnode
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/kern/vfs_init.c | 6 |
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; } |