mirror of https://github.com/rclone/rclone.git
mount2: fixed statfs
Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
This commit is contained in:
parent
a7e6806f26
commit
f7f5e87632
|
@ -26,13 +26,13 @@ func init() {
|
||||||
// man mount.fuse for more info and note the -o flag for other options
|
// man mount.fuse for more info and note the -o flag for other options
|
||||||
func mountOptions(fsys *FS, f fs.Fs, opt *mountlib.Options) (mountOpts *fuse.MountOptions) {
|
func mountOptions(fsys *FS, f fs.Fs, opt *mountlib.Options) (mountOpts *fuse.MountOptions) {
|
||||||
mountOpts = &fuse.MountOptions{
|
mountOpts = &fuse.MountOptions{
|
||||||
AllowOther: fsys.opt.AllowOther,
|
AllowOther: fsys.opt.AllowOther,
|
||||||
FsName: opt.DeviceName,
|
FsName: opt.DeviceName,
|
||||||
Name: "rclone",
|
Name: "rclone",
|
||||||
DisableXAttrs: true,
|
DisableXAttrs: true,
|
||||||
Debug: fsys.opt.DebugFUSE,
|
Debug: fsys.opt.DebugFUSE,
|
||||||
MaxReadAhead: int(fsys.opt.MaxReadAhead),
|
MaxReadAhead: int(fsys.opt.MaxReadAhead),
|
||||||
MaxWrite: 1024 * 1024, // Linux v4.20+ caps requests at 1 MiB
|
MaxWrite: 1024 * 1024, // Linux v4.20+ caps requests at 1 MiB
|
||||||
DisableReadDirPlus: true,
|
DisableReadDirPlus: true,
|
||||||
|
|
||||||
// RememberInodes: true,
|
// RememberInodes: true,
|
||||||
|
@ -218,8 +218,8 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (<-chan error
|
||||||
MountOptions: *mountOpts,
|
MountOptions: *mountOpts,
|
||||||
EntryTimeout: &opt.AttrTimeout,
|
EntryTimeout: &opt.AttrTimeout,
|
||||||
AttrTimeout: &opt.AttrTimeout,
|
AttrTimeout: &opt.AttrTimeout,
|
||||||
// UID
|
GID: VFS.Opt.GID,
|
||||||
// GID
|
UID: VFS.Opt.UID,
|
||||||
}
|
}
|
||||||
|
|
||||||
root, err := fsys.Root()
|
root, err := fsys.Root()
|
||||||
|
|
|
@ -85,17 +85,16 @@ func (n *Node) lookupVfsNodeInDir(leaf string) (vfsNode vfs.Node, errno syscall.
|
||||||
// will not work.
|
// will not work.
|
||||||
func (n *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
|
func (n *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
|
||||||
defer log.Trace(n, "")("out=%+v", &out)
|
defer log.Trace(n, "")("out=%+v", &out)
|
||||||
out = new(fuse.StatfsOut)
|
|
||||||
const blockSize = 4096
|
const blockSize = 4096
|
||||||
const fsBlocks = (1 << 50) / blockSize
|
total, _, free := n.fsys.VFS.Statfs()
|
||||||
out.Blocks = fsBlocks // Total data blocks in file system.
|
out.Blocks = uint64(total) / blockSize // Total data blocks in file system.
|
||||||
out.Bfree = fsBlocks // Free blocks in file system.
|
out.Bfree = uint64(free) / blockSize // Free blocks in file system.
|
||||||
out.Bavail = fsBlocks // Free blocks in file system if you're not root.
|
out.Bavail = out.Bfree // Free blocks in file system if you're not root.
|
||||||
out.Files = 1e9 // Total files in file system.
|
out.Files = 1e9 // Total files in file system.
|
||||||
out.Ffree = 1e9 // Free files in file system.
|
out.Ffree = 1e9 // Free files in file system.
|
||||||
out.Bsize = blockSize // Block size
|
out.Bsize = blockSize // Block size
|
||||||
out.NameLen = 255 // Maximum file name length?
|
out.NameLen = 255 // Maximum file name length?
|
||||||
out.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
|
out.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
|
||||||
mountlib.ClipBlocks(&out.Blocks)
|
mountlib.ClipBlocks(&out.Blocks)
|
||||||
mountlib.ClipBlocks(&out.Bfree)
|
mountlib.ClipBlocks(&out.Bfree)
|
||||||
mountlib.ClipBlocks(&out.Bavail)
|
mountlib.ClipBlocks(&out.Bavail)
|
||||||
|
|
Loading…
Reference in New Issue