Compare commits

...

3 Commits

Author SHA1 Message Date
Drew Galbraith 3dce058562 [Victoria Falls] Fix DirEntry member size 2023-07-31 23:42:52 -07:00
Drew Galbraith ef1b5ab9a4 Add a text file to the sysroot for testing ext2 2023-07-31 23:42:52 -07:00
Drew Galbraith db5c9ab859 [libc] Consume the %s format character in vsprintf
Previously we were outputing a single 's' after the string.
2023-07-31 23:42:52 -07:00
5 changed files with 13 additions and 4 deletions

View File

@ -111,6 +111,7 @@ int vsprintf(char *str, const char *format, va_list arg) {
*(str++) = *(instr++);
width++;
}
format++;
break;
}
default:

View File

@ -18,6 +18,8 @@ echo "Loopback device: ${dev}"
cleanup() {
umount efi
rm -rf efi
umount sysroot
rm -rf sysroot
losetup -d $dev
}
trap cleanup EXIT
@ -41,4 +43,9 @@ cp sys/yellowstone/yellowstone efi/sys/yellowstone
cp sys/denali/denali efi/sys/denali
cp sys/victoriafalls/victoriafalls efi/sys/victoriafalls
mkdir -p sysroot
mount "${dev}p2" sysroot/
rsync -a ../sysroot .
ls sysroot/
chown drew:drew $1

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;
}

1
sysroot/text.txt Normal file
View File

@ -0,0 +1 @@
A