mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
Kernel: Move DiskDevice::block_size() up to BlockDevice
All block devices should have a block size, after all. This defaults to PAGE_SIZE if no size is specified.
This commit is contained in:
parent
52366e3f02
commit
5de483cfbb
11 changed files with 23 additions and 45 deletions
|
@ -8,12 +8,11 @@
|
|||
|
||||
class FileBackedDiskDevice final : public DiskDevice {
|
||||
public:
|
||||
static RefPtr<FileBackedDiskDevice> create(String&& image_path, unsigned block_size);
|
||||
static RefPtr<FileBackedDiskDevice> create(const String& image_path, size_t block_size);
|
||||
virtual ~FileBackedDiskDevice() override;
|
||||
|
||||
bool is_valid() const { return m_file; }
|
||||
|
||||
virtual unsigned block_size() const override;
|
||||
virtual bool read_block(unsigned index, u8* out) const override;
|
||||
virtual bool write_block(unsigned index, const u8*) override;
|
||||
|
||||
|
@ -23,10 +22,9 @@ private:
|
|||
bool read_internal(DiskOffset, unsigned length, u8* out) const;
|
||||
bool write_internal(DiskOffset, unsigned length, const u8* data);
|
||||
|
||||
FileBackedDiskDevice(String&& imagePath, unsigned block_size);
|
||||
FileBackedDiskDevice(const String& image_path, size_t block_size);
|
||||
|
||||
String m_image_path;
|
||||
FILE* m_file { nullptr };
|
||||
DiskOffset m_file_length { 0 };
|
||||
unsigned m_block_size { 0 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue