cgroups/fs: rm getSubsystems

It does not add any value.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-05-31 11:16:58 -07:00
parent 2e22579946
commit daf30cb7ca
1 changed files with 4 additions and 8 deletions

View File

@ -18,7 +18,7 @@ import (
) )
var ( var (
subsystemsLegacy = subsystemSet{ subsystems = subsystemSet{
&CpusetGroup{}, &CpusetGroup{},
&DevicesGroup{}, &DevicesGroup{},
&MemoryGroup{}, &MemoryGroup{},
@ -164,10 +164,6 @@ func isIgnorableError(rootless bool, err error) bool {
return false return false
} }
func (m *manager) getSubsystems() subsystemSet {
return subsystemsLegacy
}
func (m *manager) Apply(pid int) (err error) { func (m *manager) Apply(pid int) (err error) {
if m.cgroups == nil { if m.cgroups == nil {
return nil return nil
@ -197,7 +193,7 @@ func (m *manager) Apply(pid int) (err error) {
return cgroups.EnterPid(m.paths, pid) return cgroups.EnterPid(m.paths, pid)
} }
for _, sys := range m.getSubsystems() { for _, sys := range subsystems {
p, err := d.path(sys.Name()) p, err := d.path(sys.Name())
if err != nil { if err != nil {
// The non-presence of the devices subsystem is // The non-presence of the devices subsystem is
@ -249,7 +245,7 @@ func (m *manager) GetStats() (*cgroups.Stats, error) {
defer m.mu.Unlock() defer m.mu.Unlock()
stats := cgroups.NewStats() stats := cgroups.NewStats()
for name, path := range m.paths { for name, path := range m.paths {
sys, err := m.getSubsystems().Get(name) sys, err := subsystems.Get(name)
if err == errSubsystemDoesNotExist { if err == errSubsystemDoesNotExist {
continue continue
} }
@ -273,7 +269,7 @@ func (m *manager) Set(container *configs.Config) error {
m.mu.Lock() m.mu.Lock()
defer m.mu.Unlock() defer m.mu.Unlock()
for _, sys := range m.getSubsystems() { for _, sys := range subsystems {
path := m.paths[sys.Name()] path := m.paths[sys.Name()]
if err := sys.Set(path, container.Cgroups); err != nil { if err := sys.Set(path, container.Cgroups); err != nil {
if m.rootless && sys.Name() == "devices" { if m.rootless && sys.Name() == "devices" {