Use unix.Major/unix.Minor instead of custom implementation

This commit is contained in:
Soulou 2019-03-15 14:36:56 +01:00
parent 92b01ab4f9
commit 2118fbe78a
No known key found for this signature in database
GPG Key ID: 9FC511C0EC98B9DA
1 changed files with 2 additions and 2 deletions

View File

@ -35,8 +35,8 @@ func (s *DiskIO) diskInfo(devName string) (map[string]string, error) {
return ic.values, nil
}
major := stat.Rdev >> 8 & 0xff
minor := (stat.Rdev & 0xff) | (stat.Rdev>>12)&^0xff
major := unix.Major(stat.Rdev)
minor := unix.Minor(stat.Rdev)
udevDataPath := fmt.Sprintf("%s/b%d:%d", udevPath, major, minor)
di := map[string]string{}