| 302 | } |
| 303 | |
| 304 | void Filesystem::putLogicalSector(uint32_t number, const Bytes& data) |
| 305 | { |
| 306 | if (number >= _blockCount) |
| 307 | throw BadFilesystemException(fmt::format( |
| 308 | "invalid filesystem: sector {} is out of bounds", number)); |
| 309 | |
| 310 | unsigned pos = 0; |
| 311 | while (pos < data.size()) |
| 312 | { |
| 313 | const auto& [cylinder, head, sectorId] = |
| 314 | _diskLayout->logicalSectorLocationsInFilesystemOrder.at(number); |
| 315 | const auto& ltl = |
| 316 | _diskLayout->layoutByLogicalLocation.at({cylinder, head}); |
| 317 | const auto& sector = _sectors->put(cylinder, head, sectorId); |
| 318 | sector->status = Sector::OK; |
| 319 | sector->data = data.slice(pos, ltl->sectorSize); |
| 320 | pos += ltl->sectorSize; |
| 321 | number++; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | unsigned Filesystem::getOffsetOfSector( |
| 326 | unsigned track, unsigned side, unsigned sector) |
no test coverage detected