vfs,mount,cmount: use About to return the correct disk total/used/free

Disks total, used, free now shows correctly for mount and cmount (eg
`df` for Unix or in the Windows explorer).
This commit is contained in:
Nick Craig-Wood
2018-04-17 23:19:34 +01:00
parent ef3bcec76c
commit 2b855751fc
4 changed files with 106 additions and 5 deletions

View File

@@ -62,6 +62,16 @@ func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.Sta
resp.Bsize = blockSize // Block size
resp.Namelen = 255 // Maximum file name length?
resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
total, used, free := f.VFS.Statfs()
if total >= 0 {
resp.Blocks = uint64(total) / blockSize
}
if used >= 0 {
resp.Bfree = resp.Blocks - uint64(used)/blockSize
}
if free >= 0 {
resp.Bavail = uint64(free) / blockSize
}
return nil
}