[VFS] Fix StfsContainerDevice::total_allocation_units()
This commit is contained in:
parent
a4aa4d8edc
commit
db515ac4c1
|
@ -107,6 +107,8 @@ StfsContainerDevice::Error StfsContainerDevice::MapFiles() {
|
|||
return header_result;
|
||||
}
|
||||
|
||||
mmap_total_size_ += header_map->size();
|
||||
|
||||
// If the STFS package is a single file, the header is self contained and
|
||||
// we don't need to map any extra files.
|
||||
// NOTE: data_file_count is 0 for STFS and 1 for SVOD
|
||||
|
@ -145,8 +147,10 @@ StfsContainerDevice::Error StfsContainerDevice::MapFiles() {
|
|||
if (!data) {
|
||||
XELOGI("Failed to map SVOD file %ls.", path.c_str());
|
||||
mmap_.clear();
|
||||
mmap_total_size_ = 0;
|
||||
return Error::kErrorReadError;
|
||||
}
|
||||
mmap_total_size_ += data->size();
|
||||
mmap_.emplace(std::make_pair(i, std::move(data)));
|
||||
}
|
||||
XELOGI("SVOD successfully mapped %d files.", fragment_files.size());
|
||||
|
|
|
@ -437,7 +437,7 @@ class StfsContainerDevice : public Device {
|
|||
Entry* ResolvePath(const std::string& path) override;
|
||||
|
||||
uint32_t total_allocation_units() const override {
|
||||
return uint32_t(mmap_total_size_ / sectors_per_allocation_unit() /
|
||||
return uint32_t(data_size() / sectors_per_allocation_unit() /
|
||||
bytes_per_sector());
|
||||
}
|
||||
uint32_t available_allocation_units() const override { return 0; }
|
||||
|
@ -496,7 +496,9 @@ class StfsContainerDevice : public Device {
|
|||
|
||||
std::wstring local_path_;
|
||||
std::map<size_t, std::unique_ptr<MappedMemory>> mmap_;
|
||||
size_t mmap_total_size_;
|
||||
size_t mmap_total_size_ = 0;
|
||||
|
||||
size_t data_size() const { return mmap_total_size_ - sizeof(StfsHeader); }
|
||||
|
||||
uint32_t blocks_per_hash_table_ = 1;
|
||||
uint32_t block_step_[2] = {0xAB, 0x718F};
|
||||
|
|
Loading…
Reference in New Issue