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

Method mount

lib/vfs/zdos.cc:257–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255
256private:
257 void mount()
258 {
259 _sectorsPerTrack =
260 _diskLayout->layoutByLogicalLocation.at({0, 0})->numSectors;
261
262 int rootBlock = toBlockNumber(_config.filesystem_start().sector(),
263 _config.filesystem_start().track());
264 ZDosDescriptor zd(this, rootBlock);
265 if (zd.type != ZDOS_TYPE_DIRECTORY)
266 throw BadFilesystemException();
267
268 _totalBlocks = getLogicalSectorCount();
269 _usedBlocks = (zd.recordCount * zd.recordSize) / 0x80 + 1;
270 while (!zd.eof)
271 {
272 Bytes bytes = zd.readRecord();
273 ByteReader br(bytes);
274 for (;;)
275 {
276 int len = br.read_8();
277 if (len == 0xff)
278 break;
279
280 std::string filename = br.read(len & 0x7f);
281 int descriptorBlock = readBlockNumber(br);
282
283 auto dirent = std::make_unique<ZDosDirent>(
284 this, filename, descriptorBlock);
285 _usedBlocks +=
286 (dirent->zd.recordCount * dirent->zd.recordSize) / 0x80 + 1;
287 _dirents.push_back(std::move(dirent));
288 }
289 }
290 }
291
292 std::shared_ptr<ZDosDirent> findFile(const std::string filename)
293 {

Callers

nothing calls this directly

Calls 5

readRecordMethod · 0.80
read_8Method · 0.80
readMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected