summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-11-21 13:59:34 -0500
committerIan Moffett <ian@osmora.org>2025-11-21 13:59:34 -0500
commit9600d3df3e1b75cff0e3ecd20ae3ca2fe393eb8b (patch)
tree9e93670ab016c8e60d4e8894b8cf7e9154398734 /sys/kern
parent794b3671ed636c4fb8a74e1cf3a636272d4fa3d9 (diff)
kern: vfs: Decouple mounting from initialization
Upon bootup, all filesystems are to be enumerated and initialized before they are mounted. Some filesystems may decide to mount themselves right away. However, it is crucial to keep mounting and initialization seperate. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_init.c11
-rw-r--r--sys/kern/vfs_mount.c8
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 6372f3d..08be17a 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -87,18 +87,17 @@ vfs_init(void)
continue;
}
- /* Mount if we can */
- if (ops->mount != NULL) {
- error = ops->mount(fip, NULL);
+ /* Initialize the filesystem */
+ if (ops->init != NULL) {
+ error = ops->init(fip);
}
if (error != 0) {
- dtrace("failed to mount %s\n", fip->name);
+ dtrace("failed to init %s\n", fip->name);
continue;
}
- dtrace("mounted %s\n", fip->name);
- fip->is_mounted = 1;
+ dtrace("initialized %s\n", fip->name);
++mount_count;
}
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 51a464a..39f98d2 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -74,6 +74,7 @@ int
mount(struct mount_args *margs)
{
struct fs_info *fip;
+ struct vfsops *vfsops;
struct mount *mp;
int error;
@@ -95,13 +96,18 @@ mount(struct mount_args *margs)
return error;
}
+ vfsops = fip->vfsops;
+ if (vfsops->mount == NULL) {
+ return -ENOTSUP;
+ }
+
mp = kalloc(sizeof(*mp));
if (mp == NULL) {
return -ENOMEM;
}
mp->fip = fip;
- error = vnode_init(&mp->vp, VDIR);
+ error = vfsops->mount(fip, mp);
if (error < 0) {
kfree(mp);
return error;