mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 00:51:24 +03:00
core/cgroup: inline more iterator variable declarations
This commit is contained in:
parent
58441bc177
commit
e8616626eb
@ -517,9 +517,8 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
|
||||
|
||||
LIST_FOREACH(device_limits, il, c->io_device_limits) {
|
||||
char buf[FORMAT_BYTES_MAX];
|
||||
CGroupIOLimitType type;
|
||||
|
||||
for (type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++)
|
||||
for (CGroupIOLimitType type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++)
|
||||
if (il->limits[type] != cgroup_io_limit_defaults[type])
|
||||
fprintf(f,
|
||||
"%s%s: %s %s\n",
|
||||
@ -1347,9 +1346,8 @@ static void cgroup_context_apply(
|
||||
|
||||
LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths) {
|
||||
uint64_t limits[_CGROUP_IO_LIMIT_TYPE_MAX];
|
||||
CGroupIOLimitType type;
|
||||
|
||||
for (type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++)
|
||||
for (CGroupIOLimitType type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++)
|
||||
limits[type] = cgroup_io_limit_defaults[type];
|
||||
|
||||
limits[CGROUP_IO_RBPS_MAX] = b->rbps;
|
||||
@ -1534,7 +1532,6 @@ static void cgroup_context_apply(
|
||||
|
||||
static bool unit_get_needs_bpf_firewall(Unit *u) {
|
||||
CGroupContext *c;
|
||||
Unit *p;
|
||||
assert(u);
|
||||
|
||||
c = unit_get_cgroup_context(u);
|
||||
@ -1549,7 +1546,7 @@ static bool unit_get_needs_bpf_firewall(Unit *u) {
|
||||
return true;
|
||||
|
||||
/* If any parent slice has an IP access list defined, it applies too */
|
||||
for (p = UNIT_GET_SLICE(u); p; p = UNIT_GET_SLICE(p)) {
|
||||
for (Unit *p = UNIT_GET_SLICE(u); p; p = UNIT_GET_SLICE(p)) {
|
||||
c = unit_get_cgroup_context(p);
|
||||
if (!c)
|
||||
return false;
|
||||
@ -2163,7 +2160,6 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
r = 0;
|
||||
SET_FOREACH(pidp, pids) {
|
||||
pid_t pid = PTR_TO_PID(pidp);
|
||||
CGroupController c;
|
||||
|
||||
/* First, attach the PID to the main cgroup hierarchy */
|
||||
q = cg_attach(SYSTEMD_CGROUP_CONTROLLER, p, pid);
|
||||
@ -2200,7 +2196,7 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
/* In the legacy hierarchy, attach the process to the request cgroup if possible, and if not to the
|
||||
* innermost realized one */
|
||||
|
||||
for (c = 0; c < _CGROUP_CONTROLLER_MAX; c++) {
|
||||
for (CGroupController c = 0; c < _CGROUP_CONTROLLER_MAX; c++) {
|
||||
CGroupMask bit = CGROUP_CONTROLLER_TO_MASK(c);
|
||||
const char *realized;
|
||||
|
||||
@ -3137,7 +3133,6 @@ static int cg_bpf_mask_supported(CGroupMask *ret) {
|
||||
int manager_setup_cgroup(Manager *m) {
|
||||
_cleanup_free_ char *path = NULL;
|
||||
const char *scope_path;
|
||||
CGroupController c;
|
||||
int r, all_unified;
|
||||
CGroupMask mask;
|
||||
char *e;
|
||||
@ -3285,8 +3280,9 @@ int manager_setup_cgroup(Manager *m) {
|
||||
m->cgroup_supported |= mask;
|
||||
|
||||
/* 10. Log which controllers are supported */
|
||||
for (c = 0; c < _CGROUP_CONTROLLER_MAX; c++)
|
||||
log_debug("Controller '%s' supported: %s", cgroup_controller_to_string(c), yes_no(m->cgroup_supported & CGROUP_CONTROLLER_TO_MASK(c)));
|
||||
for (CGroupController c = 0; c < _CGROUP_CONTROLLER_MAX; c++)
|
||||
log_debug("Controller '%s' supported: %s", cgroup_controller_to_string(c),
|
||||
yes_no(m->cgroup_supported & CGROUP_CONTROLLER_TO_MASK(c)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user