mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
673592dea8
There was only one permanent storage location for these: as a member in the Mount class. That member is never modified after Mount initialization, so we don't need to worry about races there.
40 lines
788 B
C++
40 lines
788 B
C++
/*
|
|
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
|
* Copyright (c) 2022-2023, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/FileSystem/RAMFS/FileSystem.h>
|
|
#include <Kernel/FileSystem/RAMFS/Inode.h>
|
|
|
|
namespace Kernel {
|
|
|
|
ErrorOr<NonnullRefPtr<FileSystem>> RAMFS::try_create()
|
|
{
|
|
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) RAMFS));
|
|
}
|
|
|
|
RAMFS::RAMFS() = default;
|
|
RAMFS::~RAMFS() = default;
|
|
|
|
ErrorOr<void> RAMFS::initialize()
|
|
{
|
|
m_root_inode = TRY(RAMFSInode::try_create_root(*this));
|
|
return {};
|
|
}
|
|
|
|
Inode& RAMFS::root_inode()
|
|
{
|
|
VERIFY(!m_root_inode.is_null());
|
|
return *m_root_inode;
|
|
}
|
|
|
|
unsigned RAMFS::next_inode_index()
|
|
{
|
|
MutexLocker locker(m_lock);
|
|
|
|
return m_next_inode_index++;
|
|
}
|
|
|
|
}
|