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

Function combineRecordAndSectors

lib/algorithms/readerwriter.cc:296–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294};
295
296static CombinationResult combineRecordAndSectors(
297 std::vector<std::shared_ptr<const Track>>& tracks,
298 Decoder& decoder,
299 const std::shared_ptr<const LogicalTrackLayout>& ltl)
300{
301 CombinationResult cr = {HAS_NO_BAD_SECTORS};
302 std::vector<std::shared_ptr<const Sector>> track_sectors;
303
304 /* Add the sectors which were there. */
305
306 for (auto& track : tracks)
307 for (auto& sector : track->allSectors)
308 track_sectors.push_back(sector);
309
310 /* Add the sectors which should be there. */
311
312 for (unsigned sectorId : ltl->diskSectorOrder)
313 {
314 auto sector = std::make_shared<Sector>(
315 LogicalLocation{ltl->logicalCylinder, ltl->logicalHead, sectorId});
316
317 sector->status = Sector::MISSING;
318 sector->physicalLocation = std::make_optional(
319 CylinderHead(ltl->physicalCylinder, ltl->physicalHead));
320 track_sectors.push_back(sector);
321 }
322
323 /* Deduplicate. */
324
325 cr.sectors = collectSectors(track_sectors);
326 if (cr.sectors.empty())
327 cr.result = HAS_BAD_SECTORS;
328 for (const auto& sector : cr.sectors)
329 if (sector->status != Sector::OK)
330 cr.result = HAS_BAD_SECTORS;
331
332 return cr;
333}
334
335static void adjustTrackOnError(FluxSource& fluxSource, int baseTrack)
336{

Callers 1

readGroupFunction · 0.85

Calls 4

collectSectorsFunction · 0.85
CylinderHeadClass · 0.50
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected