acadia/sys/victoriafalls/fs/ext2/ext2_driver.h

31 lines
871 B
C
Raw Normal View History

#pragma once
#include <glacier/memory/move.h>
2023-10-25 20:28:28 -07:00
#include <glacier/memory/unique_ptr.h>
#include <yellowstone/yellowstone.yunq.h>
#include "fs/ext2/ext2.h"
#include "fs/ext2/ext2_block_reader.h"
#include "fs/ext2/inode_table.h"
class Ext2Driver {
public:
static glcr::ErrorOr<Ext2Driver> Init(const DenaliInfo& denali_info);
glcr::ErrorCode ProbePartition();
glcr::ErrorOr<Inode*> GetInode(uint32_t inode_number);
2023-11-02 20:57:28 -07:00
glcr::ErrorOr<glcr::Vector<DirEntry>> ReadDirectory(uint32_t inode_number);
glcr::ErrorOr<mmth::OwnedMemoryRegion> ReadFile(uint64_t inode_number);
private:
glcr::SharedPtr<Ext2BlockReader> ext2_reader_;
glcr::UniquePtr<InodeTable> inode_table_;
Ext2Driver(const glcr::SharedPtr<Ext2BlockReader>& reader,
glcr::UniquePtr<InodeTable> inode_table)
: ext2_reader_(reader), inode_table_(glcr::Move(inode_table)) {}
};