why does it not work

This commit is contained in:
apio 2022-10-31 10:23:54 +01:00
parent bc48b64ec6
commit 26ee79fe17
2 changed files with 4 additions and 2 deletions

View File

@ -59,6 +59,7 @@ extern uint64_t clock_now();
TmpFS::TmpFS(const char* name) TmpFS::TmpFS(const char* name)
{ {
m_root = new VFS::Node; m_root = new VFS::Node;
memset(m_root, 0, sizeof(VFS::Node));
m_root->atime = m_root->ctime = m_root->mtime = clock_now(); m_root->atime = m_root->ctime = m_root->mtime = clock_now();
m_root->impl = (uint64_t)this; m_root->impl = (uint64_t)this;
m_root->inode = 0; m_root->inode = 0;
@ -152,8 +153,6 @@ VFS::Node* TmpFS::readdir(VFS::Node* node, long index)
int TmpFS::mkdir(VFS::Node* node, const char* filename, mode_t mode) int TmpFS::mkdir(VFS::Node* node, const char* filename, mode_t mode)
{ {
kinfoln("starting to create directory %s in %s", filename, node->name);
if (!node) return 0; if (!node) return 0;
if (node->inode >= m_dirs.len) return 0; if (node->inode >= m_dirs.len) return 0;
Directory& dir = m_dirs.buf[node->inode]; Directory& dir = m_dirs.buf[node->inode];
@ -189,6 +188,8 @@ int TmpFS::mkdir(VFS::Node* node, const char* filename, mode_t mode)
VFS::Node* new_node = &dir.buf[dir.len - 1]; VFS::Node* new_node = &dir.buf[dir.len - 1];
memset(new_node, 0, sizeof(VFS::Node));
new_node->inode = new_inode; new_node->inode = new_inode;
new_node->atime = new_node->ctime = new_node->mtime = clock_now(); new_node->atime = new_node->ctime = new_node->mtime = clock_now();
new_node->impl = (uint64_t)this; new_node->impl = (uint64_t)this;

View File

@ -370,6 +370,7 @@ void Scheduler::reap_tasks()
static void sched_decrement_sleep_times() static void sched_decrement_sleep_times()
{ {
sched_for_each_task([](Task* task) { sched_for_each_task([](Task* task) {
if (!task) return false;
if (task->task_sleep > 0) if (task->task_sleep > 0)
{ {
task->task_sleep -= frequency; task->task_sleep -= frequency;