mount2: fixed statfs

Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
This commit is contained in:
Anagh Kumar Baranwal 2023-04-26 15:40:04 +05:30 committed by Nick Craig-Wood
parent a7e6806f26
commit f7f5e87632
2 changed files with 18 additions and 19 deletions

View file

@ -218,8 +218,8 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (<-chan error
MountOptions: *mountOpts,
EntryTimeout: &opt.AttrTimeout,
AttrTimeout: &opt.AttrTimeout,
// UID
// GID
GID: VFS.Opt.GID,
UID: VFS.Opt.UID,
}
root, err := fsys.Root()

View file

@ -85,12 +85,11 @@ func (n *Node) lookupVfsNodeInDir(leaf string) (vfsNode vfs.Node, errno syscall.
// will not work.
func (n *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
defer log.Trace(n, "")("out=%+v", &out)
out = new(fuse.StatfsOut)
const blockSize = 4096
const fsBlocks = (1 << 50) / blockSize
out.Blocks = fsBlocks // Total data blocks in file system.
out.Bfree = fsBlocks // Free blocks in file system.
out.Bavail = fsBlocks // Free blocks in file system if you're not root.
total, _, free := n.fsys.VFS.Statfs()
out.Blocks = uint64(total) / blockSize // Total data blocks in file system.
out.Bfree = uint64(free) / blockSize // Free blocks in file system.
out.Bavail = out.Bfree // Free blocks in file system if you're not root.
out.Files = 1e9 // Total files in file system.
out.Ffree = 1e9 // Free files in file system.
out.Bsize = blockSize // Block size