| 147 | } |
| 148 | |
| 149 | std::map<std::string, std::string> getMetadata() override |
| 150 | { |
| 151 | mount(); |
| 152 | |
| 153 | auto block = getLogicalBlock(ROOT_DIRECTORY_BLOCK); |
| 154 | |
| 155 | uint8_t flen = block[4] & 0x0f; |
| 156 | std::string volumename = block.slice(5, flen); |
| 157 | |
| 158 | uint16_t usedBlocks = 0; |
| 159 | for (bool bit : _allocationBitmap) |
| 160 | if (!bit) |
| 161 | usedBlocks++; |
| 162 | |
| 163 | std::map<std::string, std::string> attributes; |
| 164 | attributes[VOLUME_NAME] = volumename; |
| 165 | attributes[TOTAL_BLOCKS] = |
| 166 | std::to_string(block.reader().seek(0x29).read_le16()); |
| 167 | attributes[USED_BLOCKS] = std::to_string(usedBlocks); |
| 168 | attributes[BLOCK_SIZE] = "512"; |
| 169 | return attributes; |
| 170 | } |
| 171 | |
| 172 | std::vector<std::shared_ptr<Dirent>> list(const Path& path) override |
| 173 | { |