mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +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:
parent
788b91a65c
commit
47bfbe343b
5 changed files with 19 additions and 19 deletions
|
@ -60,7 +60,7 @@ class SysFS final : public FileSystem {
|
|||
|
||||
public:
|
||||
virtual ~SysFS() override;
|
||||
static NonnullRefPtr<SysFS> create();
|
||||
static KResultOr<NonnullRefPtr<SysFS>> try_create();
|
||||
|
||||
virtual KResult initialize() override;
|
||||
virtual StringView class_name() const override { return "SysFS"sv; }
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
private:
|
||||
SysFS();
|
||||
|
||||
NonnullRefPtr<SysFSInode> m_root_inode;
|
||||
RefPtr<SysFSInode> m_root_inode;
|
||||
};
|
||||
|
||||
class SysFSInode : public Inode {
|
||||
|
@ -78,7 +78,7 @@ class SysFSInode : public Inode {
|
|||
friend class SysFSDirectoryInode;
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<SysFSInode> create(SysFS const&, SysFSComponent const&);
|
||||
static KResultOr<NonnullRefPtr<SysFSInode>> try_create(SysFS const&, SysFSComponent const&);
|
||||
StringView name() const { return m_associated_component->name(); }
|
||||
|
||||
protected:
|
||||
|
@ -106,7 +106,7 @@ class SysFSDirectoryInode : public SysFSInode {
|
|||
friend class SysFS;
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<SysFSDirectoryInode> create(SysFS const&, SysFSComponent const&);
|
||||
static KResultOr<NonnullRefPtr<SysFSDirectoryInode>> try_create(SysFS const&, SysFSComponent const&);
|
||||
virtual ~SysFSDirectoryInode() override;
|
||||
|
||||
SysFS& fs() { return static_cast<SysFS&>(Inode::fs()); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue