File metadata for CPMFS works.

This commit is contained in:
David Given
2022-08-31 21:58:11 +02:00
parent c375b73db9
commit 4c0971800d
3 changed files with 35 additions and 10 deletions

View File

@@ -82,6 +82,32 @@ public:
{
}
std::map<std::string, std::string> getMetadata()
{
mount();
unsigned usedBlocks = _dirBlocks;
for (int d = 0; d < _config.dir_entries(); d++)
{
auto entry = getEntry(d);
if (!entry)
continue;
for (unsigned block : entry->allocation_map)
{
if (block)
usedBlocks++;
}
}
std::map<std::string, std::string> attributes;
attributes[VOLUME_NAME] = "";
attributes[TOTAL_BLOCKS] = fmt::format("{}", _filesystemBlocks);
attributes[USED_BLOCKS] = fmt::format("{}", usedBlocks);
attributes[BLOCK_SIZE] = fmt::format("{}", _config.block_size());
return attributes;
}
FilesystemStatus check()
{
return FS_OK;