mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 15:32:30 +00:00
runtime: virtcontainers/device: fix govet fieldalignment
Fix structures alignment Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
47d95dc1c6
commit
dd58de368d
@ -94,6 +94,10 @@ var getSysDevPath = getSysDevPathImpl
|
|||||||
|
|
||||||
// DeviceInfo is an embedded type that contains device data common to all types of devices.
|
// DeviceInfo is an embedded type that contains device data common to all types of devices.
|
||||||
type DeviceInfo struct {
|
type DeviceInfo struct {
|
||||||
|
// DriverOptions is specific options for each device driver
|
||||||
|
// for example, for BlockDevice, we can set DriverOptions["blockDriver"]="virtio-blk"
|
||||||
|
DriverOptions map[string]string
|
||||||
|
|
||||||
// Hostpath is device path on host
|
// Hostpath is device path on host
|
||||||
HostPath string
|
HostPath string
|
||||||
|
|
||||||
@ -107,10 +111,22 @@ type DeviceInfo struct {
|
|||||||
// More info in mknod(1).
|
// More info in mknod(1).
|
||||||
DevType string
|
DevType string
|
||||||
|
|
||||||
|
// ID for the device that is passed to the hypervisor.
|
||||||
|
ID string
|
||||||
|
|
||||||
// Major, minor numbers for device.
|
// Major, minor numbers for device.
|
||||||
Major int64
|
Major int64
|
||||||
Minor int64
|
Minor int64
|
||||||
|
|
||||||
|
// FileMode permission bits for the device.
|
||||||
|
FileMode os.FileMode
|
||||||
|
|
||||||
|
// id of the device owner.
|
||||||
|
UID uint32
|
||||||
|
|
||||||
|
// id of the device group.
|
||||||
|
GID uint32
|
||||||
|
|
||||||
// Pmem enabled persistent memory. Use HostPath as backing file
|
// Pmem enabled persistent memory. Use HostPath as backing file
|
||||||
// for a nvdimm device in the guest.
|
// for a nvdimm device in the guest.
|
||||||
Pmem bool
|
Pmem bool
|
||||||
@ -121,22 +137,6 @@ type DeviceInfo struct {
|
|||||||
// ColdPlug specifies whether the device must be cold plugged (true)
|
// ColdPlug specifies whether the device must be cold plugged (true)
|
||||||
// or hot plugged (false).
|
// or hot plugged (false).
|
||||||
ColdPlug bool
|
ColdPlug bool
|
||||||
|
|
||||||
// FileMode permission bits for the device.
|
|
||||||
FileMode os.FileMode
|
|
||||||
|
|
||||||
// id of the device owner.
|
|
||||||
UID uint32
|
|
||||||
|
|
||||||
// id of the device group.
|
|
||||||
GID uint32
|
|
||||||
|
|
||||||
// ID for the device that is passed to the hypervisor.
|
|
||||||
ID string
|
|
||||||
|
|
||||||
// DriverOptions is specific options for each device driver
|
|
||||||
// for example, for BlockDevice, we can set DriverOptions["blockDriver"]="virtio-blk"
|
|
||||||
DriverOptions map[string]string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockDrive represents a block storage drive which may be used in case the storage
|
// BlockDrive represents a block storage drive which may be used in case the storage
|
||||||
@ -151,15 +151,9 @@ type BlockDrive struct {
|
|||||||
// ID is used to identify this drive in the hypervisor options.
|
// ID is used to identify this drive in the hypervisor options.
|
||||||
ID string
|
ID string
|
||||||
|
|
||||||
// Index assigned to the drive. In case of virtio-scsi, this is used as SCSI LUN index
|
|
||||||
Index int
|
|
||||||
|
|
||||||
// MmioAddr is used to identify the slot at which the drive is attached (order?).
|
// MmioAddr is used to identify the slot at which the drive is attached (order?).
|
||||||
MmioAddr string
|
MmioAddr string
|
||||||
|
|
||||||
// PCIPath is the PCI path used to identify the slot at which the drive is attached.
|
|
||||||
PCIPath vcTypes.PciPath
|
|
||||||
|
|
||||||
// SCSI Address of the block device, in case the device is attached using SCSI driver
|
// SCSI Address of the block device, in case the device is attached using SCSI driver
|
||||||
// SCSI address is in the format SCSI-Id:LUN
|
// SCSI address is in the format SCSI-Id:LUN
|
||||||
SCSIAddr string
|
SCSIAddr string
|
||||||
@ -173,6 +167,12 @@ type BlockDrive struct {
|
|||||||
// DevNo identifies the css bus id for virtio-blk-ccw
|
// DevNo identifies the css bus id for virtio-blk-ccw
|
||||||
DevNo string
|
DevNo string
|
||||||
|
|
||||||
|
// PCIPath is the PCI path used to identify the slot at which the drive is attached.
|
||||||
|
PCIPath vcTypes.PciPath
|
||||||
|
|
||||||
|
// Index assigned to the drive. In case of virtio-scsi, this is used as SCSI LUN index
|
||||||
|
Index int
|
||||||
|
|
||||||
// ShareRW enables multiple qemu instances to share the File
|
// ShareRW enables multiple qemu instances to share the File
|
||||||
ShareRW bool
|
ShareRW bool
|
||||||
|
|
||||||
@ -203,12 +203,6 @@ const (
|
|||||||
|
|
||||||
// VFIODev represents a VFIO drive used for hotplugging
|
// VFIODev represents a VFIO drive used for hotplugging
|
||||||
type VFIODev struct {
|
type VFIODev struct {
|
||||||
// IsPCIe specifies device is PCIe or PCI
|
|
||||||
IsPCIe bool
|
|
||||||
|
|
||||||
// Type of VFIO device
|
|
||||||
Type VFIODeviceType
|
|
||||||
|
|
||||||
// ID is used to identify this drive in the hypervisor options.
|
// ID is used to identify this drive in the hypervisor options.
|
||||||
ID string
|
ID string
|
||||||
|
|
||||||
@ -229,6 +223,12 @@ type VFIODev struct {
|
|||||||
|
|
||||||
// Bus of VFIO PCIe device
|
// Bus of VFIO PCIe device
|
||||||
Bus string
|
Bus string
|
||||||
|
|
||||||
|
// Type of VFIO device
|
||||||
|
Type VFIODeviceType
|
||||||
|
|
||||||
|
// IsPCIe specifies device is PCIe or PCI
|
||||||
|
IsPCIe bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// RNGDev represents a random number generator device
|
// RNGDev represents a random number generator device
|
||||||
@ -243,16 +243,16 @@ type RNGDev struct {
|
|||||||
type VhostUserDeviceAttrs struct {
|
type VhostUserDeviceAttrs struct {
|
||||||
DevID string
|
DevID string
|
||||||
SocketPath string
|
SocketPath string
|
||||||
Type DeviceType
|
|
||||||
|
|
||||||
// MacAddress is only meaningful for vhost user net device
|
// MacAddress is only meaningful for vhost user net device
|
||||||
MacAddress string
|
MacAddress string
|
||||||
|
|
||||||
// These are only meaningful for vhost user fs devices
|
// These are only meaningful for vhost user fs devices
|
||||||
Tag string
|
Tag string
|
||||||
CacheSize uint32
|
|
||||||
Cache string
|
Cache string
|
||||||
|
|
||||||
|
Type DeviceType
|
||||||
|
|
||||||
// PCIPath is the PCI path used to identify the slot at which
|
// PCIPath is the PCI path used to identify the slot at which
|
||||||
// the drive is attached. It is only meaningful for vhost
|
// the drive is attached. It is only meaningful for vhost
|
||||||
// user block devices
|
// user block devices
|
||||||
@ -260,6 +260,8 @@ type VhostUserDeviceAttrs struct {
|
|||||||
|
|
||||||
// Block index of the device if assigned
|
// Block index of the device if assigned
|
||||||
Index int
|
Index int
|
||||||
|
|
||||||
|
CacheSize uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHostPathFunc is function pointer used to mock GetHostPath in tests.
|
// GetHostPathFunc is function pointer used to mock GetHostPath in tests.
|
||||||
|
@ -17,9 +17,10 @@ import (
|
|||||||
|
|
||||||
// GenericDevice refers to a device that is neither a VFIO device, block device or VhostUserDevice.
|
// GenericDevice refers to a device that is neither a VFIO device, block device or VhostUserDevice.
|
||||||
type GenericDevice struct {
|
type GenericDevice struct {
|
||||||
ID string
|
|
||||||
DeviceInfo *config.DeviceInfo
|
DeviceInfo *config.DeviceInfo
|
||||||
|
|
||||||
|
ID string
|
||||||
|
|
||||||
RefCount uint
|
RefCount uint
|
||||||
AttachCount uint
|
AttachCount uint
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,14 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type deviceManager struct {
|
type deviceManager struct {
|
||||||
|
devices map[string]api.Device
|
||||||
|
|
||||||
blockDriver string
|
blockDriver string
|
||||||
vhostUserStoreEnabled bool
|
|
||||||
vhostUserStorePath string
|
vhostUserStorePath string
|
||||||
|
|
||||||
devices map[string]api.Device
|
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
|
|
||||||
|
vhostUserStoreEnabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func deviceLogger() *logrus.Entry {
|
func deviceLogger() *logrus.Entry {
|
||||||
|
Loading…
Reference in New Issue
Block a user