1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 11:57:35 +00:00

Kernel: Change Ext2FS to be backed by a file instead of a block device

This ensures that we can mount image files as virtual disks without the
need of implementing gross hacks like loopback devices :)
This commit is contained in:
Liav A 2020-03-26 02:51:06 +02:00 committed by Andreas Kling
parent 2f2016f51d
commit 6b59311d4b
10 changed files with 116 additions and 90 deletions

View file

@ -28,7 +28,7 @@
#include <AK/Bitmap.h>
#include <AK/HashMap.h>
#include <Kernel/FileSystem/DiskBackedFileSystem.h>
#include <Kernel/FileSystem/FileBackedFileSystem.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/FileSystem/ext2_fs.h>
#include <Kernel/KBuffer.h>
@ -88,11 +88,12 @@ private:
ext2_inode m_raw_inode;
};
class Ext2FS final : public DiskBackedFS {
class Ext2FS final : public FileBackedFS {
friend class Ext2FSInode;
public:
static NonnullRefPtr<Ext2FS> create(BlockDevice&);
static NonnullRefPtr<Ext2FS> create(FileDescription&);
virtual ~Ext2FS() override;
virtual bool initialize() override;
@ -109,7 +110,7 @@ private:
typedef unsigned BlockIndex;
typedef unsigned GroupIndex;
typedef unsigned InodeIndex;
explicit Ext2FS(BlockDevice&);
explicit Ext2FS(FileDescription&);
const ext2_super_block& super_block() const { return m_super_block; }
const ext2_group_desc& group_descriptor(GroupIndex) const;