Skip to content

Commit

Permalink
runtime: virtcontainers/types: fix govet fieldalignment
Browse files Browse the repository at this point in the history
Fix structures alignment

Signed-off-by: Julio Montes <julio.montes@intel.com>
  • Loading branch information
Julio Montes committed Jul 20, 2021
1 parent bb9495c commit 1e4f7fa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/runtime/virtcontainers/types/bridges.go
Expand Up @@ -36,12 +36,12 @@ type Bridge struct {
// ID is used to identify the bridge in the hypervisor
ID string

// Addr is the slot of the bridge
Addr int

// Type is the type of the bridge (pci, pcie, etc)
Type Type

// Addr is the slot of the bridge
Addr int

// MaxCapacity is the max capacity of the bridge
MaxCapacity uint32
}
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/virtcontainers/types/bridges_test.go
Expand Up @@ -96,15 +96,15 @@ func TestNewBridge(t *testing.T) {
func TestAddRemoveDevicePCI(t *testing.T) {

// create a pci bridge
bridges := []*Bridge{{make(map[uint32]string), "rgb123", 5, PCI, PCIBridgeMaxCapacity}}
bridges := []*Bridge{{make(map[uint32]string), "rgb123", PCI, 5, PCIBridgeMaxCapacity}}

testAddRemoveDevice(t, bridges[0])
}

func TestAddRemoveDeviceCCW(t *testing.T) {

// create a CCW bridge
bridges := []*Bridge{{make(map[uint32]string), "rgb123", 5, CCW, CCWBridgeMaxCapacity}}
bridges := []*Bridge{{make(map[uint32]string), "rgb123", CCW, 5, CCWBridgeMaxCapacity}}

testAddRemoveDevice(t, bridges[0])
}
8 changes: 4 additions & 4 deletions src/runtime/virtcontainers/types/fcConfig.go
Expand Up @@ -14,13 +14,13 @@ type FcConfig struct {

MachineConfig *models.MachineConfiguration `json:"machine-config"`

Drives []*models.Drive `json:"drives,omitempty"`

Vsock *models.Vsock `json:"vsock,omitempty"`

NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`

Logger *models.Logger `json:"logger,omitempty"`

Metrics *models.Metrics `json:"metrics,omitempty"`

Drives []*models.Drive `json:"drives,omitempty"`

NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`
}
31 changes: 16 additions & 15 deletions src/runtime/virtcontainers/types/sandbox.go
Expand Up @@ -41,29 +41,29 @@ const (

// SandboxState is a sandbox state structure
type SandboxState struct {
State StateString `json:"state"`

// Index map of the block device passed to hypervisor.
BlockIndexMap map[int]struct{} `json:"blockIndexMap"`

// GuestMemoryBlockSizeMB is the size of memory block of guestos
GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"`
// Path to all the cgroups setup for a container. Key is cgroup subsystem name
// with the value as the path.
CgroupPaths map[string]string `json:"cgroupPaths"`

// GuestMemoryHotplugProbe determines whether guest kernel supports memory hotplug probe interface
GuestMemoryHotplugProbe bool `json:"guestMemoryHotplugProbe"`
State StateString `json:"state"`

// CgroupPath is the cgroup hierarchy where sandbox's processes
// including the hypervisor are placed.
CgroupPath string `json:"cgroupPath,omitempty"`

// Path to all the cgroups setup for a container. Key is cgroup subsystem name
// with the value as the path.
CgroupPaths map[string]string `json:"cgroupPaths"`

// PersistVersion indicates current storage api version.
// It's also known as ABI version of kata-runtime.
// Note: it won't be written to disk
PersistVersion uint `json:"-"`

// GuestMemoryBlockSizeMB is the size of memory block of guestos
GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"`

// GuestMemoryHotplugProbe determines whether guest kernel supports memory hotplug probe interface
GuestMemoryHotplugProbe bool `json:"guestMemoryHotplugProbe"`
}

// Valid checks that the sandbox state is valid.
Expand Down Expand Up @@ -179,9 +179,9 @@ func (v *Volumes) String() string {
// the host and any process inside the VM.
// This kind of socket is not supported in all hypervisors.
type VSock struct {
VhostFd *os.File
ContextID uint64
Port uint32
VhostFd *os.File
}

func (s *VSock) String() string {
Expand Down Expand Up @@ -281,9 +281,7 @@ type EnvVar struct {

// Cmd represents a command to execute in a running container.
type Cmd struct {
Args []string
Envs []EnvVar
SupplementaryGroups []string
Capabilities *specs.LinuxCapabilities

// Note that these fields *MUST* remain as strings.
//
Expand Down Expand Up @@ -311,7 +309,10 @@ type Cmd struct {
PrimaryGroup string
WorkDir string
Console string
Capabilities *specs.LinuxCapabilities

Args []string
Envs []EnvVar
SupplementaryGroups []string

Interactive bool
Detach bool
Expand Down

0 comments on commit 1e4f7fa

Please sign in to comment.