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

Function readAndDecodeTrack

lib/algorithms/readerwriter.cc:661–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661void readAndDecodeTrack(const DiskLayout& diskLayout,
662 FluxSource& fluxSource,
663 Decoder& decoder,
664 const std::shared_ptr<const LogicalTrackLayout>& ltl,
665 std::vector<std::shared_ptr<const Track>>& tracks,
666 std::vector<std::shared_ptr<const Sector>>& combinedSectors)
667{
668 if (fluxSource.isHardware())
669 measureDiskRotation();
670
671 FluxSourceIteratorHolder fluxSourceIteratorHolder(fluxSource);
672 int retriesRemaining = globalConfig()->decoder().retries();
673 for (;;)
674 {
675 auto [result, sectors] = readGroup(
676 diskLayout, fluxSourceIteratorHolder, ltl, tracks, decoder);
677 combinedSectors = sectors;
678 if (result == GOOD_READ)
679 break;
680 if (result == BAD_AND_CAN_NOT_RETRY)
681 {
682 log("no more data; giving up");
683 break;
684 }
685
686 if (retriesRemaining == 0)
687 {
688 log("giving up");
689 break;
690 }
691
692 if (fluxSource.isHardware())
693 {
694 adjustTrackOnError(fluxSource, ltl->physicalCylinder);
695 log("retrying; {} retries remaining", retriesRemaining);
696 retriesRemaining--;
697 }
698 }
699}
700
701void readDiskCommand(const DiskLayout& diskLayout,
702 FluxSource& fluxSource,

Callers 2

populateSectorsMethod · 0.85
readDiskCommandFunction · 0.85

Calls 5

measureDiskRotationFunction · 0.85
readGroupFunction · 0.85
adjustTrackOnErrorFunction · 0.85
logFunction · 0.50
isHardwareMethod · 0.45

Tested by

no test coverage detected