diff --git a/src/fs/vfs.c b/src/fs/vfs.c index d6b534c..7e15182 100644 --- a/src/fs/vfs.c +++ b/src/fs/vfs.c @@ -2,6 +2,7 @@ #include "vfs.h" #include "sched/mutex.h" #include "mem/allocator.h" +#include "crescent/sys.h" Vfs* VFS_LIST = NULL; static Vfs* VFS_LIST_END = NULL; @@ -29,6 +30,32 @@ void vfs_add(Vfs* vfs) { static VNode* VNODE_LIST = NULL; static Mutex VNODE_LIST_MUTEX = {}; +static int dummy_read_dir(VNode* self, usize* offset, DirEntry* entry) { + return ERR_OPERATION_NOT_SUPPORTED; +} +static int dummy_lookup(VNode* self, Str component, VNode** ret) { + return ERR_OPERATION_NOT_SUPPORTED; +} +static int dummy_read(VNode* self, void* data, usize off, usize size) { + return ERR_OPERATION_NOT_SUPPORTED; +} +static int dummy_stat(VNode* self, Stat* stat) { + return ERR_OPERATION_NOT_SUPPORTED; +} +static int dummy_write(VNode* self, const void* data, usize off, usize size) { + return ERR_OPERATION_NOT_SUPPORTED; +} +static void dummy_release(VNode* self) {} + +static const VNodeOps DUMMY_OPS = { + .read_dir = dummy_read_dir, + .lookup = dummy_lookup, + .read = dummy_read, + .stat = dummy_stat, + .write = dummy_write, + .release = dummy_release +}; + VNode* vnode_alloc() { mutex_lock(&VNODE_LIST_MUTEX); @@ -47,6 +74,8 @@ VNode* vnode_alloc() { return NULL; } memset(node, 0, sizeof(VNode)); + node->ops = DUMMY_OPS; + return node; }