| 30 | }); |
| 31 | |
| 32 | int 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 | } |
nothing calls this directly
no test coverage detected