Rename FindCgroupMountpointAndSource

Rename it to FindCgroupMountpointAndRoot.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2015-09-07 09:05:02 +08:00
parent bc67941c72
commit f2ec7eff7e
2 changed files with 5 additions and 5 deletions

View File

@ -235,12 +235,12 @@ func getCgroupData(c *configs.Cgroup, pid int) (*data, error) {
}, nil }, nil
} }
func (raw *data) parent(subsystem, mountpoint, src string) (string, error) { func (raw *data) parent(subsystem, mountpoint, root string) (string, error) {
initPath, err := cgroups.GetThisCgroupDir(subsystem) initPath, err := cgroups.GetThisCgroupDir(subsystem)
if err != nil { if err != nil {
return "", err return "", err
} }
relDir, err := filepath.Rel(src, initPath) relDir, err := filepath.Rel(root, initPath)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -248,7 +248,7 @@ func (raw *data) parent(subsystem, mountpoint, src string) (string, error) {
} }
func (raw *data) path(subsystem string) (string, error) { func (raw *data) path(subsystem string) (string, error) {
mnt, src, err := cgroups.FindCgroupMountpointAndSource(subsystem) mnt, root, err := cgroups.FindCgroupMountpointAndRoot(subsystem)
// If we didn't mount the subsystem, there is no point we make the path. // If we didn't mount the subsystem, there is no point we make the path.
if err != nil { if err != nil {
return "", err return "", err
@ -259,7 +259,7 @@ func (raw *data) path(subsystem string) (string, error) {
return filepath.Join(raw.root, filepath.Base(mnt), raw.cgroup), nil return filepath.Join(raw.root, filepath.Base(mnt), raw.cgroup), nil
} }
parent, err := raw.parent(subsystem, mnt, src) parent, err := raw.parent(subsystem, mnt, root)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@ -47,7 +47,7 @@ func FindCgroupMountpoint(subsystem string) (string, error) {
return "", NewNotFoundError(subsystem) return "", NewNotFoundError(subsystem)
} }
func FindCgroupMountpointAndSource(subsystem string) (string, string, error) { func FindCgroupMountpointAndRoot(subsystem string) (string, string, error) {
f, err := os.Open("/proc/self/mountinfo") f, err := os.Open("/proc/self/mountinfo")
if err != nil { if err != nil {
return "", "", err return "", "", err