vfs: use mutexes for locking

This commit is contained in:
Matheus
2023-07-26 20:29:40 -03:00
parent d77d7b9b3e
commit 49eef0e04c
8 changed files with 12 additions and 19 deletions
+1 -3
View File
@@ -331,9 +331,7 @@ static vops_t vnops = {
static void ctor(scache_t *cache, void *obj) {
devnode_t *node = obj;
memset(node, 0, sizeof(devnode_t));
node->vnode.refcount = 1;
SPINLOCK_INIT(node->vnode.lock);
node->vnode.ops = &vnops;
VOP_INIT(&node->vnode, &vnops, 0, 0, NULL)
node->attr.inode = ++currentinode;
}
+2
View File
@@ -2,6 +2,8 @@
#include <kernel/alloc.h>
#include <kernel/timekeeper.h>
#include <kernel/slab.h>
#include <kernel/vmm.h>
#include <arch/cpu.h>
#include <kernel/pmm.h>
#include <hashtable.h>
#include <mutex.h>
+1 -4
View File
@@ -234,13 +234,10 @@ static vops_t vnops = {
static void ctor(scache_t *cache, void *obj) {
pipenode_t *node = obj;
memset(node, 0, sizeof(pipenode_t));
node->vnode.refcount = 1;
SPINLOCK_INIT(node->vnode.lock);
node->vnode.ops = &vnops;
VOP_INIT(&node->vnode, &vnops, 0, 0, NULL);
node->attr.inode = ++currentinode;
EVENT_INIT(&node->writeevent);
EVENT_INIT(&node->readevent);
node->vnode.type = V_TYPE_FIFO;
}
void pipefs_init() {
+1 -5
View File
@@ -530,11 +530,7 @@ static tmpfsnode_t *newnode(vfs_t *vfs, int type) {
node->attr.type = type;
node->attr.inode = ++((tmpfs_t *)vfs)->inodenumber;
node->vnode.type = type;
node->vnode.refcount = 1;
SPINLOCK_INIT(node->vnode.lock);
node->vnode.ops = &vnops;
node->vnode.vfs = vfs;
VOP_INIT(&node->vnode, &vnops, 0, type, vfs);
return node;
}