[victoriafalls] Move the block to lba translation to a small wrapper.
Abstract this away into a thin wrapper over the denali client such that it can be called from other helper classes.
This commit is contained in:
parent
a49d13f1d1
commit
21c1a001ea
6 changed files with 83 additions and 35 deletions
25
sys/victoriafalls/fs/ext2/ext2_block_reader.h
Normal file
25
sys/victoriafalls/fs/ext2/ext2_block_reader.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <denali/denali_client.h>
|
||||
#include <glacier/status/error_or.h>
|
||||
#include <mammoth/memory_region.h>
|
||||
|
||||
#include "fs/ext2/ext2.h"
|
||||
|
||||
class Ext2BlockReader {
|
||||
public:
|
||||
static glcr::ErrorOr<Ext2BlockReader> Init(ScopedDenaliClient&& denali);
|
||||
|
||||
Superblock* GetSuperblock();
|
||||
uint64_t SectorsPerBlock();
|
||||
|
||||
glcr::ErrorOr<MappedMemoryRegion> ReadBlock(uint64_t block_number);
|
||||
glcr::ErrorOr<MappedMemoryRegion> ReadBlocks(uint64_t block_number,
|
||||
uint64_t num_blocks);
|
||||
|
||||
private:
|
||||
ScopedDenaliClient denali_;
|
||||
MappedMemoryRegion super_block_region_;
|
||||
|
||||
Ext2BlockReader(ScopedDenaliClient&& denali, MappedMemoryRegion super_block);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue