mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
virtcontainers: Convert stats dev_t to uint64
We need to convert them to uint64 as their types may differ on various host OSes, but unix.Major|Minor takes a uint64 regardless. Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
This commit is contained in:
parent
56751089c0
commit
ad0449195d
@ -629,8 +629,8 @@ func (c *Container) createBlockDevices(ctx context.Context) error {
|
||||
HostPath: m.Source,
|
||||
ContainerPath: m.Destination,
|
||||
DevType: "b",
|
||||
Major: int64(unix.Major(stat.Rdev)),
|
||||
Minor: int64(unix.Minor(stat.Rdev)),
|
||||
Major: int64(unix.Major(uint64(stat.Rdev))),
|
||||
Minor: int64(unix.Minor(uint64(stat.Rdev))),
|
||||
ReadOnly: m.ReadOnly,
|
||||
}
|
||||
// Check whether source can be used as a pmem device
|
||||
@ -1226,8 +1226,8 @@ func (c *Container) plugDevice(ctx context.Context, devicePath string) error {
|
||||
HostPath: devicePath,
|
||||
ContainerPath: filepath.Join(kataGuestSharedDir(), c.id),
|
||||
DevType: "b",
|
||||
Major: int64(unix.Major(stat.Rdev)),
|
||||
Minor: int64(unix.Minor(stat.Rdev)),
|
||||
Major: int64(unix.Major(uint64(stat.Rdev))),
|
||||
Minor: int64(unix.Minor(uint64(stat.Rdev))),
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("device manager failed to create rootfs device for %q: %v", devicePath, err)
|
||||
|
@ -425,8 +425,8 @@ func getVhostUserDevName(dirname string, majorNum, minorNum uint32) (string, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
devMajor := unix.Major(devStat.Rdev)
|
||||
devMinor := unix.Minor(devStat.Rdev)
|
||||
devMajor := unix.Major(uint64(devStat.Rdev))
|
||||
devMinor := unix.Minor(uint64(devStat.Rdev))
|
||||
if devMajor == majorNum && devMinor == minorNum {
|
||||
return file.Name(), nil
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ func PmemDeviceInfo(source, destination string) (*DeviceInfo, error) {
|
||||
device := &DeviceInfo{
|
||||
ContainerPath: destination,
|
||||
DevType: "b",
|
||||
Major: int64(unix.Major(stat.Dev)),
|
||||
Minor: int64(unix.Minor(stat.Dev)),
|
||||
Major: int64(unix.Major(uint64(stat.Dev))),
|
||||
Minor: int64(unix.Minor(uint64(stat.Dev))),
|
||||
Pmem: true,
|
||||
DriverOptions: make(map[string]string),
|
||||
}
|
||||
|
@ -2084,7 +2084,7 @@ func (k *kataAgent) copyFile(ctx context.Context, src, dst string) error {
|
||||
cpReq := &grpc.CopyFileRequest{
|
||||
Path: dst,
|
||||
DirMode: uint32(DirMode),
|
||||
FileMode: st.Mode,
|
||||
FileMode: uint32(st.Mode),
|
||||
FileSize: fileSize,
|
||||
Uid: int32(st.Uid),
|
||||
Gid: int32(st.Gid),
|
||||
|
@ -144,8 +144,8 @@ func getDeviceForPath(path string) (device, error) {
|
||||
|
||||
if isHostDevice(path) {
|
||||
// stat.Rdev describes the device that this file (inode) represents.
|
||||
devMajor = major(stat.Rdev)
|
||||
devMinor = minor(stat.Rdev)
|
||||
devMajor = major(uint64(stat.Rdev))
|
||||
devMinor = minor(uint64(stat.Rdev))
|
||||
|
||||
return device{
|
||||
major: devMajor,
|
||||
@ -154,8 +154,8 @@ func getDeviceForPath(path string) (device, error) {
|
||||
}, nil
|
||||
}
|
||||
// stat.Dev points to the underlying device containing the file
|
||||
devMajor = major(stat.Dev)
|
||||
devMinor = minor(stat.Dev)
|
||||
devMajor = major(uint64(stat.Dev))
|
||||
devMinor = minor(uint64(stat.Dev))
|
||||
|
||||
path, err = filepath.Abs(path)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user