| 659 | } |
| 660 | |
| 661 | void 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 | |
| 701 | void readDiskCommand(const DiskLayout& diskLayout, |
| 702 | FluxSource& fluxSource, |
no test coverage detected