main: remove readdir test
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
898570d0ca
commit
2d92031189
1 changed files with 0 additions and 34 deletions
34
init/main.c
34
init/main.c
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue