mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
copy-flux-to works.
This commit is contained in:
@@ -14,6 +14,7 @@ import "arch/mx/mx.proto";
|
||||
import "arch/tids990/tids990.proto";
|
||||
import "arch/victor9k/victor9k.proto";
|
||||
import "arch/zilogmcz/zilogmcz.proto";
|
||||
import "lib/fluxsink/fluxsink.proto";
|
||||
import "lib/common.proto";
|
||||
|
||||
message DecoderProto {
|
||||
@@ -43,8 +44,8 @@ message DecoderProto {
|
||||
ZilogMczDecoderProto zilogmcz = 18;
|
||||
}
|
||||
|
||||
optional string copy_flux_to = 19
|
||||
[(help) = "while decoding, write a copy of the flux to this file"];
|
||||
optional FluxSinkProto copy_flux_to = 19
|
||||
[(help) = "while decoding, write a copy of the flux here"];
|
||||
optional bool dump_records = 20 [default = false,
|
||||
(help) = "if set, then dump the parsed but undecoded disk records"];
|
||||
optional bool dump_sectors = 21 [default = false,
|
||||
|
||||
@@ -65,6 +65,8 @@ static void replace_sector(std::unique_ptr<Sector>& replacing, Sector& replaceme
|
||||
|
||||
void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWriter& writer)
|
||||
{
|
||||
outputFluxSink = FluxSink::create(config.decoder().copy_flux_to());
|
||||
|
||||
bool failures = false;
|
||||
SectorSet allSectors;
|
||||
for (int cylinder : iterate(config.cylinders()))
|
||||
@@ -185,7 +187,7 @@ void readDiskCommand(FluxSource& fluxsource, AbstractDecoder& decoder, ImageWrit
|
||||
}
|
||||
|
||||
writer.printMap(allSectors);
|
||||
if (!config.decoder().has_write_csv_to())
|
||||
if (config.decoder().has_write_csv_to())
|
||||
writer.writeCsv(allSectors, config.decoder().write_csv_to());
|
||||
writer.writeImage(allSectors);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "proto.h"
|
||||
#include "dataspec.h"
|
||||
#include "fluxsource/fluxsource.h"
|
||||
#include "fluxsink/fluxsink.h"
|
||||
#include "arch/brother/brother.h"
|
||||
#include "arch/ibm/ibm.h"
|
||||
#include "imagewriter/imagewriter.h"
|
||||
@@ -46,6 +47,15 @@ static StringFlag destImage(
|
||||
ImageWriter::updateConfigForFilename(config.mutable_output()->mutable_image(), value);
|
||||
});
|
||||
|
||||
static StringFlag copyFluxTo(
|
||||
{ "--copy-flux-to" },
|
||||
"while reading, copy the read flux to this file",
|
||||
"",
|
||||
[](const auto& value)
|
||||
{
|
||||
FluxSink::updateConfigForFilename(config.mutable_decoder()->mutable_copy_flux_to(), value);
|
||||
});
|
||||
|
||||
static StringFlag srcCylinders(
|
||||
{ "--cylinders", "-c" },
|
||||
"cylinders to read from",
|
||||
@@ -73,6 +83,9 @@ int mainRead(int argc, const char* argv[])
|
||||
if (!config.input().has_flux() || !config.output().has_image())
|
||||
Error() << "incomplete config (did you remember to specify the format?)";
|
||||
|
||||
if (config.decoder().copy_flux_to().has_drive())
|
||||
Error() << "you cannot copy flux to a hardware device";
|
||||
|
||||
std::unique_ptr<FluxSource> fluxSource(FluxSource::create(config.input().flux()));
|
||||
std::unique_ptr<AbstractDecoder> decoder(AbstractDecoder::create(config.decoder()));
|
||||
std::unique_ptr<ImageWriter> writer(ImageWriter::create(config.output().image()));
|
||||
|
||||
Reference in New Issue
Block a user