VFS: be more verbose

This commit is contained in:
apio 2022-10-09 21:19:22 +02:00
parent b38c52f8c7
commit 8158ddc94f
2 changed files with 14 additions and 0 deletions

View File

@ -19,5 +19,8 @@ namespace VFS
int32_t read(Node* node, uint32_t offset, uint32_t length, char* buffer); int32_t read(Node* node, uint32_t offset, uint32_t length, char* buffer);
Node* open(const char* filename); Node* open(const char* filename);
void mount_root(Node* root); void mount_root(Node* root);
Node* root();
} }

View File

@ -2,6 +2,7 @@
#include "fs/VFS.h" #include "fs/VFS.h"
#include "log/Log.h" #include "log/Log.h"
#include "std/string.h"
static VFS::Node* vfs_root; 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; 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); return node->read_func(node, offset, length, buffer);
} }
@ -34,6 +38,8 @@ VFS::Node* VFS::open(const char* filename)
return 0; return 0;
} }
kinfoln("open(): opening %s", filename);
return vfs_root->find_func(vfs_root, 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); kinfoln("mounting node '%s' as vfs root", root->name);
vfs_root = root; vfs_root = root;
}
VFS::Node* VFS::root()
{
return vfs_root;
} }