mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
Kernel/Ext2: Extract common calculations to functions
This also makes it easier to understand and reference where these (sometimes rather arbitrary) calculations come from. This also fixes a bug where group_index_from_block_index assumed 1KiB blocks.
This commit is contained in:
parent
6a17a30e2e
commit
cc1cb72fb5
2 changed files with 16 additions and 4 deletions
|
@ -77,10 +77,12 @@ private:
|
|||
virtual void flush_writes() override;
|
||||
|
||||
BlockIndex first_block_index() const;
|
||||
BlockIndex first_block_of_block_group_descriptors() const;
|
||||
ErrorOr<InodeIndex> allocate_inode(GroupIndex preferred_group = 0);
|
||||
ErrorOr<Vector<BlockIndex>> allocate_blocks(GroupIndex preferred_group_index, size_t count);
|
||||
GroupIndex group_index_from_inode(InodeIndex) const;
|
||||
GroupIndex group_index_from_block_index(BlockIndex) const;
|
||||
BlockIndex first_block_of_group(GroupIndex) const;
|
||||
|
||||
ErrorOr<bool> get_inode_allocation_state(InodeIndex) const;
|
||||
ErrorOr<void> set_inode_allocation_state(InodeIndex, bool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue