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-04-06 11:54:21 +03:00
|
|
|
#include <Kernel/FileSystem/FileDescription.h>
|
2020-02-16 03:50:16 +03:00
|
|
|
#include <Kernel/FileSystem/FileSystem.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(); }
|
|
|
|
FileDescription& file_description() { return *m_file_description; }
|
|
|
|
const File& file() const { return m_file_description->file(); }
|
2020-07-02 12:48:08 +03:00
|
|
|
FileDescription& 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-07-11 01:33:27 +03:00
|
|
|
explicit FileBackedFileSystem(FileDescription&);
|
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; }
|
|
|
|
|
|
|
|
mutable NonnullRefPtr<FileDescription> m_file_description;
|
2018-10-10 12:53:07 +03:00
|
|
|
};
|
2020-02-16 03:27:42 +03:00
|
|
|
|
|
|
|
}
|