]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup: rename cgroup_add_* to cgroup_context_*
authorLennart Poettering <lennart@poettering.net>
Fri, 6 Oct 2023 16:15:56 +0000 (18:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 6 Oct 2023 16:15:56 +0000 (18:15 +0200)
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).

src/core/cgroup.c
src/core/cgroup.h
src/core/dbus-cgroup.c
src/core/load-fragment.c
src/core/unit.c

index 56c90f0460c0cd0b8521f9e81454e6f2f26adc19..f982526f269e4f722b17a90dfbbdcc478e3ec007 100644 (file)
@@ -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;
 
index 0d113a3de9b8b5fa6d911a010d585ebd59717e2f..abc8957902f972bca9a33da6c361de1e18ced0bf 100644 (file)
@@ -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);
index 32f93b8e8d8c87eaf7283c0e73b7301e62fc7d29..d38e8a6aeb4142542ac5c9749f89514815b675a4 100644 (file)
@@ -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;
                         }
index 1d230080bc8494377e70336c9caa7ba9c22bdfd3..3b737bf2f368e2d9f3fa53609d2b5dae563da782 100644 (file)
@@ -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");
 
index 2d096cbaefb795f0c9272b8ae8f5a626f3ab70a5..eed092b4dccfcf7d23521b8eb1c6238b8e6da803 100644 (file)
@@ -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;
                         }