Compare commits
No commits in common. "ebe72af71679cf77f48b807eb80c8ad164357c2a" and "594a6aac54ef234381f47b3b300f70681e1f013e" have entirely different histories.
ebe72af716
...
594a6aac54
|
@ -3,8 +3,6 @@
|
||||||
#include <glacier/memory/move.h>
|
#include <glacier/memory/move.h>
|
||||||
#include <mammoth/util/debug.h>
|
#include <mammoth/util/debug.h>
|
||||||
|
|
||||||
#define PSF_DEBUG 0
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const uint32_t kMagic = 0x864AB572;
|
const uint32_t kMagic = 0x864AB572;
|
||||||
|
@ -18,7 +16,6 @@ Psf::Psf(glcr::StringView path)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Psf::DumpHeader() {
|
void Psf::DumpHeader() {
|
||||||
#if PSF_DEBUG
|
|
||||||
dbgln("Magic: {x}", header_->magic);
|
dbgln("Magic: {x}", header_->magic);
|
||||||
dbgln("Version: {x}", header_->version);
|
dbgln("Version: {x}", header_->version);
|
||||||
dbgln("Header Sz: {x}", header_->headersize);
|
dbgln("Header Sz: {x}", header_->headersize);
|
||||||
|
@ -27,7 +24,6 @@ void Psf::DumpHeader() {
|
||||||
dbgln("Glyph Size: {x}", header_->bytesperglyph);
|
dbgln("Glyph Size: {x}", header_->bytesperglyph);
|
||||||
dbgln("Height: {x}", header_->height);
|
dbgln("Height: {x}", header_->height);
|
||||||
dbgln("Width: {x}", header_->width);
|
dbgln("Width: {x}", header_->width);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Psf::EnsureValid() {
|
void Psf::EnsureValid() {
|
||||||
|
|
|
@ -96,7 +96,9 @@ glcr::ErrorOr<mmth::OwnedMemoryRegion> Ext2BlockReader::ReadBlocks(
|
||||||
}
|
}
|
||||||
req.add_lba(curr_start);
|
req.add_lba(curr_start);
|
||||||
req.add_sector_cnt(curr_run_len * SectorsPerBlock());
|
req.add_sector_cnt(curr_run_len * SectorsPerBlock());
|
||||||
|
dbgln("Read {x}, {x}", curr_start, curr_run_len * SectorsPerBlock());
|
||||||
}
|
}
|
||||||
|
dbgln("Read many: {x}", req.lba().size());
|
||||||
ReadResponse resp;
|
ReadResponse resp;
|
||||||
auto status = denali_.ReadMany(req, resp);
|
auto status = denali_.ReadMany(req, resp);
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include <glacier/string/string.h>
|
#include <glacier/string/string.h>
|
||||||
#include <mammoth/util/debug.h>
|
#include <mammoth/util/debug.h>
|
||||||
|
|
||||||
#define EXT2_DEBUG 0
|
|
||||||
|
|
||||||
glcr::ErrorOr<Ext2Driver> Ext2Driver::Init(
|
glcr::ErrorOr<Ext2Driver> Ext2Driver::Init(
|
||||||
const yellowstone::DenaliInfo& denali_info) {
|
const yellowstone::DenaliInfo& denali_info) {
|
||||||
ASSIGN_OR_RETURN(glcr::SharedPtr<Ext2BlockReader> reader,
|
ASSIGN_OR_RETURN(glcr::SharedPtr<Ext2BlockReader> reader,
|
||||||
|
@ -25,8 +23,6 @@ glcr::ErrorCode Ext2Driver::ProbePartition() {
|
||||||
dbgln("Invalid EXT2 magic code: {x}");
|
dbgln("Invalid EXT2 magic code: {x}");
|
||||||
return glcr::INVALID_ARGUMENT;
|
return glcr::INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EXT2_DEBUG
|
|
||||||
dbgln("Block size: 0x{x}", 1024 << superblock->log_block_size);
|
dbgln("Block size: 0x{x}", 1024 << superblock->log_block_size);
|
||||||
|
|
||||||
dbgln("Blocks: 0x{x} (0x{x} per group)", superblock->blocks_count,
|
dbgln("Blocks: 0x{x} (0x{x} per group)", superblock->blocks_count,
|
||||||
|
@ -40,7 +36,6 @@ glcr::ErrorCode Ext2Driver::ProbePartition() {
|
||||||
dbgln("State: {x}", superblock->state);
|
dbgln("State: {x}", superblock->state);
|
||||||
|
|
||||||
dbgln("Created by: {x}", superblock->creator_os);
|
dbgln("Created by: {x}", superblock->creator_os);
|
||||||
#endif
|
|
||||||
|
|
||||||
return glcr::OK;
|
return glcr::OK;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +63,7 @@ glcr::ErrorOr<glcr::Vector<DirEntry>> Ext2Driver::ReadDirectory(
|
||||||
|
|
||||||
glcr::Vector<DirEntry> directory;
|
glcr::Vector<DirEntry> directory;
|
||||||
for (uint64_t i = 0; i < real_block_cnt; i++) {
|
for (uint64_t i = 0; i < real_block_cnt; i++) {
|
||||||
|
dbgln("Getting block {x}", inode->block[i]);
|
||||||
ASSIGN_OR_RETURN(mmth::OwnedMemoryRegion block,
|
ASSIGN_OR_RETURN(mmth::OwnedMemoryRegion block,
|
||||||
ext2_reader_->ReadBlock(inode->block[i]));
|
ext2_reader_->ReadBlock(inode->block[i]));
|
||||||
uint64_t addr = block.vaddr();
|
uint64_t addr = block.vaddr();
|
||||||
|
@ -75,7 +71,6 @@ glcr::ErrorOr<glcr::Vector<DirEntry>> Ext2Driver::ReadDirectory(
|
||||||
DirEntry* entry = reinterpret_cast<DirEntry*>(addr);
|
DirEntry* entry = reinterpret_cast<DirEntry*>(addr);
|
||||||
directory.PushBack(*entry);
|
directory.PushBack(*entry);
|
||||||
glcr::StringView name(entry->name, entry->name_len);
|
glcr::StringView name(entry->name, entry->name_len);
|
||||||
#if EXT2_DEBUG
|
|
||||||
switch (entry->file_type) {
|
switch (entry->file_type) {
|
||||||
case kExt2FtFile:
|
case kExt2FtFile:
|
||||||
dbgln("FILE (0x{x}): {}", entry->inode, name);
|
dbgln("FILE (0x{x}): {}", entry->inode, name);
|
||||||
|
@ -86,7 +81,6 @@ glcr::ErrorOr<glcr::Vector<DirEntry>> Ext2Driver::ReadDirectory(
|
||||||
default:
|
default:
|
||||||
dbgln("UNK (0x{x}): {}", entry->inode, name);
|
dbgln("UNK (0x{x}): {}", entry->inode, name);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
addr += entry->record_length;
|
addr += entry->record_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,11 +144,7 @@ glcr::ErrorOr<mmth::OwnedMemoryRegion> Ext2Driver::ReadFile(
|
||||||
if (block_inner >= real_block_cnt) {
|
if (block_inner >= real_block_cnt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (single_indr_block_array[j] != 0) {
|
blocks_to_read.PushBack(single_indr_block_array[j]);
|
||||||
blocks_to_read.PushBack(single_indr_block_array[j]);
|
|
||||||
} else {
|
|
||||||
dbgln("WARN skipping 0 block in inode");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue