WIP: Implement a read-write in-memory tmpfs #15
@ -59,6 +59,7 @@ extern uint64_t clock_now();
|
||||
TmpFS::TmpFS(const char* name)
|
||||
{
|
||||
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->impl = (uint64_t)this;
|
||||
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)
|
||||
{
|
||||
kinfoln("starting to create directory %s in %s", filename, node->name);
|
||||
|
||||
if (!node) return 0;
|
||||
if (node->inode >= m_dirs.len) return 0;
|
||||
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];
|
||||
|
||||
memset(new_node, 0, sizeof(VFS::Node));
|
||||
|
||||
new_node->inode = new_inode;
|
||||
new_node->atime = new_node->ctime = new_node->mtime = clock_now();
|
||||
new_node->impl = (uint64_t)this;
|
||||
|
@ -370,6 +370,7 @@ void Scheduler::reap_tasks()
|
||||
static void sched_decrement_sleep_times()
|
||||
{
|
||||
sched_for_each_task([](Task* task) {
|
||||
if (!task) return false;
|
||||
if (task->task_sleep > 0)
|
||||
{
|
||||
task->task_sleep -= frequency;
|
||||
|
Loading…
Reference in New Issue
Block a user