2020-01-18 11:38:21 +03:00
|
|
|
/*
|
2021-07-11 01:33:27 +03:00
|
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2018-10-10 12:53:07 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-16 03:50:16 +03:00
|
|
|
#include <Kernel/FileSystem/FileSystem.h>
|
2021-09-07 14:39:11 +03:00
|
|
|
#include <Kernel/FileSystem/OpenFileDescription.h>
|
2018-10-10 12:53:07 +03:00
|
|
|
|
2020-02-16 03:27:42 +03:00
|
|
|
namespace Kernel {
|
|
|
|
|
2021-07-11 01:33:27 +03:00
|
|
|
class FileBackedFileSystem : public FileSystem {
|
2018-10-10 12:53:07 +03:00
|
|
|
public:
|
2021-07-11 01:33:27 +03:00
|
|
|
virtual ~FileBackedFileSystem() override;
|
2018-10-10 12:53:07 +03:00
|
|
|
|
2020-04-06 11:54:21 +03:00
|
|
|
File& file() { return m_file_description->file(); }
|
2021-09-07 14:39:11 +03:00
|
|
|
OpenFileDescription& file_description() { return *m_file_description; }
|
2022-04-01 20:58:27 +03:00
|
|
|
File const& file() const { return m_file_description->file(); }
|
2021-09-07 14:39:11 +03:00
|
|
|
OpenFileDescription& file_description() const { return *m_file_description; }
|
2020-04-06 11:54:21 +03:00
|
|
|
|
2018-10-10 12:53:07 +03:00
|
|
|
protected:
|
2021-09-07 14:39:11 +03:00
|
|
|
explicit FileBackedFileSystem(OpenFileDescription&);
|
2018-10-10 12:53:07 +03:00
|
|
|
|
|
|
|
private:
|
2020-05-18 21:55:08 +03:00
|
|
|
virtual bool is_file_backed() const override { return true; }
|
|
|
|
|
2022-08-19 21:53:40 +03:00
|
|
|
mutable NonnullLockRefPtr<OpenFileDescription> m_file_description;
|
2018-10-10 12:53:07 +03:00
|
|
|
};
|
2020-02-16 03:27:42 +03:00
|
|
|
|
|
|
|
}
|