spec: Make addPrivilegedDevices and createBlockIO per-platform

b96be3af (changes to allow for darwin compilation, 2018-06-20, #1015)
made AddPrivilegedDevices per-platform and cc6f0e85 (more changes to
compile darwin, 2018-07-04, #1047) made CreateBlockIO per-platform.
But both left but left out docs for the unsupported version [1]:

  pkg/spec/config_unsupported.go:18:1⚠️ exported method
    CreateConfig.AddPrivilegedDevices should have comment or be
    unexported (golint)
  pkg/spec/config_unsupported.go:22:1⚠️ exported method
    CreateConfig.CreateBlockIO should have comment or be unexported
    (golint)

To keep the docs DRY, I've restored the public methods and their docs,
and I've added new, internal methods for the per-platform
implementations.

[1]: https://travis-ci.org/projectatomic/libpod/jobs/400555937#L160

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1034
Approved by: baude
This commit is contained in:
W. Trevor King
2018-07-05 13:35:06 -07:00
committed by Atomic Bot
parent 537f021733
commit 4f0c0597a1
3 changed files with 16 additions and 7 deletions

View File

@ -46,9 +46,7 @@ func addDevice(g *generate.Generator, device string) error {
return nil
}
// AddPrivilegedDevices iterates through host devices and adds all
// host devices to the spec
func (c *CreateConfig) AddPrivilegedDevices(g *generate.Generator) error {
func (c *CreateConfig) addPrivilegedDevices(g *generate.Generator) error {
hostDevices, err := devices.HostDevices()
if err != nil {
return err
@ -84,8 +82,7 @@ func getSeccompConfig(config *CreateConfig, configSpec *spec.Spec) (*spec.LinuxS
return seccompConfig, nil
}
// CreateBlockIO returns a LinuxBlockIO struct from a CreateConfig
func (c *CreateConfig) CreateBlockIO() (*spec.LinuxBlockIO, error) {
func (c *CreateConfig) createBlockIO() (*spec.LinuxBlockIO, error) {
bio := &spec.LinuxBlockIO{}
bio.Weight = &c.Resources.BlkioWeight
if len(c.Resources.BlkioWeightDevice) > 0 {