2023-07-06 09:39:17 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glacier/container/vector.h>
|
2023-11-22 14:39:27 -08:00
|
|
|
#include <mammoth/util/memory_region.h>
|
2023-07-06 09:39:17 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "fs/ext2/ext2_block_reader.h"
|
|
|
|
|
|
|
|
class InodeTable {
|
|
|
|
public:
|
2023-08-01 10:39:26 -07:00
|
|
|
InodeTable(const glcr::SharedPtr<Ext2BlockReader>& driver,
|
2023-11-22 14:59:41 -08:00
|
|
|
mmth::OwnedMemoryRegion&& bgdt_region);
|
2023-07-06 09:39:17 -07:00
|
|
|
|
2023-08-01 10:39:26 -07:00
|
|
|
glcr::ErrorOr<Inode*> GetInode(uint32_t inode_num);
|
2023-07-06 09:39:17 -07:00
|
|
|
|
|
|
|
private:
|
2023-08-01 10:39:26 -07:00
|
|
|
glcr::SharedPtr<Ext2BlockReader> ext2_reader_;
|
2023-11-22 14:59:41 -08:00
|
|
|
mmth::OwnedMemoryRegion bgdt_region_;
|
2023-07-06 09:39:17 -07:00
|
|
|
BlockGroupDescriptor* bgdt_;
|
|
|
|
|
2023-11-22 14:59:41 -08:00
|
|
|
glcr::Vector<mmth::OwnedMemoryRegion> inode_tables_;
|
2023-07-06 09:39:17 -07:00
|
|
|
|
|
|
|
glcr::ErrorOr<Inode*> GetRootOfInodeTable(uint64_t block_group_num);
|
|
|
|
};
|