| 281 | } |
| 282 | |
| 283 | Bytes Filesystem::getLogicalSector(uint32_t number, uint32_t count) |
| 284 | { |
| 285 | if ((number + count) > _blockCount) |
| 286 | throw BadFilesystemException(fmt::format( |
| 287 | "invalid filesystem: sector {} is out of bounds ({} maximum)", |
| 288 | number + count - 1, |
| 289 | _diskLayout->logicalSectorLocationsInFilesystemOrder.size())); |
| 290 | |
| 291 | Bytes data; |
| 292 | ByteWriter bw(data); |
| 293 | for (int i = 0; i < count; i++) |
| 294 | { |
| 295 | auto& [cylinder, head, sectorId] = |
| 296 | _diskLayout->logicalSectorLocationsInFilesystemOrder.at(number + i); |
| 297 | auto& ltl = _diskLayout->layoutByLogicalLocation.at({cylinder, head}); |
| 298 | bw += _sectors->get(cylinder, head, sectorId) |
| 299 | ->data.slice(0, ltl->sectorSize); |
| 300 | } |
| 301 | return data; |
| 302 | } |
| 303 | |
| 304 | void Filesystem::putLogicalSector(uint32_t number, const Bytes& data) |
| 305 | { |
no test coverage detected