| 104 | } |
| 105 | |
| 106 | void ListChunkFiles(const std::string& base, const std::string& prefix, |
| 107 | std::unordered_map<uint64_t, std::string>* chunks) { |
| 108 | DIR* dir = opendir(base.c_str()); |
| 109 | PCHECK(dir != nullptr); |
| 110 | struct dirent* ent = nullptr; |
| 111 | while ((ent = readdir(dir)) != nullptr) { |
| 112 | if (strlen(ent->d_name) != prefix.size() + kChunkNameSuffixLength) { continue; } |
| 113 | if (strncmp(ent->d_name, prefix.c_str(), prefix.size()) != 0) { continue; } |
| 114 | const uint64_t chunk_id = GetChunkId(ent->d_name + prefix.size()); |
| 115 | CHECK(chunks->emplace(chunk_id, PosixFile::JoinPath(base, ent->d_name)).second); |
| 116 | } |
| 117 | PCHECK(closedir(dir) == 0); |
| 118 | } |
| 119 | |
| 120 | uint32_t GetLogicalBlockSize(uint32_t physical_block_size, uint32_t value_size) { |
| 121 | return physical_block_size >= value_size ? physical_block_size |
no test coverage detected