mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	 5de483cfbb
			
		
	
	
		5de483cfbb
		
	
	
	
	
		
			
			All block devices should have a block size, after all. This defaults to PAGE_SIZE if no size is specified.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			528 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			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 };
 | |
| };
 |