mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Format.
This commit is contained in:
@@ -83,7 +83,8 @@ static std::set<std::shared_ptr<const Sector>> collectSectors(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true if the result contains bad sectors. */
|
/* Returns true if the result contains bad sectors. */
|
||||||
bool combineRecordAndSectors(TrackFlux& trackFlux, AbstractDecoder& decoder, const Location& location)
|
bool combineRecordAndSectors(
|
||||||
|
TrackFlux& trackFlux, AbstractDecoder& decoder, const Location& location)
|
||||||
{
|
{
|
||||||
std::set<std::shared_ptr<const Sector>> track_sectors;
|
std::set<std::shared_ptr<const Sector>> track_sectors;
|
||||||
|
|
||||||
@@ -91,25 +92,24 @@ bool combineRecordAndSectors(TrackFlux& trackFlux, AbstractDecoder& decoder, con
|
|||||||
track_sectors.insert(
|
track_sectors.insert(
|
||||||
trackdataflux->sectors.begin(), trackdataflux->sectors.end());
|
trackdataflux->sectors.begin(), trackdataflux->sectors.end());
|
||||||
|
|
||||||
for (unsigned logical_sector : decoder.requiredSectors(trackFlux.location))
|
for (unsigned logical_sector : decoder.requiredSectors(trackFlux.location))
|
||||||
{
|
{
|
||||||
auto sector = std::make_shared<Sector>(location);
|
auto sector = std::make_shared<Sector>(location);
|
||||||
sector->logicalSector = logical_sector;
|
sector->logicalSector = logical_sector;
|
||||||
sector->status = Sector::MISSING;
|
sector->status = Sector::MISSING;
|
||||||
track_sectors.insert(sector);
|
track_sectors.insert(sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
trackFlux.sectors = collectSectors(track_sectors);
|
trackFlux.sectors = collectSectors(track_sectors);
|
||||||
if (trackFlux.sectors.empty())
|
if (trackFlux.sectors.empty())
|
||||||
return true;
|
return true;
|
||||||
for (const auto& sector : trackFlux.sectors)
|
for (const auto& sector : trackFlux.sectors)
|
||||||
if (sector->status != Sector::OK)
|
if (sector->status != Sector::OK)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true if the result contains bad sectors. */
|
|
||||||
ReadResult readGroup(FluxSource& fluxSource,
|
ReadResult readGroup(FluxSource& fluxSource,
|
||||||
const Location& location,
|
const Location& location,
|
||||||
TrackFlux& trackFlux,
|
TrackFlux& trackFlux,
|
||||||
@@ -120,8 +120,8 @@ ReadResult readGroup(FluxSource& fluxSource,
|
|||||||
for (unsigned offset = 0; offset < location.groupSize;
|
for (unsigned offset = 0; offset < location.groupSize;
|
||||||
offset += config.drive().head_width())
|
offset += config.drive().head_width())
|
||||||
{
|
{
|
||||||
auto fluxSourceIterator = fluxSource.readFlux(
|
auto fluxSourceIterator =
|
||||||
location.physicalTrack + offset, location.head);
|
fluxSource.readFlux(location.physicalTrack + offset, location.head);
|
||||||
if (!fluxSourceIterator->hasNext())
|
if (!fluxSourceIterator->hasNext())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ ReadResult readGroup(FluxSource& fluxSource,
|
|||||||
result = BAD_AND_CAN_RETRY;
|
result = BAD_AND_CAN_RETRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeTracks(FluxSink& fluxSink,
|
void writeTracks(FluxSink& fluxSink,
|
||||||
@@ -163,9 +163,10 @@ void writeTracks(FluxSink& fluxSink,
|
|||||||
for (unsigned offset = 0; offset < location.groupSize;
|
for (unsigned offset = 0; offset < location.groupSize;
|
||||||
offset += config.drive().head_width())
|
offset += config.drive().head_width())
|
||||||
{
|
{
|
||||||
unsigned physicalTrack = location.physicalTrack + offset;
|
unsigned physicalTrack = location.physicalTrack + offset;
|
||||||
|
|
||||||
Logger() << BeginWriteOperationLogMessage{physicalTrack, location.head};
|
Logger() << BeginWriteOperationLogMessage{
|
||||||
|
physicalTrack, location.head};
|
||||||
|
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
{
|
{
|
||||||
@@ -243,19 +244,21 @@ void writeTracksAndVerify(FluxSink& fluxSink,
|
|||||||
},
|
},
|
||||||
[&](const Location& location)
|
[&](const Location& location)
|
||||||
{
|
{
|
||||||
auto trackFlux = std::make_shared<TrackFlux>();
|
auto trackFlux = std::make_shared<TrackFlux>();
|
||||||
trackFlux->location = location;
|
trackFlux->location = location;
|
||||||
readGroup(fluxSource, location, *trackFlux, decoder);
|
readGroup(fluxSource, location, *trackFlux, decoder);
|
||||||
Logger() << TrackReadLogMessage{ trackFlux };
|
Logger() << TrackReadLogMessage{trackFlux};
|
||||||
|
|
||||||
auto wantedSectors = encoder.collectSectors(location, image);
|
auto wantedSectors = encoder.collectSectors(location, image);
|
||||||
std::sort(wantedSectors.begin(), wantedSectors.end(),
|
std::sort(wantedSectors.begin(),
|
||||||
sectorPointerSortPredicate);
|
wantedSectors.end(),
|
||||||
|
sectorPointerSortPredicate);
|
||||||
|
|
||||||
std::vector<std::shared_ptr<const Sector>> gotSectors(
|
std::vector<std::shared_ptr<const Sector>> gotSectors(
|
||||||
trackFlux->sectors.begin(), trackFlux->sectors.end());
|
trackFlux->sectors.begin(), trackFlux->sectors.end());
|
||||||
std::sort(gotSectors.begin(), gotSectors.end(),
|
std::sort(gotSectors.begin(),
|
||||||
sectorPointerSortPredicate);
|
gotSectors.end(),
|
||||||
|
sectorPointerSortPredicate);
|
||||||
|
|
||||||
return std::equal(gotSectors.begin(),
|
return std::equal(gotSectors.begin(),
|
||||||
gotSectors.end(),
|
gotSectors.end(),
|
||||||
@@ -287,8 +290,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink)
|
|||||||
fluxSink,
|
fluxSink,
|
||||||
[&](const Location& location)
|
[&](const Location& location)
|
||||||
{
|
{
|
||||||
return fluxSource
|
return fluxSource.readFlux(location.physicalTrack, location.head)
|
||||||
.readFlux(location.physicalTrack, location.head)
|
|
||||||
->next();
|
->next();
|
||||||
},
|
},
|
||||||
dontVerify);
|
dontVerify);
|
||||||
|
|||||||
Reference in New Issue
Block a user