1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Kernel: Make DiskBackedFS::read_block() write to client-provided memory

Instead of having DiskBackedFS allocate a ByteBuffer, leave it to each
client to provide buffer space.

This is significantly faster in many cases where we can use a stack
buffer and avoid heap allocation entirely.
This commit is contained in:
Andreas Kling 2019-09-30 11:04:30 +02:00
parent a61f6ccc27
commit 1fc2612667
3 changed files with 49 additions and 34 deletions

View file

@ -19,8 +19,8 @@ public:
protected:
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
ByteBuffer read_block(unsigned index) const;
ByteBuffer read_blocks(unsigned index, unsigned count) const;
bool read_block(unsigned index, u8* buffer) const;
bool read_blocks(unsigned index, unsigned count, u8* buffer) const;
bool write_block(unsigned index, const ByteBuffer&);
bool write_blocks(unsigned index, unsigned count, const ByteBuffer&);