cgroup-util: FLAGS_SET()ify all things
This commit is contained in:
parent
03afd78029
commit
f99850a0d4
|
@ -2144,9 +2144,9 @@ int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path
|
||||||
|
|
||||||
n = cgroup_controller_to_string(c);
|
n = cgroup_controller_to_string(c);
|
||||||
|
|
||||||
if (mask & bit)
|
if (FLAGS_SET(mask, bit))
|
||||||
(void) cg_create(n, path);
|
(void) cg_create(n, path);
|
||||||
else if (supported & bit)
|
else if (FLAGS_SET(supported, bit))
|
||||||
(void) cg_trim(n, path, true);
|
(void) cg_trim(n, path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2174,7 +2174,7 @@ int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_m
|
||||||
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(supported & bit))
|
if (!FLAGS_SET(supported, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (path_callback)
|
if (path_callback)
|
||||||
|
@ -2229,7 +2229,7 @@ int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to
|
||||||
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(supported & bit))
|
if (!FLAGS_SET(supported, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (to_callback)
|
if (to_callback)
|
||||||
|
@ -2264,7 +2264,7 @@ int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root)
|
||||||
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
if (!FLAGS_SET(CGROUP_MASK_V1, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(supported & bit))
|
if (!FLAGS_SET(supported, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void) cg_trim(cgroup_controller_to_string(c), path, delete_root);
|
(void) cg_trim(cgroup_controller_to_string(c), path, delete_root);
|
||||||
|
@ -2290,7 +2290,7 @@ int cg_mask_to_string(CGroupMask mask, char **ret) {
|
||||||
const char *k;
|
const char *k;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
if (!(mask & CGROUP_CONTROLLER_TO_MASK(c)))
|
if (!FLAGS_SET(mask, CGROUP_CONTROLLER_TO_MASK(c)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = cgroup_controller_to_string(c);
|
k = cgroup_controller_to_string(c);
|
||||||
|
@ -2603,14 +2603,14 @@ int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) {
|
||||||
if (!FLAGS_SET(CGROUP_MASK_V2, bit))
|
if (!FLAGS_SET(CGROUP_MASK_V2, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(supported & bit))
|
if (!FLAGS_SET(supported, bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
n = cgroup_controller_to_string(c);
|
n = cgroup_controller_to_string(c);
|
||||||
{
|
{
|
||||||
char s[1 + strlen(n) + 1];
|
char s[1 + strlen(n) + 1];
|
||||||
|
|
||||||
s[0] = mask & bit ? '+' : '-';
|
s[0] = FLAGS_SET(mask, bit) ? '+' : '-';
|
||||||
strcpy(s + 1, n);
|
strcpy(s + 1, n);
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
Loading…
Reference in New Issue