ladybird/Kernel/FileSystem/FileBackedFileSystem.h
Andreas Kling 11eee67b85 Kernel: Make self-contained locking smart pointers their own classes
Until now, our kernel has reimplemented a number of AK classes to
provide automatic internal locking:

- RefPtr
- NonnullRefPtr
- WeakPtr
- Weakable

This patch renames the Kernel classes so that they can coexist with
the original AK classes:

- RefPtr => LockRefPtr
- NonnullRefPtr => NonnullLockRefPtr
- WeakPtr => LockWeakPtr
- Weakable => LockWeakable

The goal here is to eventually get rid of the Lock* classes in favor of
using external locking.
2022-08-20 17:20:43 +02:00

33 lines
854 B
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/OpenFileDescription.h>
namespace Kernel {
class FileBackedFileSystem : public FileSystem {
public:
virtual ~FileBackedFileSystem() override;
File& file() { return m_file_description->file(); }
OpenFileDescription& file_description() { return *m_file_description; }
File const& file() const { return m_file_description->file(); }
OpenFileDescription& file_description() const { return *m_file_description; }
protected:
explicit FileBackedFileSystem(OpenFileDescription&);
private:
virtual bool is_file_backed() const override { return true; }
mutable NonnullLockRefPtr<OpenFileDescription> m_file_description;
};
}