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

Kernel: Tidy up DevFS construction and handle OOM errorso

- Use KResultOr and TRY() to propagate errors
- Check for OOM
- Move allocations out of the DevFS constructor
This commit is contained in:
Andreas Kling 2021-09-06 10:47:47 +02:00
parent efe4e230ee
commit 788b91a65c
3 changed files with 16 additions and 21 deletions

View file

@ -20,7 +20,7 @@ class DevFS final : public FileSystem {
public:
virtual ~DevFS() override;
static NonnullRefPtr<DevFS> create();
static KResultOr<NonnullRefPtr<DevFS>> try_create();
virtual KResult initialize() override;
virtual StringView class_name() const override { return "DevFS"sv; }
@ -35,7 +35,7 @@ private:
KResultOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
size_t allocate_inode_index();
NonnullRefPtr<DevFSRootDirectoryInode> m_root_inode;
RefPtr<DevFSRootDirectoryInode> m_root_inode;
NonnullRefPtrVector<DevFSInode> m_nodes;
InodeIndex m_next_inode_index { 0 };