Move userspace to a templated StrFormat.

This commit is contained in:
Drew Galbraith 2023-11-03 02:48:21 -07:00
parent d9df1212b7
commit 26b61db021
25 changed files with 263 additions and 217 deletions

View file

@ -63,23 +63,23 @@ glcr::ErrorOr<glcr::Vector<DirEntry>> Ext2Driver::ReadDirectory(
glcr::Vector<DirEntry> directory;
for (uint64_t i = 0; i < real_block_cnt; i++) {
dbgln("Getting block %lx", inode->block[i]);
dbgln("Getting block {x}", inode->block[i]);
ASSIGN_OR_RETURN(MappedMemoryRegion block,
ext2_reader_->ReadBlock(inode->block[i]));
uint64_t addr = block.vaddr();
while (addr < block.vaddr() + ext2_reader_->BlockSize()) {
DirEntry* entry = reinterpret_cast<DirEntry*>(addr);
directory.PushBack(*entry);
glcr::String name(entry->name, entry->name_len);
glcr::StringView name(entry->name, entry->name_len);
switch (entry->file_type) {
case kExt2FtFile:
dbgln("FILE (0x%x): %s", entry->inode, name.cstr());
dbgln("FILE (0x{x}): {}", entry->inode, name);
break;
case kExt2FtDirectory:
dbgln("DIR (0x%x): %s", entry->inode, name.cstr());
dbgln("DIR (0x{x}): {}", entry->inode, name);
break;
default:
dbgln("UNK (0x%x): %s", entry->inode, name.cstr());
dbgln("UNK (0x{x}): {}", entry->inode, name);
}
addr += entry->record_length;
}

View file

@ -15,7 +15,7 @@ uint64_t main(uint64_t init_cap) {
Empty empty;
DenaliInfo denali_info;
RET_ERR(yellowstone.GetDenali(empty, denali_info));
dbgln("LBA (recv): %u", denali_info.lba_offset());
dbgln("LBA (recv): {x}", denali_info.lba_offset());
ScopedDenaliClient denali(denali_info.denali_endpoint(),
denali_info.device_id(), denali_info.lba_offset());
ASSIGN_OR_RETURN(Ext2Driver ext2, Ext2Driver::Init(glcr::Move(denali)));

View file

@ -28,7 +28,7 @@ glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest& request,
ASSIGN_OR_RETURN(files, driver_.ReadDirectory(files.at(j).inode));
}
}
dbgln("Directory '%s' not found.", glcr::String(path_tokens.at(i)).cstr());
dbgln("Directory '{}' not found.", glcr::String(path_tokens.at(i)).cstr());
return glcr::NOT_FOUND;
}
@ -43,7 +43,7 @@ glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest& request,
}
}
if (!region) {
dbgln("File '%s' not found.",
dbgln("File '{}' not found.",
glcr::String(path_tokens.at(path_tokens.size() - 1)).cstr());
}