From aa5bf63637a5c0aa6ccebd959461bfa1a9d8f0ff Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 19 Sep 2025 01:43:26 -0400 Subject: kernel: vfs: Add initial mount code + mount initrd Signed-off-by: Ian Moffett --- src/sys/os/os_omar.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/sys/os/os_omar.c') diff --git a/src/sys/os/os_omar.c b/src/sys/os/os_omar.c index 186ca57..a75642f 100644 --- a/src/sys/os/os_omar.c +++ b/src/sys/os/os_omar.c @@ -46,6 +46,7 @@ #define OMAR_DIR 1 #define BLOCK_SIZE 512 +static struct vop omar_vops; static const char *__initrd_root = NULL; static size_t initrd_size = 0; @@ -168,6 +169,29 @@ initrd_init(struct fs_info *fip) return 0; } +/* + * Mount the initrd + */ +static int +initrd_mount(struct fs_info *fip, struct mount_args *margs) +{ + int error; + struct vnode *vp; + + if (fip == NULL || margs == NULL) { + return -EINVAL; + } + + error = vfs_valloc(&margs->vp_res, VTYPE_DIR, 0); + if (error < 0) { + return error; + } + + vp = margs->vp_res; + vp->vops = &omar_vops; + return 0; +} + /* * Open an entry within the OMAR initrd * image. @@ -198,6 +222,11 @@ initrd_open(const char *path, char **res) return node.size; } +static struct vop omar_vops = { + .lookup = NULL +}; + struct vfsops g_omar_vfsops = { - .init = initrd_init + .init = initrd_init, + .mount = initrd_mount }; -- cgit v1.2.3