]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/mount.c
core: split out cgroup specific state fields from Unit → CGroupRuntime
authorLennart Poettering <lennart@poettering.net>
Sat, 27 Jan 2024 09:59:15 +0000 (10:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 16 Feb 2024 09:17:40 +0000 (10:17 +0100)
commit9cc545447e31ed38d71c00d5957c4dee0b5bce97
treee91795661bc85dbc5769ed27aa59c838de9055ab
parent3f236f24ba61f14e4d740fc5bf19805c5c49b355
core: split out cgroup specific state fields from Unit → CGroupRuntime

This refactors the Unit structure a bit: all cgroup-related state fields
are moved to a new structure CGroupRuntime, which is only allocated as
we realize a cgroup.

This is both a nice cleanup and should make unit structures considerably
smaller that have no cgroup associated, because never realized or
because they belong to a unit type that doesn#t have cgroups anyway.

This makes things nicely symmetric:

        ExecContext → static user configuration about execution
        ExecRuntime → dynamic user state of execution
        CGroupContext → static user configuration about cgroups
        CGroupRuntime → dynamic user state of cgroups

And each time the XyzContext is part of the unit type structures such as
Service or Slice that need it, but the runtime object is only allocated
when a unit is started.
28 files changed:
src/core/bpf-firewall.c
src/core/bpf-foreign.c
src/core/bpf-restrict-fs.c
src/core/bpf-restrict-fs.h
src/core/bpf-restrict-ifaces.c
src/core/bpf-socket-bind.c
src/core/cgroup.c
src/core/cgroup.h
src/core/core-varlink.c
src/core/dbus-cgroup.c
src/core/dbus-unit.c
src/core/mount.c
src/core/mount.h
src/core/scope.c
src/core/scope.h
src/core/service.c
src/core/service.h
src/core/slice.c
src/core/slice.h
src/core/socket.c
src/core/socket.h
src/core/swap.c
src/core/swap.h
src/core/unit-printf.c
src/core/unit-serialize.c
src/core/unit.c
src/core/unit.h
src/test/test-bpf-firewall.c