mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:46:24 +08:00
vfs: make df
output more consistent on a rclone mount.
When 2 values are known among vfs:{free,used,total}, compute the 3rd
This commit is contained in:
parent
2b268f9724
commit
b1b5e09081
|
@ -510,6 +510,15 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
|
|||
if u.Used != nil {
|
||||
used = *u.Used
|
||||
}
|
||||
if total < 0 && free >= 0 && used >= 0 {
|
||||
total = free + used
|
||||
}
|
||||
if free < 0 && total >= 0 && used >= 0 {
|
||||
free = total - used
|
||||
}
|
||||
if used < 0 && total >= 0 && free >= 0 {
|
||||
used = total - free
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user