1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: add --vfs-disk-space-total-size option to manually set the total disk space

Now you can specify --vfs-disk-space-total-size to set the total disk
space (default to -1)

fixes #3270
This commit is contained in:
Claudio Maradonna
2022-07-05 18:29:14 +02:00
committed by Nick Craig-Wood
parent 2e54b56a01
commit 62bcc84f6f
4 changed files with 63 additions and 47 deletions

View File

@@ -604,6 +604,7 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
return
}
}
if u := vfs.usage; u != nil {
if u.Total != nil {
total = *u.Total
@@ -615,6 +616,11 @@ func (vfs *VFS) Statfs() (total, used, free int64) {
used = *u.Used
}
}
if int64(vfs.Opt.DiskSpaceTotalSize) >= 0 {
total = int64(vfs.Opt.DiskSpaceTotalSize)
}
total, used, free = fillInMissingSizes(total, used, free, unknownFreeBytes)
return
}