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

Method mount

lib/vfs/lif.cc:204–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203private:
204 void mount()
205 {
206 _sectorSize = getLogicalSectorSize();
207 _sectorsPerBlock = _sectorSize / _config.block_size();
208
209 _rootBlock = getLifBlock(0);
210
211 ByteReader rbr(_rootBlock);
212 if (rbr.read_be16() != 0x8000)
213 throw BadFilesystemException();
214 _volumeLabel = trimWhitespace(rbr.read(6));
215 _directoryBlock = rbr.read_be32();
216 rbr.skip(4);
217 _directorySize = rbr.read_be32();
218 rbr.skip(4);
219 unsigned tracks = rbr.read_be32();
220 unsigned heads = rbr.read_be32();
221 unsigned sectors = rbr.read_be32();
222 _usedBlocks = 1 + _directorySize;
223
224 Bytes directory = getLifBlock(_directoryBlock, _directorySize);
225
226 _dirents.clear();
227 ByteReader br(directory);
228 while (!br.eof())
229 {
230 Bytes direntBytes = br.read(32);
231 if (direntBytes[0] != 0xff)
232 {
233 auto dirent = std::make_unique<LifDirent>(_config, direntBytes);
234 _usedBlocks += dirent->length / _config.block_size();
235 _dirents.push_back(std::move(dirent));
236 }
237 }
238 _totalBlocks = std::max(tracks * heads * sectors, _usedBlocks);
239 }
240
241 std::shared_ptr<LifDirent> findFile(const std::string filename)
242 {

Callers 2

testBitmapFunction · 0.45
testPutGetFunction · 0.45

Calls 8

trimWhitespaceFunction · 0.85
read_be16Method · 0.80
read_be32Method · 0.80
readMethod · 0.45
clearMethod · 0.45
eofMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected