runtime: virtcontainers/device: fix govet fieldalignment

Fix structures alignment

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2021-07-19 16:14:37 -05:00
parent 47d95dc1c6
commit dd58de368d
3 changed files with 43 additions and 38 deletions

View File

@ -94,6 +94,10 @@ var getSysDevPath = getSysDevPathImpl
// DeviceInfo is an embedded type that contains device data common to all types of devices.
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 string
@ -107,10 +111,22 @@ type DeviceInfo struct {
// More info in mknod(1).
DevType string
// ID for the device that is passed to the hypervisor.
ID string
// Major, minor numbers for device.
Major 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
// for a nvdimm device in the guest.
Pmem bool
@ -121,22 +137,6 @@ type DeviceInfo struct {
// ColdPlug specifies whether the device must be cold plugged (true)
// or hot plugged (false).
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
@ -151,15 +151,9 @@ type BlockDrive struct {
// ID is used to identify this drive in the hypervisor options.
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 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 is in the format SCSI-Id:LUN
SCSIAddr string
@ -173,6 +167,12 @@ type BlockDrive struct {
// DevNo identifies the css bus id for virtio-blk-ccw
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 bool
@ -203,12 +203,6 @@ const (
// VFIODev represents a VFIO drive used for hotplugging
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 string
@ -229,6 +223,12 @@ type VFIODev struct {
// Bus of VFIO PCIe device
Bus string
// Type of VFIO device
Type VFIODeviceType
// IsPCIe specifies device is PCIe or PCI
IsPCIe bool
}
// RNGDev represents a random number generator device
@ -243,15 +243,15 @@ type RNGDev struct {
type VhostUserDeviceAttrs struct {
DevID string
SocketPath string
Type DeviceType
// MacAddress is only meaningful for vhost user net device
MacAddress string
// These are only meaningful for vhost user fs devices
Tag string
CacheSize uint32
Cache string
Tag string
Cache string
Type DeviceType
// PCIPath is the PCI path used to identify the slot at which
// the drive is attached. It is only meaningful for vhost
@ -260,6 +260,8 @@ type VhostUserDeviceAttrs struct {
// Block index of the device if assigned
Index int
CacheSize uint32
}
// GetHostPathFunc is function pointer used to mock GetHostPath in tests.

View File

@ -17,9 +17,10 @@ import (
// GenericDevice refers to a device that is neither a VFIO device, block device or VhostUserDevice.
type GenericDevice struct {
ID string
DeviceInfo *config.DeviceInfo
ID string
RefCount uint
AttachCount uint
}

View File

@ -48,12 +48,14 @@ var (
)
type deviceManager struct {
blockDriver string
vhostUserStoreEnabled bool
vhostUserStorePath string
devices map[string]api.Device
blockDriver string
vhostUserStorePath string
sync.RWMutex
vhostUserStoreEnabled bool
}
func deviceLogger() *logrus.Entry {