Fix cross-platform compilation for all target platforms
- Fixed type mismatch in disk space calculation (int64 casting) - Created platform-specific disk space implementations: * diskspace_unix.go (Linux, macOS, FreeBSD) * diskspace_windows.go (Windows) * diskspace_bsd.go (OpenBSD) * diskspace_netbsd.go (NetBSD fallback) - All 10 platforms now compile successfully: ✅ Linux (amd64, arm64, armv7) ✅ macOS (Intel, Apple Silicon) ✅ Windows (amd64, arm64) ✅ FreeBSD, OpenBSD, NetBSD
This commit is contained in:
15
internal/restore/diskspace_bsd.go
Normal file
15
internal/restore/diskspace_bsd.go
Normal file
@ -0,0 +1,15 @@
|
||||
// +build openbsd
|
||||
|
||||
package restore
|
||||
|
||||
import "syscall"
|
||||
|
||||
// getDiskSpace returns available disk space in bytes (OpenBSD)
|
||||
func getDiskSpace(path string) (int64, error) {
|
||||
var statfs syscall.Statfs_t
|
||||
if err := syscall.Statfs(path, &statfs); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// OpenBSD uses F_bavail and F_bsize
|
||||
return int64(statfs.F_bavail) * int64(statfs.F_bsize), nil
|
||||
}
|
||||
Reference in New Issue
Block a user