From 8158ddc94fd483685bf77308e810d85228e25122 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 9 Oct 2022 21:19:22 +0200 Subject: [PATCH] VFS: be more verbose --- kernel/include/fs/VFS.h | 3 +++ kernel/src/fs/VFS.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/kernel/include/fs/VFS.h b/kernel/include/fs/VFS.h index 082dbe8f..928d579c 100644 --- a/kernel/include/fs/VFS.h +++ b/kernel/include/fs/VFS.h @@ -19,5 +19,8 @@ namespace VFS int32_t read(Node* node, uint32_t offset, uint32_t length, char* buffer); Node* open(const char* filename); + void mount_root(Node* root); + + Node* root(); } \ No newline at end of file diff --git a/kernel/src/fs/VFS.cpp b/kernel/src/fs/VFS.cpp index 047cc645..f64b7cf3 100644 --- a/kernel/src/fs/VFS.cpp +++ b/kernel/src/fs/VFS.cpp @@ -2,6 +2,7 @@ #include "fs/VFS.h" #include "log/Log.h" +#include "std/string.h" static VFS::Node* vfs_root; @@ -18,6 +19,9 @@ int32_t VFS::read(Node* node, uint32_t offset, uint32_t length, char* buffer) return -1; } + kdbgln("read(): node %s (inode %ld), offset %d, %d bytes, into %p", node->name, node->inode, offset, length, + (void*)buffer); + return node->read_func(node, offset, length, buffer); } @@ -34,6 +38,8 @@ VFS::Node* VFS::open(const char* filename) return 0; } + kinfoln("open(): opening %s", filename); + return vfs_root->find_func(vfs_root, filename); } @@ -51,4 +57,9 @@ void VFS::mount_root(Node* root) } kinfoln("mounting node '%s' as vfs root", root->name); vfs_root = root; +} + +VFS::Node* VFS::root() +{ + return vfs_root; } \ No newline at end of file