Skip to content

Commit a397f0e

Browse files
kolyshkinPaweł Szulik
authored andcommitted
container: rm libcontainer.GetAllCgroupSubsystems
It is equivalent to GetCgroupSubsystems(nil) which is easy to use, and there's only one user. Remove the function, patch the user. While at it, document the includeMetrics argument of GetCgroupSubsystems. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent c539116 commit a397f0e

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

container/libcontainer/helpers.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ import (
3232
// GetCgroupSubsystems returns information about the cgroup subsystems that are
3333
// of interest as a map of cgroup controllers to their mount points.
3434
// For example, "cpu" -> "/sys/fs/cgroup/cpu".
35+
//
36+
// The incudeMetrics arguments specifies which metrics are requested,
37+
// and is used to filter out some cgroups and their mounts. If nil,
38+
// all supported cgroup subsystems are included.
3539
func GetCgroupSubsystems(includedMetrics container.MetricSet) (map[string]string, error) {
3640
// Get all cgroup mounts.
3741
allCgroups, err := cgroups.GetCgroupMounts(true)
@@ -42,17 +46,6 @@ func GetCgroupSubsystems(includedMetrics container.MetricSet) (map[string]string
4246
return getCgroupSubsystemsHelper(allCgroups, includedMetrics)
4347
}
4448

45-
// Get information about all the cgroup subsystems.
46-
func GetAllCgroupSubsystems() (map[string]string, error) {
47-
// Get all cgroup mounts.
48-
allCgroups, err := cgroups.GetCgroupMounts(true)
49-
if err != nil {
50-
return nil, err
51-
}
52-
53-
return getCgroupSubsystemsHelper(allCgroups, nil)
54-
}
55-
5649
func getCgroupSubsystemsHelper(allCgroups []cgroups.Mount, includedMetrics container.MetricSet) (map[string]string, error) {
5750
if len(allCgroups) == 0 {
5851
return nil, fmt.Errorf("failed to find cgroup mounts")

container/raw/watcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type rawContainerWatcher struct {
4444
}
4545

4646
func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
47-
cgroupSubsystems, err := libcontainer.GetAllCgroupSubsystems()
47+
cgroupSubsystems, err := libcontainer.GetCgroupSubsystems(nil)
4848
if err != nil {
4949
return nil, fmt.Errorf("failed to get cgroup subsystems: %v", err)
5050
}

0 commit comments

Comments
 (0)