Skip to content

Commit

Permalink
chore: make supportedArchs key->value mapping explicit.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Oct 13, 2023
1 parent 293c6a8 commit 797529c
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ func initOpts() {
}
}

// Naming should be consistent with the one used by
// https://github.com/hrw/syscalls-table/tree/master/tables
var supportedArchs = []string{
"x86_64",
"arm64",
"s390x",
"riscv64",
// key should be consistent with the one used by https://github.com/hrw/syscalls-table/tree/master/tables.
// Value should be the suffix used by libs/driver/syscall_compat_* headers.
var supportedArchs = map[string]string{
"x86_64": "x86_64",
"arm64": "aarch64",
"s390x": "s390x",
"riscv64": "riscv64",
}

func main() {
Expand All @@ -142,9 +142,9 @@ func main() {

log.Debugf("Loading system syscall map for supported archs: %v\n", supportedArchs)
linuxMap := make(map[string]SyscallMap)
for _, arch := range supportedArchs {
// We download latest maps from https://github.com/hrw/syscalls-table/tree/master/tables
linuxMap[arch] = loadSystemMap(arch)
for tableArch, libsArch := range supportedArchs {
// We download latest maps from https://github.com/hrw/syscalls-table/tree/master/tables
linuxMap[libsArch] = loadSystemMap(tableArch)
}

log.Debugln("Loading libs syscall map")
Expand Down Expand Up @@ -492,10 +492,6 @@ func bumpCompats(systemMap map[string]SyscallMap) {
// Step 1: sort map
values := systemMap[key].SortValues()

// We use "aarch64" in libs
if key == "arm64" {
key = "aarch64"
}
fp := *libsRepoRoot + "/driver/syscall_compat_" + key + ".h"

// Step 2: dump the new content to local (temp) file
Expand Down

0 comments on commit 797529c

Please sign in to comment.