mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Remove rawread and merge.
This commit is contained in:
		| @@ -19,11 +19,9 @@ cxxprogram( | ||||
|         "./fe-getfileinfo.cc", | ||||
|         "./fe-inspect.cc", | ||||
|         "./fe-ls.cc", | ||||
|         "./fe-merge.cc", | ||||
|         "./fe-mkdir.cc", | ||||
|         "./fe-mv.cc", | ||||
|         "./fe-putfile.cc", | ||||
|         "./fe-rawread.cc", | ||||
|         "./fe-rawwrite.cc", | ||||
|         "./fe-read.cc", | ||||
|         "./fe-rm.cc", | ||||
|   | ||||
| @@ -1,64 +0,0 @@ | ||||
| #include "lib/core/globals.h" | ||||
| #include "lib/config/flags.h" | ||||
| #include "lib/data/fluxmap.h" | ||||
| #include "lib/data/sector.h" | ||||
| #include "lib/config/proto.h" | ||||
| #include "lib/data/flux.h" | ||||
| #include "lib/external/fl2.h" | ||||
| #include "lib/external/fl2.pb.h" | ||||
| #include "src/fluxengine.h" | ||||
| #include <fstream> | ||||
|  | ||||
| static FlagGroup flags; | ||||
|  | ||||
| static std::vector<std::string> inputFluxFiles; | ||||
|  | ||||
| static StringFlag sourceFlux({"-s", "--source"}, | ||||
|     "flux file to read from (repeatable)", | ||||
|     "", | ||||
|     [](const auto& value) | ||||
|     { | ||||
|         inputFluxFiles.push_back(value); | ||||
|     }); | ||||
|  | ||||
| static StringFlag destFlux( | ||||
|     {"-d", "--dest"}, "destination flux file to write to", ""); | ||||
|  | ||||
| int mainMerge(int argc, const char* argv[]) | ||||
| { | ||||
|     flags.parseFlags(argc, argv); | ||||
|  | ||||
|     if (inputFluxFiles.empty()) | ||||
|         error("you must specify at least one input flux file (with -s)"); | ||||
|     if (destFlux.get() == "") | ||||
|         error("you must specify an output flux file (with -d)"); | ||||
|  | ||||
|     std::map<std::pair<int, int>, TrackFluxProto> data; | ||||
|     for (const auto& s : inputFluxFiles) | ||||
|     { | ||||
|         fmt::print("Reading {}...\n", s); | ||||
|         FluxFileProto f = loadFl2File(s); | ||||
|  | ||||
|         for (auto& trackflux : f.track()) | ||||
|         { | ||||
|             auto key = std::make_pair(trackflux.track(), trackflux.head()); | ||||
|             auto i = data.find(key); | ||||
|             if (i == data.end()) | ||||
|                 data[key] = trackflux; | ||||
|             else | ||||
|             { | ||||
|                 for (auto flux : trackflux.flux()) | ||||
|                     i->second.add_flux(flux); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     FluxFileProto proto; | ||||
|     for (auto& i : data) | ||||
|         *proto.add_track() = i.second; | ||||
|  | ||||
|     fmt::print("Writing {}...\n", destFlux.get()); | ||||
|     saveFl2File(destFlux.get(), proto); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| @@ -1,52 +0,0 @@ | ||||
| #include "lib/core/globals.h" | ||||
| #include "lib/config/config.h" | ||||
| #include "lib/config/flags.h" | ||||
| #include "lib/algorithms/readerwriter.h" | ||||
| #include "lib/data/fluxmap.h" | ||||
| #include "lib/decoders/decoders.h" | ||||
| #include "lib/data/sector.h" | ||||
| #include "lib/config/proto.h" | ||||
| #include "lib/fluxsink/fluxsink.h" | ||||
| #include "lib/fluxsource/fluxsource.h" | ||||
| #include "lib/imagewriter/imagewriter.h" | ||||
| #include "fluxengine.h" | ||||
| #include <google/protobuf/text_format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| static FlagGroup flags; | ||||
|  | ||||
| static StringFlag sourceFlux({"-s", "--source"}, | ||||
|     "flux file to read from", | ||||
|     "", | ||||
|     [](const auto& value) | ||||
|     { | ||||
|         globalConfig().setFluxSource(value); | ||||
|     }); | ||||
|  | ||||
| static StringFlag destFlux({"-d", "--dest"}, | ||||
|     "destination flux file to write to", | ||||
|     "", | ||||
|     [](const auto& value) | ||||
|     { | ||||
|         globalConfig().setFluxSink(value); | ||||
|     }); | ||||
|  | ||||
| int mainRawRead(int argc, const char* argv[]) | ||||
| { | ||||
|     globalConfig().overrides()->set_tracks("0-79"); | ||||
|  | ||||
|     if (argc == 1) | ||||
|         showProfiles("rawread", formats); | ||||
|     globalConfig().overrides()->mutable_flux_source()->set_type(FLUXTYPE_DRIVE); | ||||
|     flags.parseFlagsWithConfigFiles(argc, argv, formats); | ||||
|  | ||||
|     if (globalConfig()->flux_sink().type() == FLUXTYPE_DRIVE) | ||||
|         error("you can't use rawread to write to hardware"); | ||||
|  | ||||
|     auto fluxSource = FluxSource::create(globalConfig()); | ||||
|     auto fluxSink = FluxSink::create(globalConfig()); | ||||
|  | ||||
|     rawReadDiskCommand(*fluxSource, *fluxSink); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| @@ -16,11 +16,9 @@ extern command_cb mainGetFile; | ||||
| extern command_cb mainGetFileInfo; | ||||
| extern command_cb mainInspect; | ||||
| extern command_cb mainLs; | ||||
| extern command_cb mainMerge; | ||||
| extern command_cb mainMkDir; | ||||
| extern command_cb mainMv; | ||||
| extern command_cb mainPutFile; | ||||
| extern command_cb mainRawRead; | ||||
| extern command_cb mainRawWrite; | ||||
| extern command_cb mainRead; | ||||
| extern command_cb mainRm; | ||||
| @@ -51,10 +49,8 @@ static std::vector<Command> commands = | ||||
|     { "write",             mainWrite,             "Writes a sector image to a disk.", }, | ||||
| 	{ "fluxfile",          mainFluxfile,          "Flux file manipulation operations.", }, | ||||
| 	{ "format",            mainFormat,            "Format a disk and make a file system on it.", }, | ||||
| 	{ "rawread",           mainRawRead,           "Reads raw flux from a disk. Warning: you can't use this to copy disks.", }, | ||||
|     { "rawwrite",          mainRawWrite,          "Writes a flux file to a disk. Warning: you can't use this to copy disks.", }, | ||||
|     { "convert",           mainConvert,           "Converts a flux file from one format to another.", }, | ||||
| 	{ "merge",             mainMerge,             "Merge together multiple flux files.", }, | ||||
| 	{ "getdiskinfo",       mainGetDiskInfo,       "Read volume metadata off a disk (or image).", }, | ||||
| 	{ "ls",                mainLs,                "Show files on disk (or image).", }, | ||||
| 	{ "mv",                mainMv,                "Rename a file on a disk (or image).", }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user