main: remove readdir test

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-10 12:59:10 -04:00
commit 2d92031189

View file

@ -50,35 +50,6 @@ static void indent(int indent)
}
}
void printf_dir_recursive(dirent_t *dir, int ind)
{
if (!dir || !dir->inode)
return;
dirent_t *cursor;
struct dir_context ctx = {0};
int res;
while (!(res = vfs_readdir(dir, &ctx, &cursor))) {
if (!cursor || !cursor->inode)
continue;
indent(ind);
kprintf("[inode] %s\n", cursor->name);
if (cursor->inode->mode & S_IFDIR) {
printf_dir_recursive(cursor, ind + 2);
} else {
indent(ind + 1);
char *buf = kalloc(cursor->inode->file_size + 1, ALLOC_KERN);
buf[cursor->inode->file_size] = 0;
vfs_read(cursor->inode, buf, cursor->inode->file_size, 0);
kprintf("%s", buf);
kfree(buf);
}
}
}
static void kmain()
{
/* data types */
@ -114,11 +85,6 @@ static void kmain()
if (res < 0)
panic("failed to load initramfs: %s\n", strerror(-res));
krdy("initramfs loaded\n");
/* read entire initramfs filesystem */
printf_dir_recursive(initramfs->root_dirent, 0);
/* do nothing, for now :) */
yield();
}