ladybird/Kernel/Devices/BlockDevice.h
Andreas Kling 5de483cfbb 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.
2019-08-21 16:48:59 +02:00

23 lines
528 B
C++

#pragma once
#include <Kernel/Devices/Device.h>
class BlockDevice : public Device {
public:
virtual ~BlockDevice() override;
size_t block_size() const { return m_block_size; }
virtual bool is_seekable() const override { return true; }
protected:
BlockDevice(unsigned major, unsigned minor, size_t block_size = PAGE_SIZE)
: Device(major, minor)
, m_block_size(block_size)
{
}
private:
virtual bool is_block_device() const final { return true; }
size_t m_block_size { 0 };
};