1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 10:33:34 +00:00

mount,cmount: clip the number of blocks to 2^32-1 on macOS

OSX FUSE only supports 32 bit number of blocks which means that block
counts have been wrapping.  This causes f_bavail to be 0 which in turn
causes problems with programs like borg backup.

Fixes #2356
This commit is contained in:
Nick Craig-Wood
2018-06-26 09:26:34 +01:00
parent 4eefd05dcf
commit 174ca22936
3 changed files with 28 additions and 5 deletions

View File

@@ -293,3 +293,22 @@ be copied to the vfs cache before opening with --vfs-cache-mode full.
return commandDefintion
}
// ClipBlocks clips the blocks pointed to to the OS max
func ClipBlocks(b *uint64) {
var max uint64
switch runtime.GOOS {
case "windows":
max = (1 << 43) - 1
case "darwin":
// OSX FUSE only supports 32 bit number of blocks
// https://github.com/osxfuse/osxfuse/issues/396
max = (1 << 32) - 1
default:
// no clipping
return
}
if *b > max {
*b = max
}
}