cgroup: rename cgroup_add_* to cgroup_context_*
They add settings to a CGroupContext, hence give them the expected context, to make clear they do not operate on anything else than the structure (i.e. not on a kernel cgroup or so).
This commit is contained in:
+2
-2
@@ -695,7 +695,7 @@ void cgroup_context_dump_socket_bind_item(const CGroupSocketBindItem *item, FILE
|
||||
}
|
||||
}
|
||||
|
||||
int cgroup_add_device_allow(CGroupContext *c, const char *dev, const char *mode) {
|
||||
int cgroup_context_add_device_allow(CGroupContext *c, const char *dev, const char *mode) {
|
||||
_cleanup_free_ CGroupDeviceAllow *a = NULL;
|
||||
_cleanup_free_ char *d = NULL;
|
||||
|
||||
@@ -724,7 +724,7 @@ int cgroup_add_device_allow(CGroupContext *c, const char *dev, const char *mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cgroup_add_bpf_foreign_program(CGroupContext *c, uint32_t attach_type, const char *bpffs_path) {
|
||||
int cgroup_context_add_bpf_foreign_program(CGroupContext *c, uint32_t attach_type, const char *bpffs_path) {
|
||||
CGroupBPFForeignProgram *p;
|
||||
_cleanup_free_ char *d = NULL;
|
||||
|
||||
|
||||
+2
-2
@@ -275,8 +275,8 @@ static inline bool cgroup_context_want_memory_pressure(const CGroupContext *c) {
|
||||
(c->memory_pressure_watch == CGROUP_PRESSURE_WATCH_AUTO && c->memory_accounting);
|
||||
}
|
||||
|
||||
int cgroup_add_device_allow(CGroupContext *c, const char *dev, const char *mode);
|
||||
int cgroup_add_bpf_foreign_program(CGroupContext *c, uint32_t attach_type, const char *path);
|
||||
int cgroup_context_add_device_allow(CGroupContext *c, const char *dev, const char *mode);
|
||||
int cgroup_context_add_bpf_foreign_program(CGroupContext *c, uint32_t attach_type, const char *path);
|
||||
|
||||
void cgroup_oomd_xattr_apply(Unit *u, const char *cgroup_path);
|
||||
int cgroup_log_xattr_apply(Unit *u, const char *cgroup_path);
|
||||
|
||||
@@ -746,7 +746,7 @@ static int bus_cgroup_set_transient_property(
|
||||
name);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
r = cgroup_add_bpf_foreign_program(c, attach_type, p);
|
||||
r = cgroup_context_add_bpf_foreign_program(c, attach_type, p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -4195,7 +4195,7 @@ int config_parse_device_allow(
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cgroup_add_device_allow(c, resolved, p);
|
||||
return cgroup_context_add_device_allow(c, resolved, p);
|
||||
}
|
||||
|
||||
int config_parse_io_device_weight(
|
||||
@@ -5978,7 +5978,7 @@ int config_parse_bpf_foreign_program(
|
||||
if (r < 0)
|
||||
return 0;
|
||||
|
||||
r = cgroup_add_bpf_foreign_program(c, attach_type, resolved);
|
||||
r = cgroup_context_add_bpf_foreign_program(c, attach_type, resolved);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add foreign BPF program to cgroup context: %m");
|
||||
|
||||
|
||||
+4
-4
@@ -4385,12 +4385,12 @@ int unit_patch_contexts(Unit *u) {
|
||||
|
||||
/* When RootImage= or MountImages= is specified, the following devices are touched. */
|
||||
FOREACH_STRING(p, "/dev/loop-control", "/dev/mapper/control") {
|
||||
r = cgroup_add_device_allow(cc, p, "rw");
|
||||
r = cgroup_context_add_device_allow(cc, p, "rw");
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
FOREACH_STRING(p, "block-loop", "block-blkext", "block-device-mapper") {
|
||||
r = cgroup_add_device_allow(cc, p, "rwm");
|
||||
r = cgroup_context_add_device_allow(cc, p, "rwm");
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
@@ -4405,14 +4405,14 @@ int unit_patch_contexts(Unit *u) {
|
||||
}
|
||||
|
||||
if (ec->protect_clock) {
|
||||
r = cgroup_add_device_allow(cc, "char-rtc", "r");
|
||||
r = cgroup_context_add_device_allow(cc, "char-rtc", "r");
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* If there are encrypted credentials we might need to access the TPM. */
|
||||
if (exec_context_has_encrypted_credentials(ec)) {
|
||||
r = cgroup_add_device_allow(cc, "char-tpm", "rw");
|
||||
r = cgroup_context_add_device_allow(cc, "char-tpm", "rw");
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user