fix(fs): Use f_frsize in filesystem calculations
This is consistent with the documentation of std::experimental::filesystem, so I think it is the more "correct" thing to be doing here.
This commit is contained in:
parent
b12aec1a4c
commit
a682d2af91
@ -96,10 +96,11 @@ namespace modules {
|
|||||||
mount->type = details->at(MOUNTINFO_TYPE);
|
mount->type = details->at(MOUNTINFO_TYPE);
|
||||||
mount->fsname = details->at(MOUNTINFO_FSNAME);
|
mount->fsname = details->at(MOUNTINFO_FSNAME);
|
||||||
|
|
||||||
mount->bytes_total = buffer.f_bsize * buffer.f_blocks;
|
// see: http://en.cppreference.com/w/cpp/filesystem/space
|
||||||
|
mount->bytes_total = buffer.f_frsize * buffer.f_blocks;
|
||||||
mount->bytes_free = buffer.f_bsize * buffer.f_bfree;
|
mount->bytes_free = buffer.f_bsize * buffer.f_bfree;
|
||||||
mount->bytes_used = mount->bytes_total - mount->bytes_free;
|
mount->bytes_used = mount->bytes_total - mount->bytes_free;
|
||||||
mount->bytes_avail = buffer.f_bsize * buffer.f_bavail;
|
mount->bytes_avail = buffer.f_frsize * buffer.f_bavail;
|
||||||
|
|
||||||
mount->percentage_free = math_util::percentage<double>(mount->bytes_avail, mount->bytes_used + mount->bytes_avail);
|
mount->percentage_free = math_util::percentage<double>(mount->bytes_avail, mount->bytes_used + mount->bytes_avail);
|
||||||
mount->percentage_used = math_util::percentage<double>(mount->bytes_used, mount->bytes_used + mount->bytes_avail);
|
mount->percentage_used = math_util::percentage<double>(mount->bytes_used, mount->bytes_used + mount->bytes_avail);
|
||||||
|
Loading…
Reference in New Issue
Block a user