KraKern

C++ Kernel
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/KraKern

commit 2afc6d6ce448940ad25cfce05726be1d78d1e634
parent f8b5648587540b12d56f7d61baaa174225b3fe17
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon,  1 Feb 2016 13:53:12 +0100

Fix(Filesystem): Little fix on root reassignation

Diffstat:
Mkernel/FileSystem.cpp | 4++--
Mkernel/Kernel.cpp | 14++++++++++++++
Mkernel/main.cpp | 2++
Mqemu.sh | 2+-
4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/kernel/FileSystem.cpp b/kernel/FileSystem.cpp @@ -7,8 +7,8 @@ void FileSystem::init(void) { this->_root = new File("/", TYPE_DIRECTORY); this->_dev = this->_root->create_child("dev", TYPE_DIRECTORY); this->_var = this->_root->create_child("env", TYPE_DIRECTORY); - this->_root = this->_root->create_child("proc", TYPE_DIRECTORY); - this->_root = this->_root->create_child("mnt", TYPE_DIRECTORY); + this->_root->create_child("proc", TYPE_DIRECTORY); + this->_root->create_child("mnt", TYPE_DIRECTORY); sysd = this->_root->create_child("sys", TYPE_DIRECTORY); sysd->create_child("usr", TYPE_DIRECTORY); sysd->create_child("modules", TYPE_DIRECTORY); diff --git a/kernel/Kernel.cpp b/kernel/Kernel.cpp @@ -7,6 +7,18 @@ extern Memory __mem; extern Keyboard __keyboard; Kernel __kern; +void list_files(File *root, int depth) { + File *tmp; + + for (tmp = root->get_child(); tmp; tmp = tmp->get_next()) { + for (int i = 0; i < depth; __kern.io.puts(" "), i++); + __kern.io.puts(tmp->get_name()); + __kern.io.puts("\n"); + if (tmp->get_child()) + list_files(tmp, depth + 1); + } +} + Kernel::Kernel(void) { } @@ -27,6 +39,8 @@ void Kernel::init(multiboot_info *mbi) { this->fs.init(); this->pt = *(new ProcessTable()); this->pt.init(); + //__kern.io.clear(); + //list_files(this->fs.get_root(), 0); while (1); } diff --git a/kernel/main.cpp b/kernel/main.cpp @@ -3,6 +3,8 @@ # include <Io.hpp> extern Kernel __kern; +void list_files(File *root, int depth); + extern "C" void kmain(multiboot_info *info) { // Main class initialization __kern.init(info); diff --git a/qemu.sh b/qemu.sh @@ -1,2 +1,2 @@ #!/bin/bash -kvm -m 1024 -s -hda ./kern.img -serial /dev/tty -redir tcp:2323::23 #-curses +sudo kvm -m 1024 -s -hda ./kern.img -serial /dev/tty -redir tcp:2323::23 -curses