From dda713a6be812cb1a66ea570a6b1405f512074f8 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 10 Sep 2022 22:47:35 +0200 Subject: [PATCH] Remove the rest of the mapper. --- arch/amiga/encoder.cc | 3 +- arch/apple2/encoder.cc | 3 +- arch/c64/encoder.cc | 3 +- arch/ibm/encoder.cc | 3 +- arch/macintosh/encoder.cc | 3 +- arch/micropolis/encoder.cc | 3 +- arch/northstar/encoder.cc | 3 +- arch/tids990/encoder.cc | 3 +- arch/victor9k/encoder.cc | 3 +- lib/build.mk | 1 - lib/encoders/encoders.cc | 14 +++++ lib/encoders/encoders.h | 4 +- lib/image.cc | 3 +- lib/imagereader/d64imagereader.cc | 4 -- lib/imagereader/d88imagereader.cc | 1 - lib/imagereader/dimimagereader.cc | 1 - lib/imagereader/diskcopyimagereader.cc | 1 - lib/imagereader/fdiimagereader.cc | 1 - lib/imagereader/imdimagereader.cc | 6 +- lib/imagereader/imgimagereader.cc | 1 - lib/imagereader/jv3imagereader.cc | 1 - lib/imagereader/nfdimagereader.cc | 1 - lib/imagereader/nsiimagereader.cc | 1 - lib/imagereader/td0imagereader.cc | 1 - lib/layout.cc | 65 +++++++++++++++++++ lib/layout.h | 22 ++++++- lib/mapper.cc | 86 -------------------------- lib/mapper.h | 21 ------- lib/readerwriter.cc | 8 +-- lib/vfs/fluxsectorinterface.cc | 5 +- src/gui/mainwindow.cc | 1 - 31 files changed, 122 insertions(+), 154 deletions(-) delete mode 100644 lib/mapper.cc delete mode 100644 lib/mapper.h diff --git a/arch/amiga/encoder.cc b/arch/amiga/encoder.cc index dab9a660..3dad3894 100644 --- a/arch/amiga/encoder.cc +++ b/arch/amiga/encoder.cc @@ -5,7 +5,6 @@ #include "crc.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "arch/amiga/amiga.pb.h" #include "lib/encoders/encoders.pb.h" @@ -156,7 +155,7 @@ public: auto fluxmap = std::make_unique(); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod( + calculatePhysicalClockPeriod( _config.clock_rate_us() * 1e3, 200e6)); return fluxmap; } diff --git a/arch/apple2/encoder.cc b/arch/apple2/encoder.cc index f45292e6..2ad0e7df 100644 --- a/arch/apple2/encoder.cc +++ b/arch/apple2/encoder.cc @@ -5,7 +5,6 @@ #include "sector.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "fmt/format.h" #include "lib/encoders/encoders.pb.h" #include @@ -75,7 +74,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod( + calculatePhysicalClockPeriod( _config.clock_period_us() * 1e3, _config.rotational_period_ms() * 1e6)); return fluxmap; diff --git a/arch/c64/encoder.cc b/arch/c64/encoder.cc index 6bbd990f..e444de4e 100644 --- a/arch/c64/encoder.cc +++ b/arch/c64/encoder.cc @@ -6,7 +6,6 @@ #include "sector.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "fmt/format.h" #include "arch/c64/c64.pb.h" #include "lib/encoders/encoders.pb.h" @@ -229,7 +228,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod(clockRateUs*1e3, 200e6)); + calculatePhysicalClockPeriod(clockRateUs*1e3, 200e6)); return fluxmap; } diff --git a/arch/ibm/encoder.cc b/arch/ibm/encoder.cc index 8d7baab3..78588514 100644 --- a/arch/ibm/encoder.cc +++ b/arch/ibm/encoder.cc @@ -5,7 +5,6 @@ #include "crc.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "arch/ibm/ibm.pb.h" #include "lib/encoders/encoders.pb.h" #include "fmt/format.h" @@ -286,7 +285,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(_bits, - Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3, + calculatePhysicalClockPeriod(clockRateUs * 1e3, trackdata.target_rotational_period_ms() * 1e6)); return fluxmap; } diff --git a/arch/macintosh/encoder.cc b/arch/macintosh/encoder.cc index 48703531..784ca290 100644 --- a/arch/macintosh/encoder.cc +++ b/arch/macintosh/encoder.cc @@ -5,7 +5,6 @@ #include "crc.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "fmt/format.h" #include "lib/encoders/encoders.pb.h" #include "arch/macintosh/macintosh.pb.h" @@ -266,7 +265,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6)); + calculatePhysicalClockPeriod(clockRateUs * 1e3, 200e6)); return fluxmap; } diff --git a/arch/micropolis/encoder.cc b/arch/micropolis/encoder.cc index 0158e95b..d2883682 100644 --- a/arch/micropolis/encoder.cc +++ b/arch/micropolis/encoder.cc @@ -4,7 +4,6 @@ #include "decoders/decoders.h" #include "encoders/encoders.h" #include "image.h" -#include "mapper.h" #include "lib/encoders/encoders.pb.h" static void write_sector(std::vector& bits, @@ -115,7 +114,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod( + calculatePhysicalClockPeriod( _config.clock_period_us() * 1e3, _config.rotational_period_ms() * 1e6)); return fluxmap; diff --git a/arch/northstar/encoder.cc b/arch/northstar/encoder.cc index 2aa96faf..cb1dd59b 100644 --- a/arch/northstar/encoder.cc +++ b/arch/northstar/encoder.cc @@ -5,7 +5,6 @@ #include "decoders/decoders.h" #include "encoders/encoders.h" #include "image.h" -#include "mapper.h" #include "lib/encoders/encoders.pb.h" #define GAP_FILL_SIZE_SD 30 @@ -172,7 +171,7 @@ public: std::unique_ptr fluxmap(new Fluxmap); fluxmap->appendBits(bits, - Mapper::calculatePhysicalClockPeriod( + calculatePhysicalClockPeriod( clockRateUs * 1e3, _config.rotational_period_ms() * 1e6)); return fluxmap; } diff --git a/arch/tids990/encoder.cc b/arch/tids990/encoder.cc index 42a7d487..5effd1c7 100644 --- a/arch/tids990/encoder.cc +++ b/arch/tids990/encoder.cc @@ -5,7 +5,6 @@ #include "crc.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "arch/tids990/tids990.pb.h" #include "lib/encoders/encoders.pb.h" #include @@ -151,7 +150,7 @@ public: auto fluxmap = std::make_unique(); fluxmap->appendBits(_bits, - Mapper::calculatePhysicalClockPeriod(clockRateUs * 1e3, + calculatePhysicalClockPeriod(clockRateUs * 1e3, _config.rotational_period_ms() * 1e6)); return fluxmap; } diff --git a/arch/victor9k/encoder.cc b/arch/victor9k/encoder.cc index d583344b..5420fa5c 100644 --- a/arch/victor9k/encoder.cc +++ b/arch/victor9k/encoder.cc @@ -6,7 +6,6 @@ #include "sector.h" #include "readerwriter.h" #include "image.h" -#include "mapper.h" #include "fmt/format.h" #include "arch/victor9k/victor9k.pb.h" #include "lib/encoders/encoders.pb.h" @@ -194,7 +193,7 @@ public: unsigned bitsPerRevolution = (trackdata.rotational_period_ms() * 1e3) / trackdata.clock_period_us(); std::vector bits(bitsPerRevolution); - nanoseconds_t clockPeriod = Mapper::calculatePhysicalClockPeriod( + nanoseconds_t clockPeriod = calculatePhysicalClockPeriod( trackdata.clock_period_us() * 1e3, trackdata.rotational_period_ms() * 1e6); unsigned cursor = 0; diff --git a/lib/build.mk b/lib/build.mk index 3baf2ec0..2da9cb07 100644 --- a/lib/build.mk +++ b/lib/build.mk @@ -55,7 +55,6 @@ LIBFLUXENGINE_SRCS = \ lib/layout.cc \ lib/ldbs.cc \ lib/logger.cc \ - lib/mapper.cc \ lib/proto.cc \ lib/readerwriter.cc \ lib/sector.cc \ diff --git a/lib/encoders/encoders.cc b/lib/encoders/encoders.cc index 30faf3b7..637712bf 100644 --- a/lib/encoders/encoders.cc +++ b/lib/encoders/encoders.cc @@ -13,6 +13,7 @@ #include "arch/tids990/tids990.h" #include "arch/victor9k/victor9k.h" #include "lib/encoders/encoders.pb.h" +#include "lib/proto.h" #include "protocol.h" std::unique_ptr AbstractEncoder::create( @@ -40,6 +41,19 @@ std::unique_ptr AbstractEncoder::create( return (encoder->second)(config); } +nanoseconds_t AbstractEncoder::calculatePhysicalClockPeriod( + nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod) +{ + nanoseconds_t currentRotationalPeriod = + config.drive().rotational_period_ms() * 1e6; + if (currentRotationalPeriod == 0) + Error() << "you must set --drive.rotational_period_ms as it can't be " + "autodetected"; + + return targetClockPeriod * + (currentRotationalPeriod / targetRotationalPeriod); +} + Fluxmap& Fluxmap::appendBits(const std::vector& bits, nanoseconds_t clock) { nanoseconds_t now = duration(); diff --git a/lib/encoders/encoders.h b/lib/encoders/encoders.h index c2859c34..518f939d 100644 --- a/lib/encoders/encoders.h +++ b/lib/encoders/encoders.h @@ -14,7 +14,6 @@ public: virtual ~AbstractEncoder() {} static std::unique_ptr create(const EncoderProto& config); - public: virtual std::vector> collectSectors( const Location& location, const Image& image) = 0; @@ -22,6 +21,9 @@ public: virtual std::unique_ptr encode(const Location& location, const std::vector>& sectors, const Image& image) = 0; + + nanoseconds_t calculatePhysicalClockPeriod( + nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod); }; #endif diff --git a/lib/image.cc b/lib/image.cc index 8382e4d4..d1cad01f 100644 --- a/lib/image.cc +++ b/lib/image.cc @@ -2,7 +2,6 @@ #include "lib/sector.h" #include "lib/image.h" #include "lib/layout.h" -#include "lib/mapper.h" Image::Image() {} @@ -69,7 +68,7 @@ std::shared_ptr Image::put( sector->logicalTrack = track; sector->logicalSide = side; sector->logicalSector = sectorid; - sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(track); + sector->physicalTrack = Layout::remapTrackLogicalToPhysical(track); sector->physicalHead = side; sector->physicalSector = trackLayout.logicalSectorToPhysical(sectorid); _sectors[key] = sector; diff --git a/lib/imagereader/d64imagereader.cc b/lib/imagereader/d64imagereader.cc index 7068b105..d748b62a 100644 --- a/lib/imagereader/d64imagereader.cc +++ b/lib/imagereader/d64imagereader.cc @@ -5,7 +5,6 @@ #include "fmt/format.h" #include "image.h" #include "logger.h" -#include "mapper.h" #include "proto.h" #include #include @@ -56,7 +55,6 @@ public: for (int track = 0; track < 40; track++) { int numSectors = sectorsPerTrack(track); - int physicalTrack = Mapper::remapTrackLogicalToPhysical(track); for (int head = 0; head < numHeads; head++) { for (int sectorId = 0; sectorId < numSectors; sectorId++) @@ -69,14 +67,12 @@ public: offset += 256; sector->status = Sector::OK; - sector->physicalTrack = physicalTrack; sector->data.writer().append(payload); } else { // no more data in input file. Write sectors with status: // DATA_MISSING sector->status = Sector::DATA_MISSING; - sector->physicalTrack = physicalTrack; } } } diff --git a/lib/imagereader/d88imagereader.cc b/lib/imagereader/d88imagereader.cc index 3afeae92..d35e021e 100644 --- a/lib/imagereader/d88imagereader.cc +++ b/lib/imagereader/d88imagereader.cc @@ -5,7 +5,6 @@ #include "image.h" #include "proto.h" #include "logger.h" -#include "mapper.h" #include "lib/config.pb.h" #include "fmt/format.h" #include diff --git a/lib/imagereader/dimimagereader.cc b/lib/imagereader/dimimagereader.cc index 2940f328..1a6fc631 100644 --- a/lib/imagereader/dimimagereader.cc +++ b/lib/imagereader/dimimagereader.cc @@ -4,7 +4,6 @@ #include "imagereader/imagereader.h" #include "image.h" #include "logger.h" -#include "mapper.h" #include "proto.h" #include "lib/config.pb.h" #include "fmt/format.h" diff --git a/lib/imagereader/diskcopyimagereader.cc b/lib/imagereader/diskcopyimagereader.cc index 495cd65b..2d46c7f5 100644 --- a/lib/imagereader/diskcopyimagereader.cc +++ b/lib/imagereader/diskcopyimagereader.cc @@ -4,7 +4,6 @@ #include "imagereader/imagereader.h" #include "image.h" #include "logger.h" -#include "mapper.h" #include "lib/config.pb.h" #include "fmt/format.h" #include diff --git a/lib/imagereader/fdiimagereader.cc b/lib/imagereader/fdiimagereader.cc index eb1936b1..5d2e7e5a 100644 --- a/lib/imagereader/fdiimagereader.cc +++ b/lib/imagereader/fdiimagereader.cc @@ -5,7 +5,6 @@ #include "image.h" #include "proto.h" #include "logger.h" -#include "mapper.h" #include "lib/config.pb.h" #include "fmt/format.h" #include diff --git a/lib/imagereader/imdimagereader.cc b/lib/imagereader/imdimagereader.cc index 2a583f39..ae8e79dc 100644 --- a/lib/imagereader/imdimagereader.cc +++ b/lib/imagereader/imdimagereader.cc @@ -5,7 +5,7 @@ #include "image.h" #include "proto.h" #include "logger.h" -#include "mapper.h" +#include "layout.h" #include "lib/config.pb.h" #include "fmt/format.h" #include @@ -372,14 +372,14 @@ public: if (blnOptionalCylinderMap) //there was een optional cylinder map. write it to the sector //The Sector Cylinder Map has one entry for each sector, and contains the logical Cylinder ID for the corresponding sector in the Sector Numbering Map. { - sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(header.track); + sector->physicalTrack = Layout::remapTrackLogicalToPhysical(header.track); sector->logicalTrack = optionalsector_map[s]; blnOptionalCylinderMap = false; } else { sector->logicalTrack = header.track; - sector->physicalTrack = Mapper::remapTrackLogicalToPhysical(header.track); + sector->physicalTrack = Layout::remapTrackLogicalToPhysical(header.track); } if (blnOptionalHeadMap) //there was een optional head map. write it to the sector //The Sector Head Map has one entry for each sector, and contains the logical Head ID for the corresponding sector in the Sector Numbering Map. diff --git a/lib/imagereader/imgimagereader.cc b/lib/imagereader/imgimagereader.cc index 4a6aa551..57226a79 100644 --- a/lib/imagereader/imgimagereader.cc +++ b/lib/imagereader/imgimagereader.cc @@ -4,7 +4,6 @@ #include "imagereader/imagereader.h" #include "image.h" #include "logger.h" -#include "mapper.h" #include "lib/config.pb.h" #include "lib/layout.pb.h" #include "lib/proto.h" diff --git a/lib/imagereader/jv3imagereader.cc b/lib/imagereader/jv3imagereader.cc index 1da05ba5..a451326c 100644 --- a/lib/imagereader/jv3imagereader.cc +++ b/lib/imagereader/jv3imagereader.cc @@ -3,7 +3,6 @@ #include "sector.h" #include "imagereader/imagereader.h" #include "image.h" -#include "mapper.h" #include "logger.h" #include "fmt/format.h" #include "lib/config.pb.h" diff --git a/lib/imagereader/nfdimagereader.cc b/lib/imagereader/nfdimagereader.cc index f4d13b26..61eefbd9 100644 --- a/lib/imagereader/nfdimagereader.cc +++ b/lib/imagereader/nfdimagereader.cc @@ -5,7 +5,6 @@ #include "image.h" #include "proto.h" #include "logger.h" -#include "mapper.h" #include "lib/config.pb.h" #include "fmt/format.h" #include diff --git a/lib/imagereader/nsiimagereader.cc b/lib/imagereader/nsiimagereader.cc index 8144f52f..a2e80d66 100644 --- a/lib/imagereader/nsiimagereader.cc +++ b/lib/imagereader/nsiimagereader.cc @@ -7,7 +7,6 @@ #include "image.h" #include "fmt/format.h" #include "logger.h" -#include "mapper.h" #include "lib/imagereader/imagereader.pb.h" #include #include diff --git a/lib/imagereader/td0imagereader.cc b/lib/imagereader/td0imagereader.cc index 9d00a675..dcb81bdc 100644 --- a/lib/imagereader/td0imagereader.cc +++ b/lib/imagereader/td0imagereader.cc @@ -5,7 +5,6 @@ #include "image.h" #include "crc.h" #include "logger.h" -#include "mapper.h" #include "fmt/format.h" #include "lib/config.pb.h" #include "fmt/format.h" diff --git a/lib/layout.cc b/lib/layout.cc index e3c05f58..862f5807 100644 --- a/lib/layout.cc +++ b/lib/layout.cc @@ -7,6 +7,71 @@ static Local, std::unique_ptr>> layoutCache; +unsigned Layout::remapTrackPhysicalToLogical(unsigned ptrack) +{ + return (ptrack - config.drive().head_bias()) / config.drive().head_width(); +} + +static unsigned getTrackStep() +{ + unsigned track_step = + (config.tpi() == 0) ? 1 : (config.drive().tpi() / config.tpi()); + + if (track_step == 0) + Error() + << "this drive can't write this image, because the head is too big"; + return track_step; +} + +unsigned Layout::remapTrackLogicalToPhysical(unsigned ltrack) +{ + return config.drive().head_bias() + ltrack * getTrackStep(); +} + +std::set Layout::computeLocations() +{ + std::set locations; + + std::set tracks; + if (config.has_tracks()) + tracks = iterate(config.tracks()); + else + tracks = iterate(0, config.layout().tracks()); + + std::set heads; + if (config.has_heads()) + heads = iterate(config.heads()); + else + heads = iterate(0, config.layout().sides()); + + for (unsigned logicalTrack : tracks) + { + for (unsigned head : heads) + locations.insert(computeLocationFor(logicalTrack, head)); + } + + return locations; +} + +Location Layout::computeLocationFor(unsigned logicalTrack, unsigned logicalHead) +{ + if ((logicalTrack < config.layout().tracks()) && + (logicalHead < config.layout().sides())) + { + unsigned track_step = getTrackStep(); + unsigned physicalTrack = + config.drive().head_bias() + logicalTrack * track_step; + + return {.physicalTrack = physicalTrack, + .logicalTrack = logicalTrack, + .head = logicalHead, + .groupSize = track_step}; + } + + Error() << fmt::format( + "track {}.{} is not part of the image", logicalTrack, logicalHead); +} + std::vector> Layout::getTrackOrdering( unsigned guessedTracks, unsigned guessedSides) { diff --git a/lib/layout.h b/lib/layout.h index f00cc8c2..0826b9e3 100644 --- a/lib/layout.h +++ b/lib/layout.h @@ -1,7 +1,7 @@ #ifndef LAYOUT_H #define LAYOUT_H -#include "lib/layout.pb.h" +#include "lib/flux.h" class Layout { @@ -14,9 +14,29 @@ private: Layout& operator=(const Layout&); public: + /* Translates logical track numbering (filesystem numbering) to + * the track numbering on the actual drive, taking into account tpi + * settings. + */ + static unsigned remapTrackPhysicalToLogical(unsigned physicalTrack); + static unsigned remapTrackLogicalToPhysical(unsigned logicalTrack); + + /* Computes a Location for a given logical track and side, which + * contains the physical drive location and group size. */ + static Location computeLocationFor( + unsigned logicalTrack, unsigned logicalSide); + + /* Uses the layout and current track and heads settings to determine + * which Locations are going to be read from or written to. 8/ + */ + static std::set computeLocations(); + + /* Returns a series of pairs representing the filesystem + * ordering of the disk, in logical numbers. */ static std::vector> getTrackOrdering( unsigned guessedTracks = 0, unsigned guessedSides = 0); + /* Returns the layout of a given track. */ static const Layout& getLayoutOfTrack( unsigned logicalTrack, unsigned logicalHead); diff --git a/lib/mapper.cc b/lib/mapper.cc deleted file mode 100644 index 619d05c1..00000000 --- a/lib/mapper.cc +++ /dev/null @@ -1,86 +0,0 @@ -#include "globals.h" -#include "sector.h" -#include "image.h" -#include "fmt/format.h" -#include "logger.h" -#include "proto.h" -#include "mapper.h" -#include "flux.h" - -unsigned Mapper::remapTrackPhysicalToLogical(unsigned ptrack) -{ - return (ptrack - config.drive().head_bias()) / config.drive().head_width(); -} - -static unsigned getTrackStep() -{ - unsigned track_step = - (config.tpi() == 0) ? 1 : (config.drive().tpi() / config.tpi()); - - if (track_step == 0) - Error() - << "this drive can't write this image, because the head is too big"; - return track_step; -} - -unsigned Mapper::remapTrackLogicalToPhysical(unsigned ltrack) -{ - return config.drive().head_bias() + ltrack * getTrackStep(); -} - -std::set Mapper::computeLocations() -{ - std::set locations; - - std::set tracks; - if (config.has_tracks()) - tracks = iterate(config.tracks()); - else - tracks = iterate(0, config.layout().tracks()); - - std::set heads; - if (config.has_heads()) - heads = iterate(config.heads()); - else - heads = iterate(0, config.layout().sides()); - - for (unsigned logicalTrack : tracks) - { - for (unsigned head : heads) - locations.insert(computeLocationFor(logicalTrack, head)); - } - - return locations; -} - -Location Mapper::computeLocationFor(unsigned logicalTrack, unsigned logicalHead) -{ - if ((logicalTrack < config.layout().tracks()) && - (logicalHead < config.layout().sides())) - { - unsigned track_step = getTrackStep(); - unsigned physicalTrack = - config.drive().head_bias() + logicalTrack * track_step; - - return {.physicalTrack = physicalTrack, - .logicalTrack = logicalTrack, - .head = logicalHead, - .groupSize = track_step}; - } - - Error() << fmt::format( - "track {}.{} is not part of the image", logicalTrack, logicalHead); -} - -nanoseconds_t Mapper::calculatePhysicalClockPeriod( - nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod) -{ - nanoseconds_t currentRotationalPeriod = - config.drive().rotational_period_ms() * 1e6; - if (currentRotationalPeriod == 0) - Error() << "you must set --drive.rotational_period_ms as it can't be " - "autodetected"; - - return targetClockPeriod * - (currentRotationalPeriod / targetRotationalPeriod); -} diff --git a/lib/mapper.h b/lib/mapper.h deleted file mode 100644 index 06017ce6..00000000 --- a/lib/mapper.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef MAPPER_H -#define MAPPER_H - -class SectorMappingProto; -class DriveProto; -class Location; - -class Mapper -{ -public: - static unsigned remapTrackPhysicalToLogical(unsigned track); - static unsigned remapTrackLogicalToPhysical(unsigned track); - - static std::set computeLocations(); - static Location computeLocationFor(unsigned track, unsigned side); - - static nanoseconds_t calculatePhysicalClockPeriod( - nanoseconds_t targetClockPeriod, nanoseconds_t targetRotationalPeriod); -}; - -#endif diff --git a/lib/readerwriter.cc b/lib/readerwriter.cc index 42a8e96b..82245aeb 100644 --- a/lib/readerwriter.cc +++ b/lib/readerwriter.cc @@ -14,7 +14,7 @@ #include "sector.h" #include "image.h" #include "logger.h" -#include "mapper.h" +#include "layout.h" #include "utils.h" #include "lib/config.pb.h" #include "proto.h" @@ -398,7 +398,7 @@ void writeDiskCommand(const Image& image, AbstractDecoder* decoder, FluxSource* fluxSource) { - auto locations = Mapper::computeLocations(); + auto locations = Layout::computeLocations(); writeDiskCommand(image, encoder, fluxSink, decoder, fluxSource, locations); } @@ -412,7 +412,7 @@ void writeRawDiskCommand(FluxSource& fluxSource, FluxSink& fluxSink) ->next(); }, dontVerify, - Mapper::computeLocations()); + Layout::computeLocations()); } std::shared_ptr readAndDecodeTrack( @@ -461,7 +461,7 @@ std::shared_ptr readDiskCommand( auto diskflux = std::make_shared(); Logger() << BeginOperationLogMessage{"Reading and decoding disk"}; - auto locations = Mapper::computeLocations(); + auto locations = Layout::computeLocations(); unsigned index = 0; for (const auto& location : locations) { diff --git a/lib/vfs/fluxsectorinterface.cc b/lib/vfs/fluxsectorinterface.cc index 3ca0e9fa..27eb4b6c 100644 --- a/lib/vfs/fluxsectorinterface.cc +++ b/lib/vfs/fluxsectorinterface.cc @@ -6,7 +6,6 @@ #include "lib/fluxsource/fluxsource.h" #include "lib/layout.h" #include "lib/proto.h" -#include "lib/mapper.h" class FluxSectorInterface : public SectorInterface { @@ -64,7 +63,7 @@ public: unsigned track = trackid.first; unsigned side = trackid.second; auto& trackLayout = Layout::getLayoutOfTrack(track, side); - locations.insert(Mapper::computeLocationFor(track, side)); + locations.insert(Layout::computeLocationFor(track, side)); /* If we don't have all the sectors of this track, we may need to * populate any non-changed sectors as we can only write a track at @@ -127,7 +126,7 @@ private: void populateSectors(unsigned track, unsigned side) { - auto location = Mapper::computeLocationFor(track, side); + auto location = Layout::computeLocationFor(track, side); auto trackdata = readAndDecodeTrack(*_fluxSource, *_decoder, location); for (const auto& sector : trackdata->sectors) diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index e5cb4813..d27f7728 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -11,7 +11,6 @@ #include "decoders/decoders.h" #include "lib/usb/usbfinder.h" #include "fmt/format.h" -#include "mapper.h" #include "utils.h" #include "fluxviewerwindow.h" #include "textviewerwindow.h"