ladybird/Kernel/FileSystem/RAMFS/FileSystem.h
Andreas Kling 673592dea8 Kernel: Stop using *LockRefPtr for FileSystem pointers
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.
2023-04-04 10:33:42 +02:00

41 lines
994 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
*/
#pragma once
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Forward.h>
namespace Kernel {
class RAMFS final : public FileSystem {
friend class RAMFSInode;
public:
virtual ~RAMFS() override;
static ErrorOr<NonnullRefPtr<FileSystem>> try_create();
virtual ErrorOr<void> initialize() override;
virtual StringView class_name() const override { return "RAMFS"sv; }
virtual bool supports_watchers() const override { return true; }
virtual Inode& root_inode() override;
private:
RAMFS();
RefPtr<RAMFSInode> m_root_inode;
// NOTE: We start by assigning InodeIndex of 2, because 0 is invalid and 1
// is reserved for the root directory inode.
unsigned m_next_inode_index { 2 };
unsigned next_inode_index();
};
}