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

Method getMetadata

lib/vfs/prodos.cc:149–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

to_stringFunction · 0.85
sliceMethod · 0.80
read_le16Method · 0.80
readerMethod · 0.80
seekMethod · 0.45

Tested by

no test coverage detected