2023-07-05 22:56:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-10-25 20:28:28 -07:00
|
|
|
#include <denali/scoped_denali_client.h>
|
2023-07-05 22:56:08 -07:00
|
|
|
#include <glacier/memory/move.h>
|
2023-10-25 20:28:28 -07:00
|
|
|
#include <glacier/memory/unique_ptr.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-07-05 23:19:25 -07:00
|
|
|
static glcr::ErrorOr<Ext2Driver> Init(ScopedDenaliClient&& denali);
|
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-07-06 10:40:55 -07:00
|
|
|
glcr::ErrorCode ProbeDirectory(Inode* inode);
|
|
|
|
|
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
|
|
|
};
|