mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
vfs: use mutexes for locking
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef _VFS_H
|
||||
#define _VFS_H
|
||||
|
||||
#include <mutex.h>
|
||||
#include <spinlock.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -57,7 +58,7 @@ typedef struct vfs_t {
|
||||
|
||||
typedef struct vnode_t {
|
||||
struct vops_t *ops;
|
||||
spinlock_t lock;
|
||||
mutex_t lock;
|
||||
int refcount;
|
||||
int flags;
|
||||
int type;
|
||||
@@ -112,15 +113,15 @@ typedef struct vops_t {
|
||||
|
||||
#define VOP_INIT(vn, o, f, t, v) \
|
||||
(vn)->ops = o; \
|
||||
SPINLOCK_INIT((vn)->lock); \
|
||||
MUTEX_INIT(&(vn)->lock); \
|
||||
(vn)->refcount = 1; \
|
||||
(vn)->flags = f; \
|
||||
(vn)->type = t; \
|
||||
(vn)->vfs = v; \
|
||||
(vn)->vfsmounted = NULL;
|
||||
|
||||
#define VOP_LOCK(v) spinlock_acquire(&(v)->lock)
|
||||
#define VOP_UNLOCK(v) spinlock_release(&(v)->lock)
|
||||
#define VOP_LOCK(v) MUTEX_ACQUIRE(&(v)->lock, false)
|
||||
#define VOP_UNLOCK(v) MUTEX_RELEASE(&(v)->lock)
|
||||
|
||||
#define VOP_OPEN(v, f, c) (*v)->ops->open(v, f, c)
|
||||
#define VOP_CLOSE(v, f, c) (v)->ops->close(v, f, c)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _VMM_H
|
||||
|
||||
#include <arch/mmu.h>
|
||||
#include <spinlock.h>
|
||||
#include <mutex.h>
|
||||
#include <kernel/vfs.h>
|
||||
|
||||
#define VMM_FLAGS_PAGESIZE 1
|
||||
|
||||
@@ -27,6 +27,4 @@ void semaphore_signal(semaphore_t *sem);
|
||||
bool semaphore_test(semaphore_t *sem);
|
||||
bool semaphore_haswaiters(semaphore_t *sem);
|
||||
|
||||
#include <kernel/scheduler.h>
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user