summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-13 15:14:13 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-13 15:14:13 +0200
commit0b760a50b5aee05f1f34c1599b547c8b78d1d737 (patch)
tree8271581cdf49d2eef265d31bd9e1fc30c0ecaf4f /Source/Kernel/Core
parentb808b613a5c7e0b6c6c45b28f7f0169dc13afaa2 (diff)
downloadMelon-0b760a50b5aee05f1f34c1599b547c8b78d1d737.tar.gz
Melon-0b760a50b5aee05f1f34c1599b547c8b78d1d737.zip
Ram file system seems to work \o/
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
index a7bb6e0..19888c9 100644
--- a/Source/Kernel/Core/kmain.wtf.cpp
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -19,6 +19,9 @@
#include <SyscallManager/IDT.ns.h>
#include <Library/String.class.h>
#include <VFS/Part.ns.h>
+#include <FileSystems/RamFS/RamFS.class.h>
+#include <VFS/FileNode.class.h>
+#include <VFS/DirectoryNode.class.h>
#include <Ressources/logo.cd>
#include <Ressources/keymap-fr.wtf.c>
@@ -109,6 +112,13 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
asm volatile("sti");
+ FileSystem* fs = new RamFS(1024 * 1024);
+ DirectoryNode* rd;
+ rd = fs->getRootNode();
+ FileNode* f;
+ f = rd->createFile(String("test"));
+ f->write(0, 4, (u8int*)"plop");
+
while(1) {
kvt->setColor(0);
*kvt << "> ";
@@ -123,6 +133,22 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
*kvt << " - free shows memory usage (physical frames and kernel heap)\n";
*kvt << " - uptime shows seconds since boot\n";
*kvt << " - part shows all detected block devices and partitions\n";
+ } else if (tmp == "ls") {
+ for (u32int i = 0; i < rd->getLength(); i++) {
+ FSNode* n = rd->getChild(i);
+ if (n->type() == NT_FILE) {
+ FileNode* f = (FileNode*)n;
+ *kvt << "Found file " << f->getName() << ", length " << (s32int)f->getLength() << " :\n";
+ u8int* d = (u8int*)Mem::kalloc(f->getLength() + 1);
+ f->read(0, f->getLength(), d);
+ d[f->getLength()] = 0;
+ *kvt << String((const char*)d);
+ Mem::kfree(d);
+ *kvt << "\n";
+ } else if (n->type() == NT_DIRECTORY) {
+ *kvt << "Found directory " << n->getName() << " :\n";
+ }
+ }
} else if (tmp == "reboot") {
Sys::reboot();
} else if (tmp == "devices") {