Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
9f238864
Unverified
Commit
9f238864
authored
Sep 10, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: s/fullcgpath/container_full_path/g
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
3ec9a308
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
cgfsng.c
src/lxc/cgroups/cgfsng.c
+25
-25
cgroup.c
src/lxc/cgroups/cgroup.c
+1
-1
cgroup.h
src/lxc/cgroups/cgroup.h
+2
-2
No files found.
src/lxc/cgroups/cgfsng.c
View file @
9f238864
...
@@ -819,7 +819,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
...
@@ -819,7 +819,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
new
->
controllers
=
clist
;
new
->
controllers
=
clist
;
new
->
mountpoint
=
mountpoint
;
new
->
mountpoint
=
mountpoint
;
new
->
base_cgroup
=
base_cgroup
;
new
->
base_cgroup
=
base_cgroup
;
new
->
fullcg
path
=
NULL
;
new
->
container_full_
path
=
NULL
;
new
->
version
=
type
;
new
->
version
=
type
;
newentry
=
append_null_to_list
((
void
***
)
h
);
newentry
=
append_null_to_list
((
void
***
)
h
);
...
@@ -1051,15 +1051,15 @@ static int cgroup_rmdir(struct hierarchy **hierarchies,
...
@@ -1051,15 +1051,15 @@ static int cgroup_rmdir(struct hierarchy **hierarchies,
int
ret
;
int
ret
;
struct
hierarchy
*
h
=
hierarchies
[
i
];
struct
hierarchy
*
h
=
hierarchies
[
i
];
if
(
!
h
->
fullcg
path
)
if
(
!
h
->
container_full_
path
)
continue
;
continue
;
ret
=
recursive_destroy
(
h
->
fullcg
path
);
ret
=
recursive_destroy
(
h
->
container_full_
path
);
if
(
ret
<
0
)
if
(
ret
<
0
)
WARN
(
"Failed to destroy
\"
%s
\"
"
,
h
->
fullcg
path
);
WARN
(
"Failed to destroy
\"
%s
\"
"
,
h
->
container_full_
path
);
free
(
h
->
fullcg
path
);
free
(
h
->
container_full_
path
);
h
->
fullcg
path
=
NULL
;
h
->
container_full_
path
=
NULL
;
}
}
return
0
;
return
0
;
...
@@ -1196,9 +1196,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
...
@@ -1196,9 +1196,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{
{
int
ret
;
int
ret
;
h
->
fullcg
path
=
must_make_path
(
h
->
mountpoint
,
h
->
base_cgroup
,
cgname
,
NULL
);
h
->
container_full_
path
=
must_make_path
(
h
->
mountpoint
,
h
->
base_cgroup
,
cgname
,
NULL
);
if
(
dir_exists
(
h
->
fullcg
path
))
{
if
(
dir_exists
(
h
->
container_full_
path
))
{
ERROR
(
"The cgroup
\"
%s
\"
already existed"
,
h
->
fullcg
path
);
ERROR
(
"The cgroup
\"
%s
\"
already existed"
,
h
->
container_full_
path
);
return
false
;
return
false
;
}
}
...
@@ -1207,9 +1207,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
...
@@ -1207,9 +1207,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
return
false
;
return
false
;
}
}
ret
=
mkdir_p
(
h
->
fullcg
path
,
0755
);
ret
=
mkdir_p
(
h
->
container_full_
path
,
0755
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to create cgroup
\"
%s
\"
"
,
h
->
fullcg
path
);
ERROR
(
"Failed to create cgroup
\"
%s
\"
"
,
h
->
container_full_
path
);
return
false
;
return
false
;
}
}
...
@@ -1220,12 +1220,12 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
...
@@ -1220,12 +1220,12 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
{
{
int
ret
;
int
ret
;
ret
=
rmdir
(
h
->
fullcg
path
);
ret
=
rmdir
(
h
->
container_full_
path
);
if
(
ret
<
0
)
if
(
ret
<
0
)
SYSERROR
(
"Failed to rmdir(
\"
%s
\"
) from failed creation attempt"
,
h
->
fullcg
path
);
SYSERROR
(
"Failed to rmdir(
\"
%s
\"
) from failed creation attempt"
,
h
->
container_full_
path
);
free
(
h
->
fullcg
path
);
free
(
h
->
container_full_
path
);
h
->
fullcg
path
=
NULL
;
h
->
container_full_
path
=
NULL
;
}
}
/* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern;
/* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern;
...
@@ -1287,9 +1287,9 @@ again:
...
@@ -1287,9 +1287,9 @@ again:
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
if
(
!
create_path_for_hierarchy
(
ops
->
hierarchies
[
i
],
container_cgroup
))
{
if
(
!
create_path_for_hierarchy
(
ops
->
hierarchies
[
i
],
container_cgroup
))
{
int
j
;
int
j
;
ERROR
(
"Failed to create cgroup
\"
%s
\"
"
,
ops
->
hierarchies
[
i
]
->
fullcg
path
);
ERROR
(
"Failed to create cgroup
\"
%s
\"
"
,
ops
->
hierarchies
[
i
]
->
container_full_
path
);
free
(
ops
->
hierarchies
[
i
]
->
fullcg
path
);
free
(
ops
->
hierarchies
[
i
]
->
container_full_
path
);
ops
->
hierarchies
[
i
]
->
fullcg
path
=
NULL
;
ops
->
hierarchies
[
i
]
->
container_full_
path
=
NULL
;
for
(
j
=
0
;
j
<
i
;
j
++
)
for
(
j
=
0
;
j
<
i
;
j
++
)
remove_path_for_hierarchy
(
ops
->
hierarchies
[
j
],
container_cgroup
);
remove_path_for_hierarchy
(
ops
->
hierarchies
[
j
],
container_cgroup
);
idx
++
;
idx
++
;
...
@@ -1320,7 +1320,7 @@ __cgfsng_ops__ static bool cgfsng_enter(struct cgroup_ops *ops, pid_t pid)
...
@@ -1320,7 +1320,7 @@ __cgfsng_ops__ static bool cgfsng_enter(struct cgroup_ops *ops, pid_t pid)
int
ret
;
int
ret
;
char
*
fullpath
;
char
*
fullpath
;
fullpath
=
must_make_path
(
ops
->
hierarchies
[
i
]
->
fullcg
path
,
fullpath
=
must_make_path
(
ops
->
hierarchies
[
i
]
->
container_full_
path
,
"cgroup.procs"
,
NULL
);
"cgroup.procs"
,
NULL
);
ret
=
lxc_write_to_file
(
fullpath
,
pidstr
,
len
,
false
,
0666
);
ret
=
lxc_write_to_file
(
fullpath
,
pidstr
,
len
,
false
,
0666
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
...
@@ -1395,7 +1395,7 @@ static int chown_cgroup_wrapper(void *data)
...
@@ -1395,7 +1395,7 @@ static int chown_cgroup_wrapper(void *data)
for
(
i
=
0
;
arg
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
arg
->
hierarchies
[
i
];
i
++
)
{
char
*
fullpath
;
char
*
fullpath
;
char
*
path
=
arg
->
hierarchies
[
i
]
->
fullcg
path
;
char
*
path
=
arg
->
hierarchies
[
i
]
->
container_full_
path
;
ret
=
chowmod
(
path
,
destuid
,
nsgid
,
0775
);
ret
=
chowmod
(
path
,
destuid
,
nsgid
,
0775
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -1742,7 +1742,7 @@ __cgfsng_ops__ static int cgfsng_nrtasks(struct cgroup_ops *ops)
...
@@ -1742,7 +1742,7 @@ __cgfsng_ops__ static int cgfsng_nrtasks(struct cgroup_ops *ops)
if
(
!
ops
->
container_cgroup
||
!
ops
->
hierarchies
)
if
(
!
ops
->
container_cgroup
||
!
ops
->
hierarchies
)
return
-
1
;
return
-
1
;
path
=
must_make_path
(
ops
->
hierarchies
[
0
]
->
fullcg
path
,
NULL
);
path
=
must_make_path
(
ops
->
hierarchies
[
0
]
->
container_full_
path
,
NULL
);
count
=
recursive_count_nrtasks
(
path
);
count
=
recursive_count_nrtasks
(
path
);
free
(
path
);
free
(
path
);
return
count
;
return
count
;
...
@@ -1815,7 +1815,7 @@ __cgfsng_ops__ static bool cgfsng_unfreeze(struct cgroup_ops *ops)
...
@@ -1815,7 +1815,7 @@ __cgfsng_ops__ static bool cgfsng_unfreeze(struct cgroup_ops *ops)
if
(
!
h
)
if
(
!
h
)
return
false
;
return
false
;
fullpath
=
must_make_path
(
h
->
fullcg
path
,
"freezer.state"
,
NULL
);
fullpath
=
must_make_path
(
h
->
container_full_
path
,
"freezer.state"
,
NULL
);
ret
=
lxc_write_to_file
(
fullpath
,
THAWED
,
THAWED_LEN
,
false
,
0666
);
ret
=
lxc_write_to_file
(
fullpath
,
THAWED
,
THAWED_LEN
,
false
,
0666
);
free
(
fullpath
);
free
(
fullpath
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -1836,7 +1836,7 @@ __cgfsng_ops__ static const char *cgfsng_get_cgroup(struct cgroup_ops *ops,
...
@@ -1836,7 +1836,7 @@ __cgfsng_ops__ static const char *cgfsng_get_cgroup(struct cgroup_ops *ops,
return
NULL
;
return
NULL
;
}
}
return
h
->
fullcgpath
?
h
->
fullcg
path
+
strlen
(
h
->
mountpoint
)
:
NULL
;
return
h
->
container_full_path
?
h
->
container_full_
path
+
strlen
(
h
->
mountpoint
)
:
NULL
;
}
}
/* Given a cgroup path returned from lxc_cmd_get_cgroup_path, build a full path,
/* Given a cgroup path returned from lxc_cmd_get_cgroup_path, build a full path,
...
@@ -2161,7 +2161,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
...
@@ -2161,7 +2161,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
return
-
ENOENT
;
return
-
ENOENT
;
}
}
fullpath
=
must_make_path
(
h
->
fullcg
path
,
filename
,
NULL
);
fullpath
=
must_make_path
(
h
->
container_full_
path
,
filename
,
NULL
);
ret
=
lxc_write_to_file
(
fullpath
,
value
,
strlen
(
value
),
false
,
0666
);
ret
=
lxc_write_to_file
(
fullpath
,
value
,
strlen
(
value
),
false
,
0666
);
free
(
fullpath
);
free
(
fullpath
);
return
ret
;
return
ret
;
...
@@ -2229,7 +2229,7 @@ static bool __cg_unified_setup_limits(struct cgroup_ops *ops,
...
@@ -2229,7 +2229,7 @@ static bool __cg_unified_setup_limits(struct cgroup_ops *ops,
char
*
fullpath
;
char
*
fullpath
;
struct
lxc_cgroup
*
cg
=
iterator
->
elem
;
struct
lxc_cgroup
*
cg
=
iterator
->
elem
;
fullpath
=
must_make_path
(
h
->
fullcg
path
,
cg
->
subsystem
,
NULL
);
fullpath
=
must_make_path
(
h
->
container_full_
path
,
cg
->
subsystem
,
NULL
);
ret
=
lxc_write_to_file
(
fullpath
,
cg
->
value
,
strlen
(
cg
->
value
),
false
,
0666
);
ret
=
lxc_write_to_file
(
fullpath
,
cg
->
value
,
strlen
(
cg
->
value
),
false
,
0666
);
free
(
fullpath
);
free
(
fullpath
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
...
src/lxc/cgroups/cgroup.c
View file @
9f238864
...
@@ -85,7 +85,7 @@ void cgroup_exit(struct cgroup_ops *ops)
...
@@ -85,7 +85,7 @@ void cgroup_exit(struct cgroup_ops *ops)
free
((
*
it
)
->
mountpoint
);
free
((
*
it
)
->
mountpoint
);
free
((
*
it
)
->
base_cgroup
);
free
((
*
it
)
->
base_cgroup
);
free
((
*
it
)
->
fullcg
path
);
free
((
*
it
)
->
container_full_
path
);
free
(
*
it
);
free
(
*
it
);
}
}
free
(
ops
->
hierarchies
);
free
(
ops
->
hierarchies
);
...
...
src/lxc/cgroups/cgroup.h
View file @
9f238864
...
@@ -62,7 +62,7 @@ typedef enum {
...
@@ -62,7 +62,7 @@ typedef enum {
* is created. This will be either the caller's cgroup (if not root), or
* is created. This will be either the caller's cgroup (if not root), or
* init's cgroup (if root).
* init's cgroup (if root).
*
*
* @
fullcg
path
* @
container_full_
path
* - The full path to the containers cgroup.
* - The full path to the containers cgroup.
*
*
* @version
* @version
...
@@ -77,7 +77,7 @@ struct hierarchy {
...
@@ -77,7 +77,7 @@ struct hierarchy {
char
**
controllers
;
char
**
controllers
;
char
*
mountpoint
;
char
*
mountpoint
;
char
*
base_cgroup
;
char
*
base_cgroup
;
char
*
fullcg
path
;
char
*
container_full_
path
;
int
version
;
int
version
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment