cgroups/fs2: move type decl to beginning
It was weird having it somewhere in the middle.
No code change, just moving it around.
@@ -13,6 +13,16 @@ import (
"github.com/pkg/errors"
)
+type manager struct {
+ config *configs.Cgroup
+ // dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope"
+ dirPath string
+ // controllers is content of "cgroup.controllers" file.
+ // excludes pseudo-controllers ("devices" and "freezer").
+ controllers map[string]struct{}
+ rootless bool
+}
+
// NewManager creates a manager for cgroup v2 unified hierarchy.
// dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope".
// If dirPath is empty, it is automatically set using config.
@@ -62,16 +72,6 @@ func detectControllers(dirPath string) (map[string]struct{}, error) {
return controllers, nil
}
-type manager struct {
- config *configs.Cgroup
- // dirPath is like "/sys/fs/cgroup/user.slice/user-1001.slice/session-1.scope"
- dirPath string
- // controllers is content of "cgroup.controllers" file.
- // excludes pseudo-controllers ("devices" and "freezer").
- controllers map[string]struct{}
- rootless bool
-}
-
func (m *manager) Apply(pid int) error {
if err := cgroups.WriteCgroupProc(m.dirPath, pid); err != nil && !m.rootless {
return err
