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