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

Kernel: Make FileSystem::initialize() return KResult

This forced me to also come up with error codes for a bunch of
situations where we'd previously just panic the kernel.
This commit is contained in:
Andreas Kling 2021-08-14 14:02:47 +02:00
parent 46b93174fc
commit d30d776ca4
21 changed files with 61 additions and 58 deletions

View file

@ -27,17 +27,19 @@ DevPtsFS::~DevPtsFS()
static Singleton<HashTable<unsigned>> s_ptys;
bool DevPtsFS::initialize()
KResult DevPtsFS::initialize()
{
m_root_inode = adopt_ref(*new DevPtsFSInode(*this, 1, nullptr));
m_root_inode = adopt_ref_if_nonnull(new (nothrow) DevPtsFSInode(*this, 1, nullptr));
if (!m_root_inode)
return ENOMEM;
m_root_inode->m_metadata.inode = { fsid(), 1 };
m_root_inode->m_metadata.mode = 0040555;
m_root_inode->m_metadata.uid = 0;
m_root_inode->m_metadata.gid = 0;
m_root_inode->m_metadata.size = 0;
m_root_inode->m_metadata.mtime = mepoch;
return true;
return KSuccess;
}
static unsigned inode_index_to_pty_index(InodeIndex inode_index)