fix free space calculation on devices with reserved blocks

This commit is contained in:
Martinez 2015-12-16 00:13:33 +01:00
parent 9e86abf745
commit afd9900397

View file

@ -284,7 +284,6 @@ void get_available_space(std::vector<Space> &space) {
std::vector<std::string> mounts;
struct statfs stats;
std::string fullname, name, mountpoint;
uint64_t free_blocks, total_blocks;
int ptr, len;
size_t str_pos;
bool OK;
@ -304,7 +303,6 @@ void get_available_space(std::vector<Space> &space) {
continue;
}
mountpoint = get_column(mounts[i], 1);
// handle spaces in mount point names - /proc/mounts uses a 4-byte '\\040' sequence to signify a space
@ -349,11 +347,9 @@ void get_available_space(std::vector<Space> &space) {
// figure out free and total space
statfs(mountpoint.c_str(), &stats);
free_blocks = stats.f_bfree;
total_blocks = stats.f_blocks;
// pass it on
space.push_back(Space(name.c_str(), free_blocks * stats.f_bsize, total_blocks * stats.f_bsize));
space.push_back(Space(name.c_str(), stats.f_bavail * stats.f_bsize, stats.f_blocks * stats.f_bsize));
}
}
}