Merge pull request #1575 from shirou/feat/fix_disk_unix_uint64cast

[linux][disk]: fix Rdev cast
pull/1558/head
shirou 1 year ago committed by GitHub
commit 442e0ad6f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,7 @@ build_test: ## test only buildable
GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN) GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN) GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN) GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=linux GOARCH=mips go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN) GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN) GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN) GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)

@ -507,8 +507,8 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
if err := unix.Stat(name, &stat); err != nil { if err := unix.Stat(name, &stat); err != nil {
return "", err return "", err
} }
major := unix.Major(stat.Rdev) major := unix.Major(uint64(stat.Rdev))
minor := unix.Minor(stat.Rdev) minor := unix.Minor(uint64(stat.Rdev))
sserial, _ := udevData(ctx, major, minor, "E:ID_SERIAL") sserial, _ := udevData(ctx, major, minor, "E:ID_SERIAL")
if sserial != "" { if sserial != "" {
@ -541,8 +541,8 @@ func LabelWithContext(ctx context.Context, name string) (string, error) {
if err := unix.Stat(common.HostDevWithContext(ctx, name), &stat); err != nil { if err := unix.Stat(common.HostDevWithContext(ctx, name), &stat); err != nil {
return "", err return "", err
} }
major := unix.Major(stat.Rdev) major := unix.Major(uint64(stat.Rdev))
minor := unix.Minor(stat.Rdev) minor := unix.Minor(uint64(stat.Rdev))
label, err := udevData(ctx, major, minor, "E:ID_FS_LABEL") label, err := udevData(ctx, major, minor, "E:ID_FS_LABEL")
if err != nil { if err != nil {

Loading…
Cancel
Save