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