summaryrefslogtreecommitdiff
path: root/vendor/github.com/seccomp/containers-golang/conversion.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-25 13:31:48 -0400
committerGitHub <noreply@github.com>2020-08-25 13:31:48 -0400
commit6a069446fbb23d7fd16ce14305fda1a7b2b8f925 (patch)
tree9e7e9b6727cf9705b3b34800208084f77d436250 /vendor/github.com/seccomp/containers-golang/conversion.go
parent8fdc1169546421a239644159bbaf38db407f2b0f (diff)
parent52b14a2218952b41633909d282e5bc135ef651bb (diff)
downloadpodman-6a069446fbb23d7fd16ce14305fda1a7b2b8f925.tar.gz
podman-6a069446fbb23d7fd16ce14305fda1a7b2b8f925.tar.bz2
podman-6a069446fbb23d7fd16ce14305fda1a7b2b8f925.zip
Merge pull request #7335 from rhatdan/VENDOR
Update vendor of buildah to latest code
Diffstat (limited to 'vendor/github.com/seccomp/containers-golang/conversion.go')
-rw-r--r--vendor/github.com/seccomp/containers-golang/conversion.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/seccomp/containers-golang/conversion.go b/vendor/github.com/seccomp/containers-golang/conversion.go
new file mode 100644
index 000000000..05564487b
--- /dev/null
+++ b/vendor/github.com/seccomp/containers-golang/conversion.go
@@ -0,0 +1,32 @@
+package seccomp // import "github.com/seccomp/containers-golang"
+
+import "fmt"
+
+var goArchToSeccompArchMap = map[string]Arch{
+ "386": ArchX86,
+ "amd64": ArchX86_64,
+ "amd64p32": ArchX32,
+ "arm": ArchARM,
+ "arm64": ArchAARCH64,
+ "mips": ArchMIPS,
+ "mips64": ArchMIPS64,
+ "mips64le": ArchMIPSEL64,
+ "mips64p32": ArchMIPS64N32,
+ "mips64p32le": ArchMIPSEL64N32,
+ "mipsle": ArchMIPSEL,
+ "ppc": ArchPPC,
+ "ppc64": ArchPPC64,
+ "ppc64le": ArchPPC64LE,
+ "s390": ArchS390,
+ "s390x": ArchS390X,
+}
+
+// GoArchToSeccompArch converts a runtime.GOARCH to a seccomp `Arch`. The
+// function returns an error if the architecture conversion is not supported.
+func GoArchToSeccompArch(goArch string) (Arch, error) {
+ arch, ok := goArchToSeccompArchMap[goArch]
+ if !ok {
+ return "", fmt.Errorf("unsupported go arch provided: %s", goArch)
+ }
+ return arch, nil
+}