vfs: further switch to dirent tracking

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-04 00:08:16 +02:00
commit 7799f3b622
3 changed files with 7 additions and 16 deletions

View file

@ -64,8 +64,9 @@ static int next_level(const char *path, inode_t *dir, dirent_t **out_dirent)
spinlock_acquire(&dirent->lock);
if (!dirent->inode) {
fs_t *fs = dir->fs;
res = fs->fs_ops.open_inode(fs, dirent->ino_num, &dirent->inode);
fs_t *fs = dir->dentry->fs;
u64 inum = dirent->ino_num;
res = fs->fs_ops.open_inode(fs, inum, dirent, &dirent->inode);
if (res < 0) {
spinlock_release(&dirent->lock);
return res;

View file

@ -46,10 +46,10 @@ struct inode_ops {
};
struct _inode {
fs_t *fs;
u64 mode;
u64 ino_num;
u64 file_size;
dirent_t *dentry;
u64 flags;
@ -65,6 +65,7 @@ struct _inode {
};
struct _dirent {
fs_t *fs;
inode_t *inode;
union {
u64 ino_num;

View file

@ -17,9 +17,9 @@ struct fs_type {
};
struct fs_ops {
int (*alloc_inode)(fs_t *fs, inode_t **out);
int (*alloc_inode)(fs_t *fs, dirent_t **out);
int (*free_inode)(fs_t *fs, inode_t *inode);
int (*open_inode)(fs_t *fs, u64 id, inode_t **out);
int (*open_inode)(fs_t *fs, u64 id, dirent_t *dirent, inode_t **out);
};
struct _fs {
@ -36,17 +36,6 @@ struct _fs {
struct fs_ops fs_ops;
};
struct ram_file {
u64 type;
u64 extra;
char *name;
size_t name_len;
void *data;
size_t data_size;
size_t file_size;
};
/* VFS ops */
void vfs_init();
void vfs_register(struct fs_type *fs);