mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	Kernel: Tidy up IDEDiskDevice a bit.
The main cleanup here is putting the I/O address base in a member variable.
This commit is contained in:
		
							parent
							
								
									36d8b9e89b
								
							
						
					
					
						commit
						ebf645d72a
					
				
					 4 changed files with 80 additions and 103 deletions
				
			
		|  | @ -14,9 +14,7 @@ bool DiskDevice::read(DiskOffset offset, unsigned length, byte* out) const | |||
|     ASSERT((length % block_size()) == 0); | ||||
|     dword first_block = offset / block_size(); | ||||
|     dword end_block = (offset + length) / block_size(); | ||||
|     byte* outptr = out; | ||||
| 
 | ||||
|     return const_cast<DiskDevice*>(this)->read_blocks(first_block, end_block - first_block, outptr); | ||||
|     return const_cast<DiskDevice*>(this)->read_blocks(first_block, end_block - first_block, out); | ||||
| } | ||||
| 
 | ||||
| bool DiskDevice::write(DiskOffset offset, unsigned length, const byte* in) | ||||
|  | @ -27,12 +25,6 @@ bool DiskDevice::write(DiskOffset offset, unsigned length, const byte* in) | |||
|     dword end_block = (offset + length) / block_size(); | ||||
|     ASSERT(first_block <= 0xffffffff); | ||||
|     ASSERT(end_block <= 0xffffffff); | ||||
|     const byte* inptr = in; | ||||
|     for (unsigned bi = first_block; bi < end_block; ++bi) { | ||||
|         if (!write_block(bi, inptr)) | ||||
|             return false; | ||||
|         inptr += block_size(); | ||||
|     } | ||||
|     return true; | ||||
|     return write_blocks(first_block, end_block - first_block, in); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling