fs_init: change to_mount to block_device
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
d2c698ac0a
commit
07ea385f96
8 changed files with 73 additions and 2 deletions
|
|
@ -104,6 +104,7 @@ static ssize_t read_next(fs_t *fs, const char *file, rbtree_t *list, dirent_t **
|
|||
if (res == 0) {
|
||||
new_dent->fs = parent->fs;
|
||||
new_dent->parent = parent;
|
||||
dirent_inc_ref(parent);
|
||||
*out = new_dent;
|
||||
} else {
|
||||
inode_dec_ref(existing_ino);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ int dirent_populate_children(dirent_t *dir)
|
|||
goto cleanup;
|
||||
|
||||
insert->parent = dir;
|
||||
dirent_inc_ref(dir);
|
||||
|
||||
if (!list_insert(&inode->dirents, insert)) {
|
||||
dirent_free(insert);
|
||||
|
|
@ -211,6 +212,9 @@ dirent_t *dirent_dup(dirent_t *src)
|
|||
ret->fs = src->fs;
|
||||
ret->parent = src->parent;
|
||||
|
||||
if (ret->parent)
|
||||
dirent_inc_ref(ret->parent);
|
||||
|
||||
if (src->inode) {
|
||||
inode_inc_ref(src->inode);
|
||||
ret->inode = src->inode;
|
||||
|
|
@ -221,6 +225,9 @@ dirent_t *dirent_dup(dirent_t *src)
|
|||
|
||||
void dirent_free(dirent_t *dirent)
|
||||
{
|
||||
if (dirent->parent)
|
||||
dirent_dec_ref(dirent->parent);
|
||||
|
||||
kfree(dirent->name);
|
||||
slab_free(dirent_slab, dirent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ static ssize_t get_dents(inode_t *parent, dirent_t **dents)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int init(int flags, dirent_t *to_mount, fs_t **out)
|
||||
static int init(int flags, struct block_device *to_mount, fs_t **out)
|
||||
{
|
||||
return ramfs_create(flags, out);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t
|
|||
|
||||
new_dirent->fs = fs;
|
||||
new_dirent->parent = parent;
|
||||
dirent_inc_ref(parent);
|
||||
*out = new_dirent;
|
||||
write_unlock(&ino->rwlock);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue