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

Method mount

lib/vfs/cpmfs.cc:550–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548
549public:
550 void mount() override
551 {
552 auto& start = _config.filesystem_start();
553 _filesystemStart =
554 getOffsetOfSector(start.track(), start.side(), start.sector());
555 _sectorSize = getLogicalSectorSize(start.track(), start.side());
556
557 _blockSectors = _config.block_size() / _sectorSize;
558 _recordsPerBlock = _config.block_size() / 128;
559 _dirBlocks = (_config.dir_entries() * 32) / _config.block_size();
560
561 _filesystemBlocks =
562 (getLogicalSectorCount() - _filesystemStart) / _blockSectors;
563 _allocationMapSize = (_filesystemBlocks < 256) ? 1 : 2;
564
565 int physicalExtentSize;
566 if (_allocationMapSize == 1)
567 {
568 /* One byte allocation maps */
569 physicalExtentSize = _config.block_size() * 16;
570 }
571 else
572 {
573 /* Two byte allocation maps */
574 physicalExtentSize = _config.block_size() * 8;
575 }
576 _logicalExtentsPerEntry = physicalExtentSize / 16384;
577 _logicalExtentMask = _logicalExtentsPerEntry - 1;
578 _blocksPerLogicalExtent = 16384 / _config.block_size();
579
580 _directory = getCpmBlock(0, _dirBlocks);
581
582 /* Create the allocation bitmap. */
583
584 _bitmap.clear();
585 _bitmap.resize(_filesystemBlocks);
586 for (int d = 0; d < _dirBlocks; d++)
587 _bitmap[d] = true;
588 for (int d = 0; d < _config.dir_entries(); d++)
589 {
590 std::unique_ptr<Entry> entry = getEntry(d);
591 if (entry->deleted)
592 continue;
593 for (unsigned block : entry->allocation_map)
594 {
595 if (block >= _filesystemBlocks)
596 throw BadFilesystemException();
597 if (block)
598 _bitmap[block] = true;
599 }
600 }
601 }
602
603 void unmount()
604 {

Callers

nothing calls this directly

Calls 3

clearMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected