fix: building reorder-disks under darwin (#18053)

Also build debugging tools only in tests or with a specific target
This commit is contained in:
Anis Eleuch
2023-09-19 03:19:26 -07:00
committed by GitHub
parent b73699fad8
commit c5279ec630
2 changed files with 9 additions and 6 deletions

View File

@@ -99,10 +99,11 @@ func getMajorMinor(path string) (string, error) {
return "", fmt.Errorf("unable to stat `%s`: %w", path, err)
}
major := (stat.Dev & 0x00000000000fff00) >> 8
major |= (stat.Dev & 0xfffff00000000000) >> 32
minor := (stat.Dev & 0x00000000000000ff) >> 0
minor |= (stat.Dev & 0x00000ffffff00000) >> 12
devID := uint64(stat.Dev)
major := (devID & 0x00000000000fff00) >> 8
major |= (devID & 0xfffff00000000000) >> 32
minor := (devID & 0x00000000000000ff) >> 0
minor |= (devID & 0x00000ffffff00000) >> 12
return fmt.Sprintf("%d:%d", major, minor), nil
}