1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #18659 from Mashimiao/blkio-bps-tfix

tfix: modify internal variable name to be lower-case
This commit is contained in:
Vincent Demeester 2015-12-15 09:20:15 +01:00
commit 6c0c199103

View file

@ -46,17 +46,17 @@ const (
func getBlkioWeightDevices(config *runconfig.HostConfig) ([]*blkiodev.WeightDevice, error) { func getBlkioWeightDevices(config *runconfig.HostConfig) ([]*blkiodev.WeightDevice, error) {
var stat syscall.Stat_t var stat syscall.Stat_t
var BlkioWeightDevices []*blkiodev.WeightDevice var blkioWeightDevices []*blkiodev.WeightDevice
for _, weightDevice := range config.BlkioWeightDevice { for _, weightDevice := range config.BlkioWeightDevice {
if err := syscall.Stat(weightDevice.Path, &stat); err != nil { if err := syscall.Stat(weightDevice.Path, &stat); err != nil {
return nil, err return nil, err
} }
WeightDevice := blkiodev.NewWeightDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), weightDevice.Weight, 0) weightDevice := blkiodev.NewWeightDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), weightDevice.Weight, 0)
BlkioWeightDevices = append(BlkioWeightDevices, WeightDevice) blkioWeightDevices = append(blkioWeightDevices, weightDevice)
} }
return BlkioWeightDevices, nil return blkioWeightDevices, nil
} }
func parseSecurityOpt(container *container.Container, config *runconfig.HostConfig) error { func parseSecurityOpt(container *container.Container, config *runconfig.HostConfig) error {
@ -87,33 +87,33 @@ func parseSecurityOpt(container *container.Container, config *runconfig.HostConf
} }
func getBlkioReadBpsDevices(config *runconfig.HostConfig) ([]*blkiodev.ThrottleDevice, error) { func getBlkioReadBpsDevices(config *runconfig.HostConfig) ([]*blkiodev.ThrottleDevice, error) {
var BlkioReadBpsDevice []*blkiodev.ThrottleDevice var blkioReadBpsDevice []*blkiodev.ThrottleDevice
var stat syscall.Stat_t var stat syscall.Stat_t
for _, bpsDevice := range config.BlkioDeviceReadBps { for _, bpsDevice := range config.BlkioDeviceReadBps {
if err := syscall.Stat(bpsDevice.Path, &stat); err != nil { if err := syscall.Stat(bpsDevice.Path, &stat); err != nil {
return nil, err return nil, err
} }
ReadBpsDevice := blkiodev.NewThrottleDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), bpsDevice.Rate) readBpsDevice := blkiodev.NewThrottleDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), bpsDevice.Rate)
BlkioReadBpsDevice = append(BlkioReadBpsDevice, ReadBpsDevice) blkioReadBpsDevice = append(blkioReadBpsDevice, readBpsDevice)
} }
return BlkioReadBpsDevice, nil return blkioReadBpsDevice, nil
} }
func getBlkioWriteBpsDevices(config *runconfig.HostConfig) ([]*blkiodev.ThrottleDevice, error) { func getBlkioWriteBpsDevices(config *runconfig.HostConfig) ([]*blkiodev.ThrottleDevice, error) {
var BlkioWriteBpsDevice []*blkiodev.ThrottleDevice var blkioWriteBpsDevice []*blkiodev.ThrottleDevice
var stat syscall.Stat_t var stat syscall.Stat_t
for _, bpsDevice := range config.BlkioDeviceWriteBps { for _, bpsDevice := range config.BlkioDeviceWriteBps {
if err := syscall.Stat(bpsDevice.Path, &stat); err != nil { if err := syscall.Stat(bpsDevice.Path, &stat); err != nil {
return nil, err return nil, err
} }
WriteBpsDevice := blkiodev.NewThrottleDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), bpsDevice.Rate) writeBpsDevice := blkiodev.NewThrottleDevice(int64(stat.Rdev/256), int64(stat.Rdev%256), bpsDevice.Rate)
BlkioWriteBpsDevice = append(BlkioWriteBpsDevice, WriteBpsDevice) blkioWriteBpsDevice = append(blkioWriteBpsDevice, writeBpsDevice)
} }
return BlkioWriteBpsDevice, nil return blkioWriteBpsDevice, nil
} }
func checkKernelVersion(k, major, minor int) bool { func checkKernelVersion(k, major, minor int) bool {