core: Remove circular dependencies between headers

Currently there are various circular dependencies between headers
in core/. Let's get rid of these by making judicious use of forward
declarations and moving includes into implementation files instead of
having them in header files.

Getting rid of circular header includes simplifies the code and makes
various clang based tooling such as iwyu work much better on our code.

The most important change is getting rid of the manager.h include in
unit.h which is possible thanks to the previous commits. We also move
the OOMPolicy and StatusType enums to unit.h to remove the need for
other unit headers to include manager.h to get access to these enums.
This commit is contained in:
Daan De Meyer
2025-04-23 10:33:35 +02:00
parent 64fd6ba9ca
commit 4ea4abb651
66 changed files with 194 additions and 158 deletions
+4
View File
@@ -24,11 +24,13 @@
#include "bpf-restrict-fs.h"
#include "btrfs-util.h"
#include "capability-util.h"
#include "cgroup.h"
#include "cgroup-setup.h"
#include "chase.h"
#include "chattr-util.h"
#include "chown-recursive.h"
#include "copy.h"
#include "dynamic-user.h"
#include "env-util.h"
#include "escape.h"
#include "exec-credential.h"
@@ -43,10 +45,12 @@
#include "ioprio-util.h"
#include "iovec-util.h"
#include "journal-send.h"
#include "manager.h"
#include "memfd-util.h"
#include "missing_sched.h"
#include "missing_syscall.h"
#include "mkdir-label.h"
#include "mount-util.h"
#include "osc-context.h"
#include "proc-cmdline.h"
#include "process-util.h"