From: Daan De Meyer Date: Wed, 21 May 2025 07:42:03 +0000 (+0200) Subject: timesync: Clean up includes X-Git-Tag: v258-rc1~557^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37527%2Fhead;p=thirdparty%2Fsystemd.git timesync: Clean up includes Split out of #37344. --- diff --git a/src/timesync/test-timesync.c b/src/timesync/test-timesync.c index c8d8fd4bd4a..7cbdd4060d9 100644 --- a/src/timesync/test-timesync.c +++ b/src/timesync/test-timesync.c @@ -2,8 +2,6 @@ /* Some unit tests for the helper functions in timesyncd. */ -#include "log.h" -#include "macro.h" #include "tests.h" #include "timesyncd-conf.h" #include "timesyncd-manager.h" diff --git a/src/timesync/timesyncd-bus.c b/src/timesync/timesyncd-bus.c index 2c780f1d17e..b060431f6ca 100644 --- a/src/timesync/timesyncd-bus.c +++ b/src/timesync/timesyncd-bus.c @@ -1,26 +1,20 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "sd-bus.h" -#include "alloc-util.h" #include "bus-get-properties.h" -#include "bus-internal.h" #include "bus-log-control-api.h" +#include "bus-object.h" #include "bus-polkit.h" -#include "bus-protocol.h" #include "bus-util.h" #include "dns-domain.h" #include "in-addr-util.h" #include "log.h" -#include "macro.h" #include "strv.h" #include "time-util.h" #include "timesyncd-bus.h" #include "timesyncd-manager.h" #include "timesyncd-server.h" -#include "user-util.h" static int property_get_servers( sd_bus *bus, diff --git a/src/timesync/timesyncd-bus.h b/src/timesync/timesyncd-bus.h index 4ad25a0a6a7..57c272d6a53 100644 --- a/src/timesync/timesyncd-bus.h +++ b/src/timesync/timesyncd-bus.h @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "bus-object.h" - -typedef struct Manager Manager; +#include "timesyncd-forward.h" extern const BusObjectImplementation manager_object; diff --git a/src/timesync/timesyncd-conf.c b/src/timesync/timesyncd-conf.c index 4b1d4ddbfe4..0c7d9f39c14 100644 --- a/src/timesync/timesyncd-conf.c +++ b/src/timesync/timesyncd-conf.c @@ -1,9 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" -#include "constants.h" +#include "conf-parser.h" #include "dns-domain.h" #include "extract-word.h" +#include "log.h" #include "string-util.h" #include "timesyncd-conf.h" #include "timesyncd-manager.h" diff --git a/src/timesync/timesyncd-conf.h b/src/timesync/timesyncd-conf.h index f0f1ab5cdf8..745ba74b5c7 100644 --- a/src/timesync/timesyncd-conf.h +++ b/src/timesync/timesyncd-conf.h @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "conf-parser.h" -#include "timesyncd-server.h" - -typedef struct Manager Manager; +#include "timesyncd-forward.h" const struct ConfigPerfItem* timesyncd_gperf_lookup(const char *key, GPERF_LEN_TYPE length); diff --git a/src/timesync/timesyncd-forward.h b/src/timesync/timesyncd-forward.h new file mode 100644 index 00000000000..7a63e38f54e --- /dev/null +++ b/src/timesync/timesyncd-forward.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include "conf-parser-forward.h" /* IWYU pragma: export */ +#include "forward.h" /* IWYU pragma: export */ + +typedef enum ServerType ServerType; + +typedef struct Manager Manager; +typedef struct ServerAddress ServerAddress; +typedef struct ServerName ServerName; diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index 69d6703949c..88ad026595b 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -1,27 +1,26 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include +#include #include #include #include -#include -#include -#include -#include +#include "sd-bus.h" #include "sd-daemon.h" #include "sd-messages.h" +#include "sd-network.h" #include "alloc-util.h" -#include "bus-polkit.h" #include "clock-util.h" #include "common-signal.h" #include "dns-domain.h" +#include "errno-util.h" #include "event-util.h" #include "fd-util.h" #include "format-util.h" #include "fs-util.h" +#include "hashmap.h" #include "list.h" #include "log.h" #include "logarithm.h" @@ -33,10 +32,8 @@ #include "string-util.h" #include "strv.h" #include "time-util.h" -#include "timesyncd-conf.h" #include "timesyncd-manager.h" #include "timesyncd-server.h" -#include "user-util.h" #ifndef ADJ_SETOFFSET #define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ diff --git a/src/timesync/timesyncd-manager.h b/src/timesync/timesyncd-manager.h index 371a7ca1118..252e5164d33 100644 --- a/src/timesync/timesyncd-manager.h +++ b/src/timesync/timesyncd-manager.h @@ -1,23 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" -#include "sd-event.h" -#include "sd-network.h" -#include "sd-resolve.h" - -#include "hashmap.h" #include "list.h" #include "ratelimit.h" #include "time-util.h" +#include "timesyncd-forward.h" #include "timesyncd-ntp-message.h" -typedef enum ServerType ServerType; -typedef struct ServerAddress ServerAddress; -typedef struct ServerName ServerName; - /* * "A client MUST NOT under any conditions use a poll interval less * than 15 seconds." diff --git a/src/timesync/timesyncd-ntp-message.h b/src/timesync/timesyncd-ntp-message.h index fc122cbb9ab..ee6a6d7a77a 100644 --- a/src/timesync/timesyncd-ntp-message.h +++ b/src/timesync/timesyncd-ntp-message.h @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "macro.h" #include "sparse-endian.h" +#include "timesyncd-forward.h" /* NTP protocol, packet header */ #define NTP_LEAP_PLUSSEC 1 diff --git a/src/timesync/timesyncd-server.h b/src/timesync/timesyncd-server.h index dac74199ff0..ba3d9ff183b 100644 --- a/src/timesync/timesyncd-server.h +++ b/src/timesync/timesyncd-server.h @@ -3,10 +3,7 @@ #include "list.h" #include "socket-util.h" - -typedef struct Manager Manager; -typedef struct ServerAddress ServerAddress; -typedef struct ServerName ServerName; +#include "timesyncd-forward.h" typedef enum ServerType { SERVER_SYSTEM, diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index 6537f1ae923..822662c0169 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -1,24 +1,25 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include "sd-daemon.h" #include "sd-event.h" #include "sd-messages.h" #include "bus-log-control-api.h" +#include "bus-object.h" #include "capability-util.h" #include "clock-util.h" #include "daemon-util.h" +#include "errno-util.h" #include "fd-util.h" +#include "format-util.h" #include "fs-util.h" +#include "log.h" #include "main-func.h" #include "mkdir-label.h" #include "network-util.h" #include "process-util.h" #include "service-util.h" -#include "signal-util.h" #include "timesyncd-bus.h" #include "timesyncd-conf.h" #include "timesyncd-manager.h" diff --git a/src/timesync/wait-sync.c b/src/timesync/wait-sync.c index fa34138875e..f593b420b75 100644 --- a/src/timesync/wait-sync.c +++ b/src/timesync/wait-sync.c @@ -1,13 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* systemd service to wait until kernel realtime clock is synchronized */ -#include -#include #include -#include -#include #include -#include #include #include @@ -16,8 +11,8 @@ #include "errno-util.h" #include "fd-util.h" #include "inotify-util.h" +#include "log.h" #include "main-func.h" -#include "signal-util.h" #include "time-util.h" typedef struct ClockState {