1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 12:05:07 +00:00

Kernel: Make BlockBasedFS read/write functions return a KResult

This way, if something goes wrong, we get to keep the actual error.
Also, KResults are nodiscard, so we have to deal with that in Ext2FS
instead of just silently ignoring I/O errors(!)
This commit is contained in:
Andreas Kling 2021-01-20 21:11:01 +01:00
parent 91aa0d9997
commit e279b45aed
3 changed files with 66 additions and 33 deletions

View file

@ -42,8 +42,8 @@ public:
protected:
explicit BlockBasedFS(FileDescription&);
int read_block(unsigned index, UserOrKernelBuffer* buffer, size_t count, size_t offset = 0, bool allow_cache = true) const;
int read_blocks(unsigned index, unsigned count, UserOrKernelBuffer& buffer, bool allow_cache = true) const;
KResult read_block(unsigned index, UserOrKernelBuffer* buffer, size_t count, size_t offset = 0, bool allow_cache = true) const;
KResult read_blocks(unsigned index, unsigned count, UserOrKernelBuffer& buffer, bool allow_cache = true) const;
bool raw_read(unsigned index, UserOrKernelBuffer& buffer);
bool raw_write(unsigned index, const UserOrKernelBuffer& buffer);
@ -51,8 +51,8 @@ protected:
bool raw_read_blocks(unsigned index, size_t count, UserOrKernelBuffer& buffer);
bool raw_write_blocks(unsigned index, size_t count, const UserOrKernelBuffer& buffer);
int write_block(unsigned index, const UserOrKernelBuffer& buffer, size_t count, size_t offset = 0, bool allow_cache = true);
int write_blocks(unsigned index, unsigned count, const UserOrKernelBuffer&, bool allow_cache = true);
KResult write_block(unsigned index, const UserOrKernelBuffer& buffer, size_t count, size_t offset = 0, bool allow_cache = true);
KResult write_blocks(unsigned index, unsigned count, const UserOrKernelBuffer&, bool allow_cache = true);
size_t m_logical_block_size { 512 };