MCPcopy
hub / github.com/rclone/rclone / New

Function New

lib/diskusage/diskusage_openbsd.go:12–27  ·  view source on GitHub ↗

New returns the disk status for dir. May return Unsupported error if it doesn't work on this platform.

(dir string)

Source from the content-addressed store, hash-verified

10//
11// May return Unsupported error if it doesn't work on this platform.
12func New(dir string) (info Info, err error) {
13 var statfs unix.Statfs_t
14 err = unix.Statfs(dir, &statfs)
15 if err != nil {
16 return info, err
17 }
18 // Note that these can be different sizes on different OSes so
19 // we upcast them all to uint64
20 //nolint:unconvert
21 info.Free = uint64(statfs.F_bfree) * uint64(statfs.F_bsize)
22 //nolint:unconvert
23 info.Available = uint64(statfs.F_bavail) * uint64(statfs.F_bsize)
24 //nolint:unconvert
25 info.Total = uint64(statfs.F_blocks) * uint64(statfs.F_bsize)
26 return info, nil
27}

Callers

nothing calls this directly

Calls 1

StatfsMethod · 0.45

Tested by

no test coverage detected