MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / mainConvert

Function mainConvert

src/fe-convert.cc:32–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 });
31
32int mainConvert(int argc, const char* argv[])
33{
34 flags.parseFlags(argc, argv);
35
36 if ((globalConfig()->flux_sink().type() == FLUXTYPE_DRIVE) ||
37 (globalConfig()->flux_source().type() == FLUXTYPE_DRIVE))
38 error("you cannot read or write flux to a hardware device");
39 if ((globalConfig()->flux_sink().type() == FLUXTYPE_NOT_SET) ||
40 (globalConfig()->flux_source().type() == FLUXTYPE_NOT_SET))
41 error("you must specify both a source and destination flux filename");
42
43 auto fluxSource = FluxSource::create(globalConfig());
44 auto locations = globalConfig()->drive().tracks();
45 globalConfig().overrides()->set_tracks(locations);
46
47 auto diskLayout = createDiskLayout(globalConfig());
48 auto [minCylinder, maxCylinder, minHead, maxHead] =
49 diskLayout->getPhysicalBounds();
50 log("CONVERT: seen cylinders {}..{}, heads {}..{}",
51 minCylinder,
52 maxCylinder,
53 minHead,
54 maxHead);
55
56 auto fluxSinkFactory = FluxSinkFactory::create(globalConfig());
57 auto fluxSink = fluxSinkFactory->create();
58
59 for (const auto& physicalLocation : diskLayout->physicalLocations)
60 {
61 auto fi = fluxSource->readFlux(physicalLocation);
62 while (fi->hasNext())
63 fluxSink->addFlux(physicalLocation, *fi->next());
64 }
65
66 return 0;
67}

Callers

nothing calls this directly

Calls 11

errorFunction · 0.85
createDiskLayoutFunction · 0.85
parseFlagsMethod · 0.80
overridesMethod · 0.80
getPhysicalBoundsMethod · 0.80
logFunction · 0.50
createMethod · 0.45
readFluxMethod · 0.45
hasNextMethod · 0.45
addFluxMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected