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

Kernel: Split the TmpFS core files into smaller components

This commit is contained in:
Liav A 2022-10-23 22:01:40 +03:00 committed by Andrew Kaster
parent f53149d5f6
commit 5e6101dd3e
7 changed files with 85 additions and 59 deletions

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/FileSystem/TmpFS/FileSystem.h>
#include <Kernel/FileSystem/TmpFS/Inode.h>
namespace Kernel {
ErrorOr<NonnullLockRefPtr<FileSystem>> TmpFS::try_create()
{
return TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) TmpFS));
}
TmpFS::TmpFS() = default;
TmpFS::~TmpFS() = default;
ErrorOr<void> TmpFS::initialize()
{
m_root_inode = TRY(TmpFSInode::try_create_root(*this));
return {};
}
Inode& TmpFS::root_inode()
{
VERIFY(!m_root_inode.is_null());
return *m_root_inode;
}
unsigned TmpFS::next_inode_index()
{
MutexLocker locker(m_lock);
return m_next_inode_index++;
}
}