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

Method Directory

lib/vfs/cbmfs.cc:115–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113 {
114 public:
115 Directory(CbmfsFilesystem* fs)
116 {
117 /* Read the BAM. */
118
119 uint8_t t = fs->_config.directory_track();
120 uint8_t s = 0;
121 auto b = fs->getSector(t, 0, s);
122 ByteReader br(b);
123 br.skip(2);
124 dosVersion = br.read_8();
125 br.skip(1);
126
127 bam.resize(fs->getLogicalSectorCount());
128 usedBlocks = 0;
129 unsigned block = 0;
130 for (int track = 0; track < globalConfig()->layout().tracks();
131 track++)
132 {
133 uint8_t blocks = br.read_8();
134 uint32_t bitmap = br.read_le24();
135 for (int sector = 0; sector < blocks; sector++)
136 {
137 if (bitmap & (1 << sector))
138 {
139 bam[block + sector] = bitmap & (1 << sector);
140 usedBlocks++;
141 }
142 }
143 block += blocks;
144 }
145
146 /* Read the volume name. */
147
148 br.seek(0x90);
149 auto nameBytes = br.read(16).split(0xa0)[0];
150 volumeName = fromPetscii(nameBytes);
151
152 /* Read the directory. */
153
154 s = 1;
155 while (t != 0xff)
156 {
157 auto b = fs->getSector(t, 0, s);
158
159 for (int i = 0; i < 8; i++)
160 {
161 auto dbuf = b.slice(i * 32, 32);
162 if (dbuf[2] == 0)
163 continue;
164
165 auto de = std::make_shared<CbmfsDirent>(dbuf);
166 dirents.push_back(de);
167 }
168
169 t = b[0] - 1;
170 s = b[1];
171 }
172 }

Callers

nothing calls this directly

Calls 11

fromPetsciiFunction · 0.85
read_8Method · 0.80
getLogicalSectorCountMethod · 0.80
read_le24Method · 0.80
sliceMethod · 0.80
getSectorMethod · 0.45
resizeMethod · 0.45
seekMethod · 0.45
splitMethod · 0.45
readMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected