//go:build windows package volsnap import ( "fmt" "golang.org/x/sys/windows" ) // freeDiskBytes returns the bytes available to the caller on the volume backing // path (used by the restore disk pre-check, C5). Windows is the dev platform; // production runs on Linux (see disk_unix.go). func freeDiskBytes(path string) (uint64, error) { p, err := windows.UTF16PtrFromString(path) if err != nil { return 0, fmt.Errorf("encode path %s: %w", path, err) } var freeAvail, total, totalFree uint64 if err := windows.GetDiskFreeSpaceEx(p, &freeAvail, &total, &totalFree); err != nil { return 0, fmt.Errorf("GetDiskFreeSpaceEx %s: %w", path, err) } return freeAvail, nil }