mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 05:38:21 +00:00
vfs: use mutexes for locking
This commit is contained in:
@@ -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,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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user