MCPcopy Index your code
hub / github.com/koding/kite / diskStats

Function diskStats

systeminfo/systeminfo_windows.go:17–39  ·  view source on GitHub ↗

diskStats returns information about the amount of space that is available on a current disk volume for the user who calls this function.

()

Source from the content-addressed store, hash-verified

15// diskStats returns information about the amount of space that is available on
16// a current disk volume for the user who calls this function.
17func diskStats() (*disk, error) {
18 var (
19 freeBytes uint64 = 0
20 totalBytes uint64 = 0
21 )
22
23 // windows sets return value to 0 when function fails.
24 ret, _, err := procGetDiskFreeSpaceExW.Call(
25 0,
26 uintptr(unsafe.Pointer(&freeBytes)),
27 uintptr(unsafe.Pointer(&totalBytes)),
28 0,
29 )
30 if ret == 0 {
31 return nil, err
32 }
33
34 // diskStats functions from other platforms return disk usage in kiB.
35 return &disk{
36 Usage: (totalBytes - freeBytes) / 1024,
37 Total: totalBytes / 1024,
38 }, nil
39}
40
41// memoryStatus retrieves information about the system's current usage of
42// physical memory.

Callers

nothing calls this directly

Calls 1

CallMethod · 0.65

Tested by

no test coverage detected