worked on FAT stuff and tests

This commit is contained in:
2021-02-21 21:04:11 +01:00
parent 4ac72c678f
commit 2e281f6d26
12 changed files with 758 additions and 396 deletions

View File

@@ -0,0 +1,25 @@
#pragma once
/**
* helper class to determine all clusters whice are used.
* starts at cluster number 2 and then iterates over all subsequent clusters
*/
class UsedSpaceChecker {
public:
/** get the number of used clusters */
static uint32_t getNumUsedClusters(const FS& fs) {
uint32_t numUsed = 0;
for (ClusterNr nr = 2; nr < fs.tmp.entriesPerFAT; ++nr) {
ClusterNr next = fs.getNextCluster(nr);
if (!next.isFree()) {++numUsed;}
}
return numUsed;
}
};