| 3 | #include <string.h> |
| 4 | |
| 5 | PartitionDevice::PartitionDevice(uint64_t startLBA, uint64_t endLBA, DiskDevice* disk) : Device(TypePartitionDevice){ |
| 6 | this->startLBA = startLBA; |
| 7 | this->endLBA = endLBA; |
| 8 | this->parentDisk = disk; |
| 9 | |
| 10 | flags = FS_NODE_BLKDEVICE; |
| 11 | |
| 12 | char buf[18]; |
| 13 | strcpy(buf, parentDisk->GetName()); |
| 14 | strcat(buf, "p"); |
| 15 | itoa(parentDisk->nextPartitionNumber++, buf + strlen(buf), 10); |
| 16 | |
| 17 | SetName(buf); |
| 18 | } |
| 19 | |
| 20 | int PartitionDevice::ReadAbsolute(uint64_t offset, uint32_t count, void* buffer){ |
| 21 | if(offset + count > (endLBA - startLBA) * parentDisk->blocksize) return 2; |