From: Daan De Meyer Date: Wed, 21 May 2025 07:41:29 +0000 (+0200) Subject: oom: Clean up includes X-Git-Tag: v258-rc1~557^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c30d82664a2f89977532eb09981228bdc0e5c8d;p=thirdparty%2Fsystemd.git oom: Clean up includes Split out of #37344. --- diff --git a/src/oom/oomctl.c b/src/oom/oomctl.c index 09df6080a89..d9098de0ebf 100644 --- a/src/oom/oomctl.c +++ b/src/oom/oomctl.c @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include + +#include "sd-bus.h" #include "alloc-util.h" #include "build.h" @@ -12,7 +13,6 @@ #include "main-func.h" #include "pager.h" #include "pretty-print.h" -#include "terminal-util.h" #include "verbs.h" static PagerFlags arg_pager_flags = 0; diff --git a/src/oom/oomd-conf.c b/src/oom/oomd-conf.c index 1fcac362510..299d2afe96c 100644 --- a/src/oom/oomd-conf.c +++ b/src/oom/oomd-conf.c @@ -4,6 +4,9 @@ #include "log.h" #include "oomd-conf.h" #include "oomd-manager.h" +#include "parse-util.h" +#include "string-util.h" +#include "time-util.h" static int config_parse_duration( const char *unit, diff --git a/src/oom/oomd-conf.h b/src/oom/oomd-conf.h index 0283b9e61dd..429b976b91b 100644 --- a/src/oom/oomd-conf.h +++ b/src/oom/oomd-conf.h @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "conf-parser.h" -#include "oomd-manager.h" +typedef struct Manager Manager; void manager_set_defaults(Manager *m); diff --git a/src/oom/oomd-manager-bus.c b/src/oom/oomd-manager-bus.c index f2bf6b41cb5..08f261fcc1a 100644 --- a/src/oom/oomd-manager-bus.c +++ b/src/oom/oomd-manager-bus.c @@ -1,15 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include "sd-bus.h" #include "alloc-util.h" -#include "bus-common-errors.h" -#include "bus-polkit.h" +#include "bus-object.h" #include "fd-util.h" #include "memfd-util.h" #include "oomd-manager.h" #include "oomd-manager-bus.h" -#include "user-util.h" static int bus_method_dump_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_free_ char *dump = NULL; diff --git a/src/oom/oomd-manager-bus.h b/src/oom/oomd-manager-bus.h index 7935b357a4d..70c473f15be 100644 --- a/src/oom/oomd-manager-bus.h +++ b/src/oom/oomd-manager-bus.h @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "bus-object.h" - -typedef struct Manager Manager; +#include "forward.h" extern const BusObjectImplementation manager_object; diff --git a/src/oom/oomd-manager.c b/src/oom/oomd-manager.c index b494ea0c284..2cdd404bf00 100644 --- a/src/oom/oomd-manager.c +++ b/src/oom/oomd-manager.c @@ -1,25 +1,30 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" #include "sd-daemon.h" +#include "sd-event.h" #include "sd-json.h" #include "alloc-util.h" #include "bus-log-control-api.h" -#include "bus-polkit.h" +#include "bus-object.h" #include "bus-util.h" #include "cgroup-util.h" +#include "constants.h" #include "daemon-util.h" #include "fd-util.h" -#include "fileio.h" #include "format-util.h" #include "json-util.h" -#include "memory-util.h" #include "memstream-util.h" #include "oomd-conf.h" #include "oomd-manager.h" #include "oomd-manager-bus.h" +#include "parse-util.h" #include "path-util.h" #include "percent-util.h" +#include "set.h" +#include "string-util.h" +#include "time-util.h" #include "varlink-io.systemd.oom.h" #include "varlink-io.systemd.service.h" #include "varlink-util.h" diff --git a/src/oom/oomd-manager.h b/src/oom/oomd-manager.h index a40946ce4e1..311250c6f35 100644 --- a/src/oom/oomd-manager.h +++ b/src/oom/oomd-manager.h @@ -1,11 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" -#include "sd-event.h" -#include "sd-varlink.h" - -#include "conf-parser.h" +#include "conf-parser-forward.h" +#include "forward.h" #include "oomd-util.h" /* Polling interval for monitoring stats */ @@ -27,9 +24,7 @@ #define RECLAIM_DURATION_USEC (30 * USEC_PER_SEC) #define POST_ACTION_DELAY_USEC (15 * USEC_PER_SEC) -typedef struct Manager Manager; - -struct Manager { +typedef struct Manager { sd_bus *bus; sd_event *event; @@ -59,7 +54,7 @@ struct Manager { /* This varlink server object is used to manage systemd-oomd's varlink server which is used by user * managers to report changes in ManagedOOM settings (oomd server - systemd client). */ sd_varlink_server *varlink_server; -}; +} Manager; Manager* manager_free(Manager *m); DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c index b6b6c2a2f1a..de0f2e68540 100644 --- a/src/oom/oomd-util.c +++ b/src/oom/oomd-util.c @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include - +#include "alloc-util.h" #include "errno-util.h" #include "fd-util.h" #include "fileio.h" @@ -12,12 +10,14 @@ #include "oomd-util.h" #include "parse-util.h" #include "path-util.h" +#include "pidref.h" #include "procfs-util.h" +#include "set.h" #include "signal-util.h" #include "sort-util.h" -#include "stat-util.h" #include "stdio-util.h" -#include "user-util.h" +#include "string-util.h" +#include "time-util.h" DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR( oomd_cgroup_ctx_hash_ops, diff --git a/src/oom/oomd-util.h b/src/oom/oomd-util.h index 14fe5c5ebab..cfb310ff32c 100644 --- a/src/oom/oomd-util.h +++ b/src/oom/oomd-util.h @@ -1,10 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "cgroup-util.h" -#include "hashmap.h" +#include "forward.h" #include "psi-util.h" #define DUMP_ON_KILL_COUNT 10u diff --git a/src/oom/oomd.c b/src/oom/oomd.c index d0876d789f0..b1d3efb8f57 100644 --- a/src/oom/oomd.c +++ b/src/oom/oomd.c @@ -2,12 +2,13 @@ #include +#include "sd-event.h" + #include "alloc-util.h" #include "build.h" #include "bus-log-control-api.h" #include "bus-object.h" #include "cgroup-util.h" -#include "conf-parser.h" #include "daemon-util.h" #include "fileio.h" #include "log.h" @@ -18,7 +19,6 @@ #include "parse-util.h" #include "pretty-print.h" #include "psi-util.h" -#include "signal-util.h" static bool arg_dry_run = false; diff --git a/src/oom/test-oomd-util.c b/src/oom/test-oomd-util.c index 2eca39c2958..3c5159129f7 100644 --- a/src/oom/test-oomd-util.c +++ b/src/oom/test-oomd-util.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include "alloc-util.h" @@ -7,13 +8,12 @@ #include "cgroup-util.h" #include "fd-util.h" #include "fileio.h" -#include "fs-util.h" #include "oomd-util.h" #include "parse-util.h" #include "path-util.h" -#include "string-util.h" -#include "strv.h" +#include "set.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" static int fork_and_sleep(unsigned sleep_min) {