mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-24 11:11:02 -07:00
Rename track -> cylinder in lots of places.
This commit is contained in:
@@ -542,7 +542,7 @@ void writeDiskCommand(const Image& image,
|
||||
FluxSink& fluxSink,
|
||||
Decoder* decoder,
|
||||
FluxSource* fluxSource,
|
||||
const std::vector<TrackHead>& physicalLocations)
|
||||
const std::vector<CylinderHead>& physicalLocations)
|
||||
{
|
||||
auto trackinfos = Layout::getLayoutOfTracksPhysical(physicalLocations);
|
||||
if (fluxSource && decoder)
|
||||
@@ -638,7 +638,7 @@ std::shared_ptr<const DiskFlux> readDiskCommand(
|
||||
for (auto& physicalLocation : physicalLocations)
|
||||
{
|
||||
auto trackInfo = Layout::getLayoutOfTrackPhysical(
|
||||
physicalLocation.track, physicalLocation.head);
|
||||
physicalLocation.cylinder, physicalLocation.head);
|
||||
|
||||
log(OperationProgressLogMessage{
|
||||
index * 100 / (unsigned)physicalLocations.size()});
|
||||
@@ -758,7 +758,7 @@ void rawReadDiskCommand(FluxSource& fluxsource, FluxSink& fluxsink)
|
||||
|
||||
testForEmergencyStop();
|
||||
auto trackInfo = Layout::getLayoutOfTrackPhysical(
|
||||
physicalLocation.track, physicalLocation.head);
|
||||
physicalLocation.cylinder, physicalLocation.head);
|
||||
auto fluxSourceIterator = fluxsource.readFlux(
|
||||
trackInfo->physicalTrack, trackInfo->physicalSide);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ extern void writeDiskCommand(const Image& image,
|
||||
FluxSink& fluxSink,
|
||||
Decoder* decoder,
|
||||
FluxSource* fluxSource,
|
||||
const std::vector<TrackHead>& locations);
|
||||
const std::vector<CylinderHead>& locations);
|
||||
|
||||
extern void writeDiskCommand(const Image& image,
|
||||
Encoder& encoder,
|
||||
|
||||
@@ -65,25 +65,26 @@ unsigned Layout::remapSideLogicalToPhysical(unsigned lside)
|
||||
return lside ^ globalConfig()->layout().swap_sides();
|
||||
}
|
||||
|
||||
std::vector<TrackHead> Layout::computePhysicalLocations()
|
||||
std::vector<CylinderHead> Layout::computePhysicalLocations()
|
||||
{
|
||||
if (globalConfig()->has_tracks())
|
||||
return parseTrackHeadsString(globalConfig()->tracks());
|
||||
return parseCylinderHeadsString(globalConfig()->tracks());
|
||||
|
||||
std::set<unsigned> tracks = iterate(0, globalConfig()->layout().tracks());
|
||||
std::set<unsigned> heads = iterate(0, globalConfig()->layout().sides());
|
||||
|
||||
std::vector<TrackHead> locations;
|
||||
std::vector<CylinderHead> locations;
|
||||
for (unsigned logicalTrack : tracks)
|
||||
for (unsigned logicalHead : heads)
|
||||
locations.push_back(
|
||||
TrackHead{remapTrackLogicalToPhysical(logicalTrack),
|
||||
CylinderHead{remapTrackLogicalToPhysical(logicalTrack),
|
||||
remapSideLogicalToPhysical(logicalHead)});
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
||||
Layout::LayoutBounds Layout::getBounds(const std::vector<TrackHead>& locations)
|
||||
Layout::LayoutBounds Layout::getBounds(
|
||||
const std::vector<CylinderHead>& locations)
|
||||
{
|
||||
LayoutBounds r{.minTrack = INT_MAX,
|
||||
.maxTrack = INT_MIN,
|
||||
@@ -92,8 +93,8 @@ Layout::LayoutBounds Layout::getBounds(const std::vector<TrackHead>& locations)
|
||||
|
||||
for (const auto& ti : locations)
|
||||
{
|
||||
r.minTrack = std::min<int>(r.minTrack, ti.track);
|
||||
r.maxTrack = std::max<int>(r.maxTrack, ti.track);
|
||||
r.minTrack = std::min<int>(r.minTrack, ti.cylinder);
|
||||
r.maxTrack = std::max<int>(r.maxTrack, ti.cylinder);
|
||||
r.minSide = std::min<int>(r.minSide, ti.head);
|
||||
r.maxSide = std::max<int>(r.maxSide, ti.head);
|
||||
}
|
||||
@@ -260,14 +261,14 @@ std::shared_ptr<const TrackInfo> Layout::getLayoutOfTrackPhysical(
|
||||
}
|
||||
|
||||
std::shared_ptr<const TrackInfo> Layout::getLayoutOfTrackPhysical(
|
||||
const TrackHead& physicalLocation)
|
||||
const CylinderHead& physicalLocation)
|
||||
{
|
||||
return getLayoutOfTrackPhysical(
|
||||
physicalLocation.track, physicalLocation.head);
|
||||
physicalLocation.cylinder, physicalLocation.head);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<const TrackInfo>> Layout::getLayoutOfTracksPhysical(
|
||||
const std::vector<TrackHead>& physicalLocations)
|
||||
const std::vector<CylinderHead>& physicalLocations)
|
||||
{
|
||||
std::vector<std::shared_ptr<const TrackInfo>> results;
|
||||
for (const auto& physicalLocation : physicalLocations)
|
||||
|
||||
@@ -27,15 +27,15 @@ public:
|
||||
/* Uses the layout and current track and heads settings to determine
|
||||
* which physical tracks are going to be read from or written to.
|
||||
*/
|
||||
static std::vector<TrackHead> computePhysicalLocations();
|
||||
static std::vector<CylinderHead> computePhysicalLocations();
|
||||
|
||||
/* Given a list of TrackHead locations, determines the minimum and maximum
|
||||
* track and side settings. */
|
||||
/* Given a list of CylinderHead locations, determines the minimum and
|
||||
* maximum track and side settings. */
|
||||
struct LayoutBounds
|
||||
{
|
||||
int minTrack, maxTrack, minSide, maxSide;
|
||||
};
|
||||
static LayoutBounds getBounds(const std::vector<TrackHead>& locations);
|
||||
static LayoutBounds getBounds(const std::vector<CylinderHead>& locations);
|
||||
|
||||
/* Returns a series of <track, side> pairs representing the filesystem
|
||||
* ordering of the disk, in logical numbers. */
|
||||
@@ -54,11 +54,11 @@ public:
|
||||
|
||||
/* Returns the layout of a given track via physical location. */
|
||||
static std::shared_ptr<const TrackInfo> getLayoutOfTrackPhysical(
|
||||
const TrackHead& physicalLocation);
|
||||
const CylinderHead& physicalLocation);
|
||||
|
||||
/* Returns the layouts of a multiple tracks via physical location. */
|
||||
static std::vector<std::shared_ptr<const TrackInfo>>
|
||||
getLayoutOfTracksPhysical(const std::vector<TrackHead>& locations);
|
||||
getLayoutOfTracksPhysical(const std::vector<CylinderHead>& locations);
|
||||
|
||||
/* Expand a SectorList into the actual sector IDs. */
|
||||
static std::vector<unsigned> expandSectorList(
|
||||
|
||||
@@ -64,14 +64,14 @@ namespace grammar
|
||||
{
|
||||
static constexpr auto rule = dsl::lit_c<'c'> + dsl::p<members> +
|
||||
dsl::lit_c<'h'> + dsl::p<members>;
|
||||
static constexpr auto value = lexy::callback<std::vector<TrackHead>>(
|
||||
static constexpr auto value = lexy::callback<std::vector<CylinderHead>>(
|
||||
[](const std::vector<unsigned>& cs, const std::vector<unsigned>& hs)
|
||||
{
|
||||
std::vector<TrackHead> result;
|
||||
std::vector<CylinderHead> result;
|
||||
|
||||
for (unsigned c : cs)
|
||||
for (unsigned h : hs)
|
||||
result.push_back(TrackHead{c, h});
|
||||
result.push_back(CylinderHead{c, h});
|
||||
|
||||
return result;
|
||||
});
|
||||
@@ -82,9 +82,9 @@ namespace grammar
|
||||
static constexpr auto rule =
|
||||
dsl::list(dsl::p<ch>, dsl::sep(dsl::ascii::space));
|
||||
static constexpr auto value =
|
||||
lexy::fold_inplace<std::vector<TrackHead>>({},
|
||||
[](std::vector<TrackHead>& result,
|
||||
const std::vector<TrackHead>& item)
|
||||
lexy::fold_inplace<std::vector<CylinderHead>>({},
|
||||
[](std::vector<CylinderHead>& result,
|
||||
const std::vector<CylinderHead>& item)
|
||||
{
|
||||
result.insert(result.end(), item.begin(), item.end());
|
||||
});
|
||||
@@ -133,7 +133,7 @@ struct _error_collector
|
||||
};
|
||||
constexpr auto error_collector = _error_collector();
|
||||
|
||||
std::vector<TrackHead> parseTrackHeadsString(const std::string& s)
|
||||
std::vector<CylinderHead> parseCylinderHeadsString(const std::string& s)
|
||||
{
|
||||
auto input = lexy::string_input(s);
|
||||
auto result = lexy::parse<grammar::chs>(input, error_collector);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
class TrackHead
|
||||
struct CylinderHead
|
||||
{
|
||||
public:
|
||||
bool operator==(const TrackHead&) const = default;
|
||||
bool operator==(const CylinderHead&) const = default;
|
||||
|
||||
unsigned track;
|
||||
unsigned head;
|
||||
unsigned cylinder, head;
|
||||
};
|
||||
|
||||
extern std::vector<TrackHead> parseTrackHeadsString(const std::string& s);
|
||||
extern std::vector<CylinderHead> parseCylinderHeadsString(const std::string& s);
|
||||
|
||||
@@ -101,11 +101,11 @@ public:
|
||||
head);
|
||||
return;
|
||||
}
|
||||
ScpTrack trackheader = {0};
|
||||
trackheader.header.track_id[0] = 'T';
|
||||
trackheader.header.track_id[1] = 'R';
|
||||
trackheader.header.track_id[2] = 'K';
|
||||
trackheader.header.strack = strack;
|
||||
ScpTrack trackHeader = {0};
|
||||
trackHeader.header.track_id[0] = 'T';
|
||||
trackHeader.header.track_id[1] = 'R';
|
||||
trackHeader.header.track_id[2] = 'K';
|
||||
trackHeader.header.strack = strack;
|
||||
|
||||
FluxmapReader fmr(fluxmap);
|
||||
Bytes fluxdata;
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
revolution = 0;
|
||||
if (revolution >= 0)
|
||||
{
|
||||
auto* revheader = &trackheader.revolution[revolution];
|
||||
auto* revheader = &trackHeader.revolution[revolution];
|
||||
write_le32(
|
||||
revheader->offset, startOffset + sizeof(ScpTrack));
|
||||
write_le32(revheader->length,
|
||||
@@ -173,7 +173,8 @@ public:
|
||||
_fileheader.revolutions = revolution;
|
||||
write_le32(
|
||||
_fileheader.track[strack], trackdataWriter.pos + sizeof(ScpHeader));
|
||||
trackdataWriter += Bytes((uint8_t*)&trackheader, sizeof(trackheader));
|
||||
trackdataWriter +=
|
||||
Bytes((uint8_t*)&trackHeader, sizeof(trackHeader));
|
||||
trackdataWriter += fluxdata;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,17 +71,17 @@ public:
|
||||
int tracks = _header.tracks * _header.sides;
|
||||
for (int i = 0; i < tracks; i++)
|
||||
{
|
||||
CwfTrack trackheader;
|
||||
_if.read((char*)&trackheader, sizeof(trackheader));
|
||||
CwfTrack trackHeader;
|
||||
_if.read((char*)&trackHeader, sizeof(trackHeader));
|
||||
check_for_error();
|
||||
|
||||
uint32_t length =
|
||||
Bytes(trackheader.length, 4).reader().read_le32() -
|
||||
Bytes(trackHeader.length, 4).reader().read_le32() -
|
||||
sizeof(CwfTrack);
|
||||
unsigned track_number = trackheader.track * _header.step;
|
||||
unsigned track_number = trackHeader.track * _header.step;
|
||||
|
||||
off_t pos = _if.tellg();
|
||||
_trackOffsets[std::make_pair(track_number, trackheader.side)] =
|
||||
_trackOffsets[std::make_pair(track_number, trackHeader.side)] =
|
||||
std::make_pair(pos, length);
|
||||
_if.seekg(pos + length);
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ public:
|
||||
if (offset == 0)
|
||||
return std::make_unique<Fluxmap>();
|
||||
|
||||
ScpTrackHeader trackheader;
|
||||
ScpTrackHeader trackHeader;
|
||||
_if.seekg(offset, std::ios::beg);
|
||||
_if.read((char*)&trackheader, sizeof(trackheader));
|
||||
_if.read((char*)&trackHeader, sizeof(trackHeader));
|
||||
check_for_error();
|
||||
|
||||
if ((trackheader.track_id[0] != 'T') ||
|
||||
(trackheader.track_id[1] != 'R') ||
|
||||
(trackheader.track_id[2] != 'K'))
|
||||
if ((trackHeader.track_id[0] != 'T') ||
|
||||
(trackHeader.track_id[1] != 'R') ||
|
||||
(trackHeader.track_id[2] != 'K'))
|
||||
error("corrupt SCP file");
|
||||
|
||||
std::vector<ScpTrackRevolution> revs(_header.revolutions);
|
||||
|
||||
@@ -76,9 +76,10 @@ public:
|
||||
trackHeaderWriter.write_le16(actualSectors);
|
||||
trackHeaderWriter.write_8(dataRate);
|
||||
trackHeaderWriter.write_8(recordingMode);
|
||||
trackHeaderWriter.write_8(0); /* format gap length */
|
||||
trackHeaderWriter.write_8(0); /* filler byte */
|
||||
trackHeaderWriter.write_le16(0); /* approximate track length */
|
||||
trackHeaderWriter.write_8(0); /* format gap length */
|
||||
trackHeaderWriter.write_8(0); /* filler byte */
|
||||
trackHeaderWriter.write_le16(
|
||||
0); /* approximate track length */
|
||||
|
||||
for (int sectorId = 0; sectorId < geometry.numSectors;
|
||||
sectorId++)
|
||||
@@ -99,7 +100,7 @@ public:
|
||||
trackHeaderWriter.write_8(
|
||||
(sector->status == Sector::OK)
|
||||
? 0x00
|
||||
: 0x20); /* 8272 status 1 */
|
||||
: 0x20); /* 8272 status 1 */
|
||||
trackHeaderWriter.write_8(0); /* 8272 status 2 */
|
||||
trackHeaderWriter.write_8(1); /* number of copies */
|
||||
trackHeaderWriter.write_8(0); /* filler byte */
|
||||
@@ -113,7 +114,8 @@ public:
|
||||
|
||||
uint32_t trackLabel = (('T') << 24) | ((track & 0xff) << 16) |
|
||||
((track >> 8) << 8) | side;
|
||||
uint32_t trackHeaderAddress = ldbs.put(trackHeader, trackLabel);
|
||||
uint32_t trackHeaderAddress =
|
||||
ldbs.put(trackHeader, trackLabel);
|
||||
trackDirectoryWriter.write_be32(trackLabel);
|
||||
trackDirectoryWriter.write_le32(trackHeaderAddress);
|
||||
trackDirectorySize++;
|
||||
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
|
||||
void flushChanges() override
|
||||
{
|
||||
std::vector<TrackHead> locations;
|
||||
std::vector<CylinderHead> locations;
|
||||
|
||||
for (const auto& trackid : _changedTracks)
|
||||
{
|
||||
unsigned track = trackid.first;
|
||||
unsigned side = trackid.second;
|
||||
auto trackLayout = Layout::getLayoutOfTrack(track, side);
|
||||
locations.push_back(TrackHead{
|
||||
locations.push_back(CylinderHead{
|
||||
trackLayout->physicalTrack, trackLayout->physicalSide});
|
||||
|
||||
/* If we don't have all the sectors of this track, we may need to
|
||||
|
||||
Reference in New Issue
Block a user