1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

Kernel: Tidy up SysFS construction

- Use KResultOr and TRY() to propagate errors
- Check for OOM errors
- Move allocation out of constructors

There's still a lot more to do here, as SysFS is still quite brittle
in the face of memory pressure.
This commit is contained in:
Andreas Kling 2021-09-06 11:06:20 +02:00
parent 788b91a65c
commit 47bfbe343b
5 changed files with 19 additions and 19 deletions

View file

@ -61,14 +61,14 @@ SysFSDirectory::SysFSDirectory(StringView name, SysFSDirectory const& parent_dir
{
}
NonnullRefPtr<SysFSInode> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const
KResultOr<NonnullRefPtr<SysFSInode>> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const
{
return SysFSDirectoryInode::create(sysfs_instance, *this);
return TRY(SysFSDirectoryInode::try_create(sysfs_instance, *this));
}
NonnullRefPtr<SysFSInode> SysFSComponent::to_inode(SysFS const& sysfs_instance) const
KResultOr<NonnullRefPtr<SysFSInode>> SysFSComponent::to_inode(SysFS const& sysfs_instance) const
{
return SysFSInode::create(sysfs_instance, *this);
return SysFSInode::try_create(sysfs_instance, *this);
}
}