1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-29 22:32:08 +00:00

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

In contrast to the previous patchset that was reverted, this time we use
a "special" method to access a file with block size of 512 bytes (like
a harddrive essentially).
This commit is contained in:
Liav A 2020-04-06 11:54:21 +03:00 committed by Andreas Kling
parent 1d6c8724b9
commit ecee76b741
10 changed files with 104 additions and 77 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;