mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
Kernel: Expose FileSystem's fragment size
This commit will add a fragment_size() function similar to the block_size() function.
This commit is contained in:
parent
145e246a5e
commit
721a867c65
Notes:
sideshowbarker
2024-07-18 17:46:47 +09:00
Author: https://github.com/sw1tchbl4d3r Commit: https://github.com/SerenityOS/serenity/commit/721a867c654 Pull-request: https://github.com/SerenityOS/serenity/pull/6742 Reviewed-by: https://github.com/awesomekling
@ -114,6 +114,7 @@ bool Ext2FS::initialize()
|
||||
}
|
||||
|
||||
set_block_size(EXT2_BLOCK_SIZE(&super_block));
|
||||
set_fragment_size(EXT2_FRAG_SIZE(&super_block));
|
||||
|
||||
VERIFY(block_size() <= (int)max_block_size);
|
||||
|
||||
|
@ -81,4 +81,12 @@ void FS::set_block_size(size_t block_size)
|
||||
m_block_size = block_size;
|
||||
}
|
||||
|
||||
void FS::set_fragment_size(size_t fragment_size)
|
||||
{
|
||||
VERIFY(fragment_size > 0);
|
||||
if (fragment_size == m_fragment_size)
|
||||
return;
|
||||
m_fragment_size = fragment_size;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
virtual void flush_writes() { }
|
||||
|
||||
size_t block_size() const { return m_block_size; }
|
||||
size_t fragment_size() const { return m_fragment_size; }
|
||||
|
||||
virtual bool is_file_backed() const { return false; }
|
||||
|
||||
@ -71,12 +72,14 @@ protected:
|
||||
FS();
|
||||
|
||||
void set_block_size(size_t);
|
||||
void set_fragment_size(size_t);
|
||||
|
||||
mutable Lock m_lock { "FS" };
|
||||
|
||||
private:
|
||||
unsigned m_fsid { 0 };
|
||||
size_t m_block_size { 0 };
|
||||
size_t m_fragment_size { 0 };
|
||||
bool m_readonly { false };
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user