diff options
Diffstat (limited to 'src/kernel/fs/initrd.c')
-rw-r--r-- | src/kernel/fs/initrd.c | 26 |
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 |