2023-07-05 22:56:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glacier/memory/move.h>
|
2023-10-25 20:28:28 -07:00
|
|
|
#include <glacier/memory/unique_ptr.h>
|
2023-11-15 09:47:32 -08:00
|
|
|
#include <yellowstone/yellowstone.yunq.h>
|
2023-07-05 22:56:08 -07:00
|
|
|
|
|
|
|
#include "fs/ext2/ext2.h"
|
2023-07-05 23:19:25 -07:00
|
|
|
#include "fs/ext2/ext2_block_reader.h"
|
2023-07-06 09:39:17 -07:00
|
|
|
#include "fs/ext2/inode_table.h"
|
2023-07-05 22:56:08 -07:00
|
|
|
|
|
|
|
class Ext2Driver {
|
|
|
|
public:
|
2023-11-15 09:47:32 -08:00
|
|
|
static glcr::ErrorOr<Ext2Driver> Init(const DenaliInfo& denali_info);
|
2023-07-05 22:56:08 -07:00
|
|
|
|
|
|
|
glcr::ErrorCode ProbePartition();
|
|
|
|
|
2023-08-01 10:39:26 -07:00
|
|
|
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);
|
|
|
|
|
2023-11-19 20:33:15 -08:00
|
|
|
glcr::ErrorOr<OwnedMemoryRegion> ReadFile(uint64_t inode_number);
|
2023-07-06 10:40:55 -07:00
|
|
|
|
2023-07-05 22:56:08 -07:00
|
|
|
private:
|
2023-08-01 10:39:26 -07:00
|
|
|
glcr::SharedPtr<Ext2BlockReader> ext2_reader_;
|
2023-07-06 09:39:17 -07:00
|
|
|
glcr::UniquePtr<InodeTable> inode_table_;
|
2023-07-05 23:19:25 -07:00
|
|
|
|
2023-08-01 10:39:26 -07:00
|
|
|
Ext2Driver(const glcr::SharedPtr<Ext2BlockReader>& reader,
|
|
|
|
glcr::UniquePtr<InodeTable> inode_table)
|
|
|
|
: ext2_reader_(reader), inode_table_(glcr::Move(inode_table)) {}
|
2023-07-05 22:56:08 -07:00
|
|
|
};
|