From 3b09ae9074de9c4a772a673f8be7b0c14e975f43 Mon Sep 17 00:00:00 2001 From: greatroar <@> Date: Sun, 24 May 2020 19:32:19 +0200 Subject: [PATCH] AIX port --- ...reground_solaris.go => foreground_sysv.go} | 2 + internal/backend/foreground_unix.go | 3 +- internal/restic/node_aix.go | 39 +++++++++++++++++++ internal/ui/progress/signals_sysv.go | 2 +- run_integration_tests.go | 1 + 5 files changed, 44 insertions(+), 3 deletions(-) rename internal/backend/{foreground_solaris.go => foreground_sysv.go} (95%) create mode 100644 internal/restic/node_aix.go diff --git a/internal/backend/foreground_solaris.go b/internal/backend/foreground_sysv.go similarity index 95% rename from internal/backend/foreground_solaris.go rename to internal/backend/foreground_sysv.go index 8b963db21..f60e4242e 100644 --- a/internal/backend/foreground_solaris.go +++ b/internal/backend/foreground_sysv.go @@ -1,3 +1,5 @@ +// +build aix solaris + package backend import ( diff --git a/internal/backend/foreground_unix.go b/internal/backend/foreground_unix.go index fe5b95ffa..eb0002dad 100644 --- a/internal/backend/foreground_unix.go +++ b/internal/backend/foreground_unix.go @@ -1,5 +1,4 @@ -// +build !solaris -// +build !windows +// +build !aix,!solaris,!windows package backend diff --git a/internal/restic/node_aix.go b/internal/restic/node_aix.go new file mode 100644 index 000000000..1e625296b --- /dev/null +++ b/internal/restic/node_aix.go @@ -0,0 +1,39 @@ +// +build aix + +package restic + +import "syscall" + +func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { + return nil +} + +func (node Node) device() int { + return int(node.Device) +} + +// AIX has a funny timespec type in syscall, with 32-bit nanoseconds. +// golang.org/x/sys/unix handles this cleanly, but we're stuck with syscall +// because os.Stat returns a syscall type in its os.FileInfo.Sys(). +func toTimespec(t syscall.StTimespec_t) syscall.Timespec { + return syscall.Timespec{Sec: t.Sec, Nsec: int64(t.Nsec)} +} + +func (s statT) atim() syscall.Timespec { return toTimespec(s.Atim) } +func (s statT) mtim() syscall.Timespec { return toTimespec(s.Mtim) } +func (s statT) ctim() syscall.Timespec { return toTimespec(s.Ctim) } + +// Getxattr is a no-op on AIX. +func Getxattr(path, name string) ([]byte, error) { + return nil, nil +} + +// Listxattr is a no-op on AIX. +func Listxattr(path string) ([]string, error) { + return nil, nil +} + +// Setxattr is a no-op on AIX. +func Setxattr(path, name string, data []byte) error { + return nil +} diff --git a/internal/ui/progress/signals_sysv.go b/internal/ui/progress/signals_sysv.go index 04b8acaf6..933cddde6 100644 --- a/internal/ui/progress/signals_sysv.go +++ b/internal/ui/progress/signals_sysv.go @@ -1,4 +1,4 @@ -// +build linux solaris +// +build aix linux solaris package progress diff --git a/run_integration_tests.go b/run_integration_tests.go index 14c3bb471..5b1902b15 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -231,6 +231,7 @@ func (env *TravisEnvironment) Prepare() error { "netbsd/386", "netbsd/amd64", "linux/arm", "freebsd/arm", "linux/ppc64le", "solaris/amd64", + "aix/ppc64", } } else { env.goxOSArch = []string{runtime.GOOS + "/" + runtime.GOARCH}