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
35ec1a38
Unverified
Commit
35ec1a38
authored
Feb 20, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: rework cgroup initialization
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0e3af26b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
8 deletions
+15
-8
cgfsng.c
src/lxc/cgroups/cgfsng.c
+0
-0
cgroup.c
src/lxc/cgroups/cgroup.c
+6
-6
cgroup.h
src/lxc/cgroups/cgroup.h
+7
-0
cgroup_utils.c
src/lxc/cgroups/cgroup_utils.c
+1
-1
cgroup_utils.h
src/lxc/cgroups/cgroup_utils.h
+1
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
35ec1a38
This diff is collapsed.
Click to expand it.
src/lxc/cgroups/cgroup.c
View file @
35ec1a38
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
lxc_log_define
(
cgroup
,
lxc
);
lxc_log_define
(
cgroup
,
lxc
);
__hidden
extern
struct
cgroup_ops
*
cg
fsng
_ops_init
(
struct
lxc_conf
*
conf
);
__hidden
extern
struct
cgroup_ops
*
cg
roup
_ops_init
(
struct
lxc_conf
*
conf
);
struct
cgroup_ops
*
cgroup_init
(
struct
lxc_conf
*
conf
)
struct
cgroup_ops
*
cgroup_init
(
struct
lxc_conf
*
conf
)
{
{
...
@@ -30,7 +30,7 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
...
@@ -30,7 +30,7 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
if
(
!
conf
)
if
(
!
conf
)
return
log_error_errno
(
NULL
,
EINVAL
,
"No valid conf given"
);
return
log_error_errno
(
NULL
,
EINVAL
,
"No valid conf given"
);
cgroup_ops
=
cg
fsng
_ops_init
(
conf
);
cgroup_ops
=
cg
roup
_ops_init
(
conf
);
if
(
!
cgroup_ops
)
if
(
!
cgroup_ops
)
return
log_error_errno
(
NULL
,
errno
,
"Failed to initialize cgroup driver"
);
return
log_error_errno
(
NULL
,
errno
,
"Failed to initialize cgroup driver"
);
...
@@ -47,13 +47,13 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
...
@@ -47,13 +47,13 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
TRACE
(
"Initialized cgroup driver %s"
,
cgroup_ops
->
driver
);
TRACE
(
"Initialized cgroup driver %s"
,
cgroup_ops
->
driver
);
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_LEGACY
)
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_LEGACY
)
TRACE
(
"
Running with l
egacy cgroup layout"
);
TRACE
(
"
L
egacy cgroup layout"
);
else
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_HYBRID
)
else
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_HYBRID
)
TRACE
(
"
Running with h
ybrid cgroup layout"
);
TRACE
(
"
H
ybrid cgroup layout"
);
else
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_UNIFIED
)
else
if
(
cgroup_ops
->
cgroup_layout
==
CGROUP_LAYOUT_UNIFIED
)
TRACE
(
"
Running with u
nified cgroup layout"
);
TRACE
(
"
U
nified cgroup layout"
);
else
else
WARN
(
"
Running with unknown
cgroup layout"
);
WARN
(
"
Unsupported
cgroup layout"
);
return
cgroup_ops
;
return
cgroup_ops
;
}
}
...
...
src/lxc/cgroups/cgroup.h
View file @
35ec1a38
...
@@ -230,4 +230,11 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops)
...
@@ -230,4 +230,11 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops)
return
ops
->
unified
->
cgfd_con
;
return
ops
->
unified
->
cgfd_con
;
}
}
#define make_cgroup_path(__hierarchy, __first, ...) \
({ \
const struct hierarchy *__h = __hierarchy; \
must_make_path(DEFAULT_CGROUP_MOUNTPOINT, __h->mountpoint, \
__first, __VA_ARGS__); \
})
#endif
/* __LXC_CGROUP_H */
#endif
/* __LXC_CGROUP_H */
src/lxc/cgroups/cgroup_utils.c
View file @
35ec1a38
...
@@ -86,7 +86,7 @@ bool test_writeable_v2(char *mountpoint, char *path)
...
@@ -86,7 +86,7 @@ bool test_writeable_v2(char *mountpoint, char *path)
return
(
access
(
cgroup_threads_file
,
W_OK
)
==
0
);
return
(
access
(
cgroup_threads_file
,
W_OK
)
==
0
);
}
}
int
unified_cgroup_fd
(
int
fd
)
bool
unified_cgroup_fd
(
int
fd
)
{
{
int
ret
;
int
ret
;
...
...
src/lxc/cgroups/cgroup_utils.h
View file @
35ec1a38
...
@@ -29,7 +29,7 @@ __hidden extern bool test_writeable_v1(char *mountpoint, char *path);
...
@@ -29,7 +29,7 @@ __hidden extern bool test_writeable_v1(char *mountpoint, char *path);
*/
*/
__hidden
extern
bool
test_writeable_v2
(
char
*
mountpoint
,
char
*
path
);
__hidden
extern
bool
test_writeable_v2
(
char
*
mountpoint
,
char
*
path
);
__hidden
extern
int
unified_cgroup_fd
(
int
fd
);
__hidden
extern
bool
unified_cgroup_fd
(
int
fd
);
static
inline
bool
cgns_supported
(
void
)
static
inline
bool
cgns_supported
(
void
)
{
{
...
...
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