mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:52:44 +00:00 
			
		
		
		
	 5de483cfbb
			
		
	
	
		5de483cfbb
		
	
	
	
	
		
			
			All block devices should have a block size, after all. This defaults to PAGE_SIZE if no size is specified.
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			768 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			768 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/Types.h>
 | |
| #include <Kernel/Devices/BlockDevice.h>
 | |
| 
 | |
| // FIXME: Support 64-bit DiskOffset
 | |
| typedef u32 DiskOffset;
 | |
| 
 | |
| class DiskDevice : public BlockDevice {
 | |
| public:
 | |
|     virtual ~DiskDevice() override;
 | |
| 
 | |
|     virtual bool read_block(unsigned index, u8*) const = 0;
 | |
|     virtual bool write_block(unsigned index, const u8*) = 0;
 | |
|     bool read(DiskOffset, unsigned length, u8*) const;
 | |
|     bool write(DiskOffset, unsigned length, const u8*);
 | |
| 
 | |
|     virtual bool read_blocks(unsigned index, u16 count, u8*) = 0;
 | |
|     virtual bool write_blocks(unsigned index, u16 count, const u8*) = 0;
 | |
| 
 | |
|     virtual bool is_disk_device() const override { return true; };
 | |
| 
 | |
| protected:
 | |
|     DiskDevice(int major, int minor, size_t block_size = 512);
 | |
| };
 |