From: Lennart Poettering Date: Fri, 6 Oct 2023 16:15:56 +0000 (+0200) Subject: cgroup: rename cgroup_add_* to cgroup_context_* X-Git-Tag: v255-rc1~298^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c6f2dca68c698065df7ba7bf44a5b01aa710427e;p=thirdparty%2Fsystemd.git 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). --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 56c90f0460c..f982526f269 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -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; diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 0d113a3de9b..abc8957902f 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -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); diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c index 32f93b8e8d8..d38e8a6aeb4 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -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; } diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 1d230080bc8..3b737bf2f36 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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"); diff --git a/src/core/unit.c b/src/core/unit.c index 2d096cbaefb..eed092b4dcc 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -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; }