vfs: rethink fs_type.fs_mount

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-05 20:00:09 +02:00
commit 8c346a7018
2 changed files with 4 additions and 12 deletions

View file

@ -193,15 +193,9 @@ static ssize_t get_dents(inode_t *parent, dirent_t **dents)
return n; return n;
} }
static dirent_t *mount(int flags, struct block_device *bdev) static int init(int flags, inode_t *inode, fs_t **out)
{ {
fs_t *new_fs; return ramfs_create(flags, out);
ssize_t res = ramfs_create(flags, &new_fs);
if (res < 0)
return NULL;
return new_fs->root_dirent;
} }
static int umount(fs_t *fs) static int umount(fs_t *fs)
@ -229,7 +223,7 @@ void ramfs_init(void)
ramfs_inode_ops->unlink = unlink; ramfs_inode_ops->unlink = unlink;
ramfs_inode_ops->get_dents = get_dents; ramfs_inode_ops->get_dents = get_dents;
struct fs_type ramfs_type = {.name = "ramfs", .fs_mount = mount, .fs_umount = umount}; struct fs_type ramfs_type = {.name = "ramfs", .init = init, .fs_umount = umount};
vfs_register(&ramfs_type); vfs_register(&ramfs_type);
} }

View file

@ -5,8 +5,6 @@
#include <kernel/spinlock.h> #include <kernel/spinlock.h>
#include <fs/inode.h> #include <fs/inode.h>
#include <drivers/block.h>
#include <lib/rwlock.h> #include <lib/rwlock.h>
#include <lib/list.h> #include <lib/list.h>
@ -33,7 +31,7 @@
struct fs_type { struct fs_type {
char name[256]; char name[256];
dirent_t *(*fs_mount)(int flags, struct block_device *bdev); int (*init)(int flags, inode_t *inode, fs_t **out);
int (*fs_umount)(fs_t *fs); int (*fs_umount)(fs_t *fs);
}; };