cast Dev and Rdev of Stat_t to uint64 for mips
Signed-off-by: Dominic <yindongchao@inspur.com> Signed-off-by: Dominic Yin <yindongchao@inspur.com>
This commit is contained in:
parent
928381b221
commit
5f0231bca1
5 changed files with 16 additions and 9 deletions
|
@ -192,8 +192,9 @@ func getBlkioWeightDevices(config containertypes.Resources) ([]specs.LinuxWeight
|
||||||
}
|
}
|
||||||
weight := weightDevice.Weight
|
weight := weightDevice.Weight
|
||||||
d := specs.LinuxWeightDevice{Weight: &weight}
|
d := specs.LinuxWeightDevice{Weight: &weight}
|
||||||
d.Major = int64(unix.Major(stat.Rdev))
|
// The type is 32bit on mips.
|
||||||
d.Minor = int64(unix.Minor(stat.Rdev))
|
d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert
|
||||||
|
d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert
|
||||||
blkioWeightDevices = append(blkioWeightDevices, d)
|
blkioWeightDevices = append(blkioWeightDevices, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +264,9 @@ func getBlkioThrottleDevices(devs []*blkiodev.ThrottleDevice) ([]specs.LinuxThro
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
d := specs.LinuxThrottleDevice{Rate: d.Rate}
|
d := specs.LinuxThrottleDevice{Rate: d.Rate}
|
||||||
d.Major = int64(unix.Major(stat.Rdev))
|
// the type is 32bit on mips
|
||||||
d.Minor = int64(unix.Minor(stat.Rdev))
|
d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert
|
||||||
|
d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert
|
||||||
throttleDevices = append(throttleDevices, d)
|
throttleDevices = append(throttleDevices, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,8 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
|
||||||
|
|
||||||
switch mode := f.Mode(); {
|
switch mode := f.Mode(); {
|
||||||
case mode.IsRegular():
|
case mode.IsRegular():
|
||||||
id := fileID{dev: stat.Dev, ino: stat.Ino}
|
//the type is 32bit on mips
|
||||||
|
id := fileID{dev: uint64(stat.Dev), ino: stat.Ino} // nolint: unconvert
|
||||||
if copyMode == Hardlink {
|
if copyMode == Hardlink {
|
||||||
isHardlink = true
|
isHardlink = true
|
||||||
if err2 := os.Link(srcPath, dstPath); err2 != nil {
|
if err2 := os.Link(srcPath, dstPath); err2 != nil {
|
||||||
|
|
|
@ -1527,7 +1527,8 @@ func getDeviceMajorMinor(file *os.File) (uint64, uint64, error) {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
dev := stat.Rdev
|
// the type is 32bit on mips
|
||||||
|
dev := uint64(stat.Rdev) // nolint: unconvert
|
||||||
majorNum := major(dev)
|
majorNum := major(dev)
|
||||||
minorNum := minor(dev)
|
minorNum := minor(dev)
|
||||||
|
|
||||||
|
@ -1738,7 +1739,8 @@ func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) {
|
||||||
// - Managed by docker
|
// - Managed by docker
|
||||||
// - The target of this device is at major <maj> and minor <min>
|
// - The target of this device is at major <maj> and minor <min>
|
||||||
// - If <inode> is defined, use that file inside the device as a loopback image. Otherwise use the device itself.
|
// - If <inode> is defined, use that file inside the device as a loopback image. Otherwise use the device itself.
|
||||||
devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(st.Dev), minor(st.Dev), st.Ino)
|
// The type Dev in Stat_t is 32bit on mips.
|
||||||
|
devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(uint64(st.Dev)), minor(uint64(st.Dev)), st.Ino) // nolint: unconvert
|
||||||
logger.Debugf("Generated prefix: %s", devices.devicePrefix)
|
logger.Debugf("Generated prefix: %s", devices.devicePrefix)
|
||||||
|
|
||||||
// Check for the existence of the thin-pool device
|
// Check for the existence of the thin-pool device
|
||||||
|
|
|
@ -37,7 +37,8 @@ func FindLoopDeviceFor(file *os.File) *os.File {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
targetInode := stat.Ino
|
targetInode := stat.Ino
|
||||||
targetDevice := stat.Dev
|
// the type is 32bit on mips
|
||||||
|
targetDevice := uint64(stat.Dev) // nolint: unconvert
|
||||||
|
|
||||||
for i := 0; true; i++ {
|
for i := 0; true; i++ {
|
||||||
path := fmt.Sprintf("/dev/loop%d", i)
|
path := fmt.Sprintf("/dev/loop%d", i)
|
||||||
|
|
|
@ -8,7 +8,8 @@ func fromStatT(s *syscall.Stat_t) (*StatT, error) {
|
||||||
mode: s.Mode,
|
mode: s.Mode,
|
||||||
uid: s.Uid,
|
uid: s.Uid,
|
||||||
gid: s.Gid,
|
gid: s.Gid,
|
||||||
rdev: s.Rdev,
|
// the type is 32bit on mips
|
||||||
|
rdev: uint64(s.Rdev), // nolint: unconvert
|
||||||
mtim: s.Mtim}, nil
|
mtim: s.Mtim}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue