[Victoria Falls] Fix DirEntry member size

This commit is contained in:
Drew Galbraith 2023-07-31 23:42:42 -07:00
parent ef1b5ab9a4
commit 3dce058562
2 changed files with 4 additions and 4 deletions

View File

@ -65,7 +65,7 @@ struct Inode {
struct DirEntry {
uint32_t inode;
uint32_t record_length;
uint16_t record_length;
uint8_t name_len;
uint8_t file_type;
char name[256];

View File

@ -81,13 +81,13 @@ glcr::ErrorCode Ext2Driver::ProbeDirectory(Inode* inode) {
uint64_t addr = block.vaddr();
while (addr < block.vaddr() + ext2_reader_.BlockSize()) {
DirEntry* entry = reinterpret_cast<DirEntry*>(addr);
dbgln("Entry: inode: %x, rec_len %x, name_len %x", entry->inode,
entry->record_length, entry->name_len);
dbgln("Entry: inode: %x, rec_len %x, name_len %x, file_type: %x",
entry->inode, entry->record_length, entry->name_len,
entry->file_type);
// FIXME: We need a method to construct a string that is *up to* a certain
// length. As illustrated below the provided name_len is 0x2e but the
// first character is \0 since this is the self-referencial inode.
glcr::String name(entry->name, entry->name_len);
dbgln("%x, %x", name.length(), glcr::String(entry->name).length());
dbgln("%s", name.cstr());
addr += entry->record_length;
}