[victoriafalls] Add an Ext2Driver class which probes the superblock.

This commit is contained in:
Drew Galbraith 2023-07-05 22:56:08 -07:00
parent 0274339cc9
commit a49d13f1d1
5 changed files with 145 additions and 12 deletions

View file

@ -2,13 +2,7 @@
#include <mammoth/init.h>
#include <yellowstone_stub.h>
struct Superblock {
uint32_t inode_count;
uint32_t blocks_count;
uint32_t reserved_blocks_count;
uint32_t free_blocks_count;
uint32_t free_inodes_count;
};
#include "fs/ext2/ext2_driver.h"
uint64_t main(uint64_t init_cap) {
ParseInitPort(init_cap);
@ -17,12 +11,9 @@ uint64_t main(uint64_t init_cap) {
YellowstoneStub yellowstone(gInitEndpointCap);
ASSIGN_OR_RETURN(ScopedDenaliClient denali, yellowstone.GetDenali());
Ext2Driver ext2(glcr::Move(denali));
ASSIGN_OR_RETURN(MappedMemoryRegion region, denali.ReadSectors(2, 2));
Superblock* super = reinterpret_cast<Superblock*>(region.vaddr());
dbgln("Inodes: %x / %x", super->free_inodes_count, super->inode_count);
dbgln("Blocks: %x / %x", super->free_blocks_count, super->blocks_count);
check(ext2.ProbePartition());
return 0;
}