disk-filltest
disk-filltest copied to clipboard
free disk space improvements
a few improvements to free disk space calculation:
- On Windows, use
GetDiskFreeSpaceEx. - Use
f_frsizeinstead off_bsize, to get the correct block size on macOS (doesn't affect Windows or Linux). - Use
f_bfree&f_bavailto compute free blocks. Previousf_blockswas computing total blocks, rather than free blocks. Choose bfree or bavail based on whether we're privileged or not. This matters on Linux, where part of the filesystem is often reserved for root.
Tested on Windows (x86_64-w64-mingw32-gcc), Cygwin (uses statvfs api), macOS, Linux, but not on MSVC.