diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-19 01:43:26 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-19 01:53:32 -0400 |
commit | aa5bf63637a5c0aa6ccebd959461bfa1a9d8f0ff (patch) | |
tree | c2adcd0eef842ea73f8ff85168ee48c3b4875907 /src/sys/os/os_omar.c | |
parent | 017a6a964c06eb8a3dbe30281d5a3bb3ac8f3ca5 (diff) |
kernel: vfs: Add initial mount code + mount initrd
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/os/os_omar.c')
-rw-r--r-- | src/sys/os/os_omar.c | 31 |
1 files changed, 30 insertions, 1 deletions
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; @@ -169,6 +170,29 @@ initrd_init(struct fs_info *fip) } /* + * 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 }; |