aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/fs/initrd.c
diff options
context:
space:
mode:
authorMarvin Borner2019-10-31 00:49:00 +0100
committerMarvin Borner2019-10-31 00:49:00 +0100
commit7d5a9792e57b4088cce5cc97837eb04016b57a4d (patch)
tree11eac7aa426f3cb597a3ebd2b08cef0d99e9c0cf /src/kernel/fs/initrd.c
parent91439462f5ad77eb128658229724c9a3660a2068 (diff)
Implemented basic syscalls and user mode
Doesn't completely work right now
Diffstat (limited to 'src/kernel/fs/initrd.c')
-rw-r--r--src/kernel/fs/initrd.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kernel/fs/initrd.c b/src/kernel/fs/initrd.c
index 906498e..acaceb8 100644
--- a/src/kernel/fs/initrd.c
+++ b/src/kernel/fs/initrd.c
@@ -4,6 +4,7 @@
#include <kernel/lib/lib.h>
#include <kernel/lib/alloc.h>
#include <kernel/io/io.h>
+#include <kernel/graphics/vesa.h>
initrd_header_t *initrd_header;
initrd_file_header_t *file_headers;
@@ -103,3 +104,28 @@ fs_node_t *initialise_initrd(uint32_t location) {
}
return initrd_root;
}
+
+void initrd_test() {
+ int i = 0;
+ struct dirent *node = 0;
+ vesa_draw_string("\n");
+ while ((node = readdir_fs(fs_root, i)) != 0) {
+ vesa_draw_string("Found file: ");
+ vesa_draw_string(node->name);
+ vesa_draw_string("\n");
+ fs_node_t *fsnode = finddir_fs(fs_root, node->name);
+
+ if ((fsnode->flags & 0x7) == FS_DIRECTORY)
+ vesa_draw_string("\t (directory)\n");
+ else {
+ vesa_draw_string("\t contents: \"");
+ uint8_t buf[fsnode->length];
+ uint32_t sz = read_fs(fsnode, 0, fsnode->length, buf);
+ for (uint32_t j = 0; j < sz; j++)
+ vesa_draw_char(buf[j]);
+
+ vesa_draw_string("\"\n");
+ }
+ i++;
+ }
+} \ No newline at end of file