Kernel: Start work on writable ext2 filesystem
This commit is contained in:
parent
195ccf4f53
commit
f31c6b847f
|
@ -123,7 +123,7 @@ namespace Kernel
|
|||
class Ext2Inode final : public Inode
|
||||
{
|
||||
public:
|
||||
virtual ino_t ino() const override { return m_index; };
|
||||
virtual ino_t ino() const override { return m_ino; };
|
||||
virtual Mode mode() const override { return { m_inode.mode }; }
|
||||
virtual nlink_t nlink() const override { return m_inode.links_count; }
|
||||
virtual uid_t uid() const override { return m_inode.uid; }
|
||||
|
@ -144,28 +144,31 @@ namespace Kernel
|
|||
|
||||
virtual BAN::ErrorOr<size_t> read(size_t, void*, size_t) override;
|
||||
virtual BAN::ErrorOr<size_t> write(size_t, const void*, size_t) override;
|
||||
virtual BAN::ErrorOr<void> truncate(size_t) override;
|
||||
|
||||
virtual BAN::ErrorOr<void> create_file(BAN::StringView, mode_t, uid_t, gid_t) override;
|
||||
|
||||
private:
|
||||
BAN::ErrorOr<uint32_t> data_block_index(uint32_t);
|
||||
BAN::ErrorOr<void> for_data_block_index(uint32_t, const BAN::Function<void(uint32_t&)>&, bool allocate);
|
||||
|
||||
uint32_t index() const { return m_index; }
|
||||
BAN::ErrorOr<uint32_t> data_block_index(uint32_t);
|
||||
BAN::ErrorOr<uint32_t> allocate_new_block();
|
||||
BAN::ErrorOr<void> sync();
|
||||
|
||||
uint32_t block_group() const;
|
||||
|
||||
private:
|
||||
Ext2Inode(Ext2FS& fs, Ext2::Inode inode, uint32_t index, BAN::StringView name)
|
||||
Ext2Inode(Ext2FS& fs, Ext2::Inode inode, uint32_t ino)
|
||||
: m_fs(fs)
|
||||
, m_inode(inode)
|
||||
, m_name(name)
|
||||
, m_index(index)
|
||||
, m_inode(inode)
|
||||
, m_ino(ino)
|
||||
{}
|
||||
static BAN::ErrorOr<BAN::RefPtr<Inode>> create(Ext2FS&, uint32_t, BAN::StringView);
|
||||
static BAN::ErrorOr<BAN::RefPtr<Inode>> create(Ext2FS&, uint32_t);
|
||||
|
||||
private:
|
||||
Ext2FS& m_fs;
|
||||
Ext2::Inode m_inode;
|
||||
BAN::String m_name;
|
||||
uint32_t m_index;
|
||||
const uint32_t m_ino;
|
||||
|
||||
friend class Ext2FS;
|
||||
friend class BAN::RefPtr<Ext2Inode>;
|
||||
|
@ -192,6 +195,9 @@ namespace Kernel
|
|||
|
||||
void read_block(uint32_t, BAN::Span<uint8_t>);
|
||||
void write_block(uint32_t, BAN::Span<const uint8_t>);
|
||||
void sync_superblock();
|
||||
|
||||
BAN::ErrorOr<uint32_t> reserve_free_block(uint32_t primary_bgd);
|
||||
|
||||
const Ext2::Superblock& superblock() const { return m_superblock; }
|
||||
|
||||
|
@ -209,6 +215,7 @@ namespace Kernel
|
|||
Partition& m_partition;
|
||||
|
||||
BAN::RefPtr<Inode> m_root_inode;
|
||||
BAN::Vector<uint32_t> m_superblock_backups;
|
||||
|
||||
Ext2::Superblock m_superblock;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue