mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
Kernel: Add KResult and KResultOr<T> classes.
The idea here is to combine a potential syscall error code with an arbitrary type in the case of success. I feel like this will end up much less error prone than returning some arbitrary type that kinda sorta has bool semantics (but sometimes not really) and passing the error through an out-param. This patch only converts a few syscalls to using it. More to come.
This commit is contained in:
@@ -1350,15 +1350,14 @@ size_t Ext2FSInode::directory_entry_count() const
|
||||
return m_lookup_cache.size();
|
||||
}
|
||||
|
||||
bool Ext2FSInode::chmod(mode_t mode, int& error)
|
||||
KResult Ext2FSInode::chmod(mode_t mode)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
error = 0;
|
||||
if (m_raw_inode.i_mode == mode)
|
||||
return true;
|
||||
return KSuccess;
|
||||
m_raw_inode.i_mode = mode;
|
||||
set_metadata_dirty(true);
|
||||
return true;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
unsigned Ext2FS::total_block_count() const
|
||||
|
||||
Reference in New Issue
Block a user