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

Function checkConsistency

tools/brother120tool.cc:291–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void checkConsistency()
292{
293 /* Verify that we more-or-less understand the format by fscking the disk. */
294
295 std::vector<bool> bitmap(640);
296 for (const auto& i : directory)
297 {
298 const Dirent& dirent = *i.second;
299 if (!isValidFile(dirent))
300 continue;
301
302 int count = 0;
303 uint16_t sector = dirent.startSector;
304 while ((sector != 0xffff) && (sector != 0))
305 {
306 if (bitmap[sector])
307 std::cout << fmt::format(
308 "warning: sector {} appears to be multiply used\n", sector);
309 bitmap[sector] = true;
310 sector = allocationTable[sector];
311 count++;
312 }
313
314 if (count != dirent.sectorCount)
315 std::cout << fmt::format(
316 "Warning: file '{}' claims to be {} sectors long but its chain "
317 "is {}\n",
318 dirent.filename,
319 dirent.sectorCount,
320 count);
321 }
322}
323
324void listDirectory()
325{

Callers 2

doCreateFunction · 0.85
doExtractFunction · 0.85

Calls 1

isValidFileFunction · 0.85

Tested by

no test coverage detected