MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / putLogicalSector

Method putLogicalSector

lib/vfs/vfs.cc:304–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void 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
325unsigned Filesystem::getOffsetOfSector(
326 unsigned track, unsigned side, unsigned sector)

Callers 1

writeMethod · 0.80

Calls 4

sliceMethod · 0.80
sizeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected