Skip to content

Commit 80dea8e

Browse files
kolyshkinPaweł Szulik
authored andcommitted
container: rm cgroupFilesystems from rawContainerWatcher
cgroupPaths was basically a copy of cgroupSubsystems.MountPoints. This is because it was produced from the elements of the latter by calling common.MakeCgroupPaths() with the second argument of "/". Note that path.Join(something, "/") will return something. Since we have two copies of the same info, let's remove one and reuse the other. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent c9ee33e commit 80dea8e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

container/raw/watcher.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ type rawContainerWatcher struct {
3636
// Absolute path to the root of the cgroup hierarchies
3737
cgroupPaths map[string]string
3838

39-
cgroupSubsystems *libcontainer.CgroupSubsystems
40-
4139
// Inotify event watcher.
4240
watcher *common.InotifyWatcher
4341

@@ -60,10 +58,9 @@ func NewRawContainerWatcher() (watcher.ContainerWatcher, error) {
6058
}
6159

6260
rawWatcher := &rawContainerWatcher{
63-
cgroupPaths: common.MakeCgroupPaths(cgroupSubsystems.MountPoints, "/"),
64-
cgroupSubsystems: &cgroupSubsystems,
65-
watcher: watcher,
66-
stopWatcher: make(chan error),
61+
cgroupPaths: cgroupSubsystems.MountPoints,
62+
watcher: watcher,
63+
stopWatcher: make(chan error),
6764
}
6865

6966
return rawWatcher, nil
@@ -196,7 +193,7 @@ func (w *rawContainerWatcher) processEvent(event *inotify.Event, events chan wat
196193

197194
// Derive the container name from the path name.
198195
var containerName string
199-
for _, mount := range w.cgroupSubsystems.MountPoints {
196+
for _, mount := range w.cgroupPaths {
200197
mountLocation := path.Clean(mount) + "/"
201198
if strings.HasPrefix(event.Name, mountLocation) {
202199
containerName = event.Name[len(mountLocation)-1:]

0 commit comments

Comments
 (0)