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

Method mount

lib/vfs/microdos.cc:166–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164
165private:
166 void mount()
167 {
168 _rootBlock = getLogicalSector(0);
169 _catBlock = getLogicalSector(9);
170 Bytes directory = getLogicalSector(1, 8);
171
172 ByteReader rbr(_rootBlock);
173 rbr.seek(20);
174 _volumeLabel = trimWhitespace(rbr.read(44));
175
176 _dirents.clear();
177 ByteReader dbr(directory);
178 while (!dbr.eof())
179 {
180 Bytes direntBytes = dbr.read(16);
181 if ((direntBytes[0] != 0) && (direntBytes[0] != 0xff))
182 {
183 auto dirent =
184 std::make_unique<MicrodosDirent>(*this, direntBytes);
185 _dirents.push_back(std::move(dirent));
186 }
187 }
188
189 ByteReader cbr(_catBlock);
190 _totalBlocks = 630;
191 _usedBlocks = 0;
192 for (int i = 0; i < _totalBlocks / 8; i++)
193 {
194 uint8_t b = cbr.read_8();
195 _usedBlocks += countSetBits(b);
196 }
197 }
198
199 std::shared_ptr<MicrodosDirent> findFile(const std::string filename)
200 {

Callers

nothing calls this directly

Calls 8

trimWhitespaceFunction · 0.85
countSetBitsFunction · 0.85
read_8Method · 0.80
seekMethod · 0.45
readMethod · 0.45
clearMethod · 0.45
eofMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected