26 lines
480 B
C++
26 lines
480 B
C++
#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;
|
|
|
|
}
|
|
|
|
};
|