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

Method createFilesystemFromConfig

lib/vfs/vfs.cc:234–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234std::unique_ptr<Filesystem> Filesystem::createFilesystemFromConfig()
235{
236 std::shared_ptr<SectorInterface> sectorInterface;
237 auto diskLayout = createDiskLayout(globalConfig());
238 if (globalConfig().hasFluxSource() || globalConfig().hasFluxSink())
239 {
240 std::shared_ptr<FluxSource> fluxSource;
241 std::shared_ptr<Decoder> decoder;
242 std::shared_ptr<FluxSinkFactory> fluxSinkFactory;
243 std::shared_ptr<Encoder> encoder;
244 if (globalConfig().hasFluxSource())
245 {
246 fluxSource = FluxSource::create(globalConfig());
247 decoder = Arch::createDecoder(globalConfig());
248 }
249 if (globalConfig()->flux_sink().type() == FLUXTYPE_DRIVE)
250 {
251 fluxSinkFactory = FluxSinkFactory::create(globalConfig());
252 encoder = Arch::createEncoder(globalConfig());
253 }
254 sectorInterface = SectorInterface::createFluxSectorInterface(
255 diskLayout, fluxSource, fluxSinkFactory, encoder, decoder);
256 }
257 else
258 {
259 std::shared_ptr<ImageReader> reader;
260 std::shared_ptr<ImageWriter> writer;
261 if (globalConfig().hasImageReader() &&
262 doesFileExist(globalConfig()->image_reader().filename()))
263 reader = ImageReader::create(globalConfig());
264 if (globalConfig().hasImageWriter())
265 writer = ImageWriter::create(globalConfig());
266
267 sectorInterface = SectorInterface::createImageSectorInterface(
268 diskLayout, reader, writer);
269 }
270
271 return createFilesystem(
272 globalConfig()->filesystem(), diskLayout, sectorInterface);
273}
274
275Bytes Filesystem::getSector(unsigned track, unsigned side, unsigned sector)
276{

Callers

nothing calls this directly

Calls 6

createDiskLayoutFunction · 0.85
doesFileExistFunction · 0.85
hasFluxSourceMethod · 0.80
hasFluxSinkMethod · 0.80
hasImageReaderMethod · 0.80
hasImageWriterMethod · 0.80

Tested by

no test coverage detected