Skip to content

Commit 01b4c22

Browse files
committed
cgroups: rename function to readCgroupMapPath
the same format is used on cgroup v1, so no need to specify the version in the function name. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 1e47d4e commit 01b4c22

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/cgroups/cgroups.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ func (c *CgroupControl) Stat() (*Metrics, error) {
582582
return &m, nil
583583
}
584584

585-
func readCgroup2MapPath(path string) (map[string][]string, error) {
585+
func readCgroupMapPath(path string) (map[string][]string, error) {
586586
ret := map[string][]string{}
587587
f, err := os.Open(path)
588588
if err != nil {
@@ -610,5 +610,5 @@ func readCgroup2MapPath(path string) (map[string][]string, error) {
610610
func readCgroup2MapFile(ctr *CgroupControl, name string) (map[string][]string, error) {
611611
p := filepath.Join(cgroupRoot, ctr.path, name)
612612

613-
return readCgroup2MapPath(p)
613+
return readCgroupMapPath(p)
614614
}

pkg/cgroups/cgroups_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ func (c *CgroupControl) Stat() (*cgroups.Stats, error) {
542542
return &m, nil
543543
}
544544

545-
func readCgroup2MapPath(path string) (map[string][]string, error) {
545+
func readCgroupMapPath(path string) (map[string][]string, error) {
546546
ret := map[string][]string{}
547547
f, err := os.Open(path)
548548
if err != nil {
@@ -570,5 +570,5 @@ func readCgroup2MapPath(path string) (map[string][]string, error) {
570570
func readCgroup2MapFile(ctr *CgroupControl, name string) (map[string][]string, error) {
571571
p := filepath.Join(cgroupRoot, ctr.config.Path, name)
572572

573-
return readCgroup2MapPath(p)
573+
return readCgroupMapPath(p)
574574
}

pkg/cgroups/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func GetSystemCPUUsage() (uint64, error) {
6464
}
6565
p := filepath.Join(cgroupRoot, file.Name(), "cpu.stat")
6666

67-
values, err := readCgroup2MapPath(p)
67+
values, err := readCgroupMapPath(p)
6868
if err != nil {
6969
return 0, err
7070
}

0 commit comments

Comments
 (0)