Commit 161a1648 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

fuse: fix free space reporting on Darwin

We usually were off by a factor of 256.
Fixes https://github.com/rfjakob/gocryptfs/issues/375
parent 0074c951
......@@ -153,4 +153,14 @@ func (s *StatfsOut) FromStatfsT(statfs *syscall.Statfs_t) {
s.Ffree = statfs.Ffree
s.Bsize = uint32(statfs.Iosize) // Iosize translates to Bsize: the optimal transfer size.
s.Frsize = s.Bsize // Bsize translates to Frsize: the minimum transfer size.
// The block counts are in units of statfs.Bsize.
// If s.Bsize != statfs.Bsize, we have to recalculate the block counts
// accordingly (s.Bsize is usually 256*statfs.Bsize).
if s.Bsize > statfs.Bsize {
adj := uint64(s.Bsize / statfs.Bsize)
s.Blocks /= adj
s.Bfree /= adj
s.Bavail /= adj
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment