From: Daan De Meyer Date: Thu, 22 May 2025 09:27:45 +0000 (+0200) Subject: libsystemd: Clean up includes X-Git-Tag: v258-rc1~501 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cdf13c70cab5b6652fc2fec604515b4853eb5ed;p=thirdparty%2Fsystemd.git libsystemd: Clean up includes For libsystemd's headers, the changes made depend on whether the header is installed or not. For installed headers, the only change made is that commonly included headers were moved to _sd-common.h. For these headers, there should be no noticeable change in behavior when including them. For non-installed headers, includes were replaced with forward declarations where possible as usual. Split out of #37344. --- diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c index ad61614f12f..a017cb7ab29 100644 --- a/src/libsystemd-network/arp-util.c +++ b/src/libsystemd-network/arp-util.c @@ -3,7 +3,6 @@ Copyright © 2014 Axis Communications AB. All rights reserved. ***/ -#include #include #include @@ -11,6 +10,7 @@ #include "ether-addr-util.h" #include "fd-util.h" #include "in-addr-util.h" +#include "socket-util.h" #include "unaligned.h" int arp_update_filter(int fd, const struct in_addr *a, const struct ether_addr *mac) { diff --git a/src/libsystemd-network/arp-util.h b/src/libsystemd-network/arp-util.h index b66a81bf9bd..4152c3a0986 100644 --- a/src/libsystemd-network/arp-util.h +++ b/src/libsystemd-network/arp-util.h @@ -5,11 +5,7 @@ Copyright © 2014 Axis Communications AB. All rights reserved. ***/ -#include -#include - -#include "socket-util.h" -#include "sparse-endian.h" +#include "forward.h" int arp_update_filter(int fd, const struct in_addr *a, const struct ether_addr *mac); int arp_network_bind_raw_socket(int ifindex, const struct in_addr *a, const struct ether_addr *mac); diff --git a/src/libsystemd-network/dhcp-client-id-internal.h b/src/libsystemd-network/dhcp-client-id-internal.h index 382575e7a28..f43d278cddd 100644 --- a/src/libsystemd-network/dhcp-client-id-internal.h +++ b/src/libsystemd-network/dhcp-client-id-internal.h @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include + #include "sd-dhcp-client-id.h" -#include "sd-json.h" #include "dhcp-duid-internal.h" -#include "macro.h" -#include "siphash24.h" +#include "forward.h" #include "sparse-endian.h" /* RFC 2132 section 9.14: its minimum length is 2. diff --git a/src/libsystemd-network/dhcp-client-internal.h b/src/libsystemd-network/dhcp-client-internal.h index 247fd9d9120..3248e1098b1 100644 --- a/src/libsystemd-network/dhcp-client-internal.h +++ b/src/libsystemd-network/dhcp-client-internal.h @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-dhcp-client.h" -#include "macro.h" +#include "forward.h" #include "network-common.h" typedef enum DHCPState { diff --git a/src/libsystemd-network/dhcp-duid-internal.h b/src/libsystemd-network/dhcp-duid-internal.h index 0d3d6b5cef6..061786cd02d 100644 --- a/src/libsystemd-network/dhcp-duid-internal.h +++ b/src/libsystemd-network/dhcp-duid-internal.h @@ -1,12 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-device.h" #include "sd-dhcp-duid.h" #include "sd-id128.h" #include "ether-addr-util.h" -#include "macro.h" +#include "forward.h" #include "sparse-endian.h" #define SYSTEMD_PEN 43793 diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h index 394c71bdf0f..0ed8c3fc938 100644 --- a/src/libsystemd-network/dhcp-lease-internal.h +++ b/src/libsystemd-network/dhcp-lease-internal.h @@ -5,13 +5,12 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include "sd-dhcp-client.h" +#include "sd-dhcp-lease.h" -#include "alloc-util.h" #include "dhcp-client-id-internal.h" #include "dhcp-option.h" +#include "forward.h" #include "list.h" -#include "time-util.h" struct sd_dhcp_route { struct in_addr dst_addr; diff --git a/src/libsystemd-network/dhcp-network.c b/src/libsystemd-network/dhcp-network.c index 207f68a5e6e..24b8c12011f 100644 --- a/src/libsystemd-network/dhcp-network.c +++ b/src/libsystemd-network/dhcp-network.c @@ -3,20 +3,18 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include #include #include #include -#include -#include #include #include #include #include "dhcp-network.h" #include "dhcp-protocol.h" +#include "ether-addr-util.h" #include "fd-util.h" -#include "log.h" +#include "socket-util.h" #include "unaligned.h" static int _bind_raw_socket( diff --git a/src/libsystemd-network/dhcp-network.h b/src/libsystemd-network/dhcp-network.h index eb9dab44533..c493cfeee50 100644 --- a/src/libsystemd-network/dhcp-network.h +++ b/src/libsystemd-network/dhcp-network.h @@ -1,11 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "ether-addr-util.h" -#include "socket-util.h" +#include "forward.h" +#include "sparse-endian.h" int dhcp_network_bind_raw_socket( int ifindex, diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/dhcp-option.c index 4945acfd563..a840b614621 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/dhcp-option.c @@ -3,8 +3,6 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include -#include #include #include "alloc-util.h" @@ -14,6 +12,7 @@ #include "hostname-util.h" #include "memory-util.h" #include "ordered-set.h" +#include "string-util.h" #include "strv.h" #include "utf8.h" diff --git a/src/libsystemd-network/dhcp-option.h b/src/libsystemd-network/dhcp-option.h index 289e833443f..c3738b87c14 100644 --- a/src/libsystemd-network/dhcp-option.h +++ b/src/libsystemd-network/dhcp-option.h @@ -1,12 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-dhcp-option.h" +#include "sd-dhcp-option.h" /* IWYU pragma: export */ #include "dhcp-protocol.h" -#include "dns-resolver-internal.h" +#include "forward.h" #include "hash-funcs.h" struct sd_dhcp_option { diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c index 6dcfe80672a..46317c997ce 100644 --- a/src/libsystemd-network/dhcp-packet.c +++ b/src/libsystemd-network/dhcp-packet.c @@ -3,8 +3,6 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include -#include #include #include diff --git a/src/libsystemd-network/dhcp-packet.h b/src/libsystemd-network/dhcp-packet.h index 751321b92f6..a7f2e12b4f1 100644 --- a/src/libsystemd-network/dhcp-packet.h +++ b/src/libsystemd-network/dhcp-packet.h @@ -1,10 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - #include "dhcp-protocol.h" +#include "forward.h" int dhcp_message_init( DHCPMessage *message, diff --git a/src/libsystemd-network/dhcp-protocol.h b/src/libsystemd-network/dhcp-protocol.h index b3b247a567e..ca872a80815 100644 --- a/src/libsystemd-network/dhcp-protocol.h +++ b/src/libsystemd-network/dhcp-protocol.h @@ -7,11 +7,10 @@ #include #include -#include #include "sd-dhcp-protocol.h" -#include "macro.h" +#include "forward.h" #include "sparse-endian.h" #include "time-util.h" diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h index 0b2fa965241..1da18cce603 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/dhcp-server-internal.h @@ -5,14 +5,14 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ +#include "sd-dhcp-lease.h" #include "sd-dhcp-server.h" -#include "sd-event.h" #include "dhcp-client-id-internal.h" #include "dhcp-option.h" +#include "forward.h" #include "network-common.h" -#include "ordered-set.h" -#include "time-util.h" +#include "sparse-endian.h" typedef enum DHCPRawOption { DHCP_RAW_OPTION_DATA_UINT8, @@ -25,7 +25,7 @@ typedef enum DHCPRawOption { _DHCP_RAW_OPTION_DATA_INVALID, } DHCPRawOption; -struct sd_dhcp_server { +typedef struct sd_dhcp_server { unsigned n_ref; sd_event *event; @@ -78,7 +78,7 @@ struct sd_dhcp_server { int lease_dir_fd; char *lease_file; -}; +} sd_dhcp_server; typedef struct DHCPRequest { /* received message */ diff --git a/src/libsystemd-network/dhcp-server-lease-internal.h b/src/libsystemd-network/dhcp-server-lease-internal.h index f206e0118f3..4a36df6eadf 100644 --- a/src/libsystemd-network/dhcp-server-lease-internal.h +++ b/src/libsystemd-network/dhcp-server-lease-internal.h @@ -2,11 +2,10 @@ #pragma once #include "sd-dhcp-server-lease.h" -#include "sd-json.h" #include "dhcp-client-id-internal.h" #include "dhcp-server-internal.h" -#include "time-util.h" +#include "forward.h" typedef struct sd_dhcp_server_lease { unsigned n_ref; diff --git a/src/libsystemd-network/dhcp6-client-internal.h b/src/libsystemd-network/dhcp6-client-internal.h index 6c17f5749bc..1a84053735a 100644 --- a/src/libsystemd-network/dhcp6-client-internal.h +++ b/src/libsystemd-network/dhcp6-client-internal.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include "forward.h" #include "sd-dhcp6-client.h" int dhcp6_client_set_state_callback( diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/dhcp6-internal.h index 2ef8dc8690c..5762966c264 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/dhcp6-internal.h @@ -9,19 +9,13 @@ #include #include "sd-dhcp6-client.h" -#include "sd-event.h" #include "dhcp-duid-internal.h" -#include "dhcp6-client-internal.h" #include "dhcp6-option.h" #include "dhcp6-protocol.h" -#include "ether-addr-util.h" -#include "hashmap.h" -#include "macro.h" +#include "forward.h" #include "network-common.h" -#include "ordered-set.h" #include "sparse-endian.h" -#include "time-util.h" /* what to request from the server, addresses (IA_NA) and/or prefixes (IA_PD) */ typedef enum DHCP6RequestIA { diff --git a/src/libsystemd-network/dhcp6-lease-internal.h b/src/libsystemd-network/dhcp6-lease-internal.h index 62c3858841a..ac7fb588eff 100644 --- a/src/libsystemd-network/dhcp6-lease-internal.h +++ b/src/libsystemd-network/dhcp6-lease-internal.h @@ -5,15 +5,11 @@ Copyright © 2014-2015 Intel Corporation. All rights reserved. ***/ -#include - #include "sd-dhcp6-lease.h" #include "dhcp6-option.h" #include "dhcp6-protocol.h" -#include "dns-resolver-internal.h" -#include "macro.h" -#include "set.h" +#include "forward.h" #include "time-util.h" struct sd_dhcp6_lease { diff --git a/src/libsystemd-network/dhcp6-network.c b/src/libsystemd-network/dhcp6-network.c index dbe42531643..b794d8858cb 100644 --- a/src/libsystemd-network/dhcp6-network.c +++ b/src/libsystemd-network/dhcp6-network.c @@ -3,14 +3,9 @@ Copyright © 2014 Intel Corporation. All rights reserved. ***/ -#include -#include #include -#include #include #include -#include -#include #include "dhcp6-internal.h" #include "dhcp6-protocol.h" diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index 2767c6f7fca..1de4bacd1b4 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -3,10 +3,10 @@ Copyright © 2014-2015 Intel Corporation. All rights reserved. ***/ -#include #include #include "sd-dhcp6-client.h" +#include "sd-dhcp6-option.h" #include "alloc-util.h" #include "dhcp6-internal.h" @@ -14,10 +14,11 @@ #include "dhcp6-protocol.h" #include "dns-def.h" #include "dns-domain.h" -#include "errno-util.h" #include "escape.h" #include "memory-util.h" #include "network-common.h" +#include "ordered-set.h" +#include "string-util.h" #include "strv.h" #include "unaligned.h" diff --git a/src/libsystemd-network/dhcp6-option.h b/src/libsystemd-network/dhcp6-option.h index 614b4f8a43d..9deee41ae41 100644 --- a/src/libsystemd-network/dhcp6-option.h +++ b/src/libsystemd-network/dhcp6-option.h @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-dhcp6-client.h" +#include -#include "hash-funcs.h" +#include "sd-dhcp6-option.h" /* IWYU pragma: export */ + +#include "forward.h" #include "list.h" -#include "macro.h" -#include "ordered-set.h" #include "sparse-endian.h" typedef struct sd_dhcp6_option { diff --git a/src/libsystemd-network/dhcp6-protocol.h b/src/libsystemd-network/dhcp6-protocol.h index 39f5040f9d6..75608348cdd 100644 --- a/src/libsystemd-network/dhcp6-protocol.h +++ b/src/libsystemd-network/dhcp6-protocol.h @@ -5,11 +5,7 @@ Copyright © 2014 Intel Corporation. All rights reserved. ***/ -#include -#include -#include - -#include "macro.h" +#include "forward.h" #include "sparse-endian.h" struct DHCP6Message { diff --git a/src/libsystemd-network/dns-resolver-internal.h b/src/libsystemd-network/dns-resolver-internal.h index a02aa05bf21..1ae775096db 100644 --- a/src/libsystemd-network/dns-resolver-internal.h +++ b/src/libsystemd-network/dns-resolver-internal.h @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-dns-resolver.h" -#include "list.h" -#include "macro.h" +#include "forward.h" #include "socket-netlink.h" /* https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml#dns-svcparamkeys */ @@ -30,7 +27,7 @@ const char* format_dns_svc_param_key(uint16_t i, char buf[static DECIMAL_STR_MAX /* Represents a "designated resolver" */ /* typedef struct sd_dns_resolver sd_dns_resolver; */ -struct sd_dns_resolver { +typedef struct sd_dns_resolver { uint16_t priority; char *auth_name; int family; @@ -39,7 +36,7 @@ struct sd_dns_resolver { sd_dns_alpn_flags transports; uint16_t port; char *dohpath; -}; +} sd_dns_resolver; void siphash24_compress_resolver(const sd_dns_resolver *res, struct siphash *state); diff --git a/src/libsystemd-network/fuzz-dhcp-client.c b/src/libsystemd-network/fuzz-dhcp-client.c index 3ed21ee175a..23471f89fce 100644 --- a/src/libsystemd-network/fuzz-dhcp-client.c +++ b/src/libsystemd-network/fuzz-dhcp-client.c @@ -1,13 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include -#include "alloc-util.h" -#include "dhcp-lease-internal.h" #include "dhcp-network.h" -#include "fs-util.h" #include "fuzz.h" #include "network-internal.h" #include "sd-dhcp-client.c" diff --git a/src/libsystemd-network/fuzz-dhcp-server-relay.c b/src/libsystemd-network/fuzz-dhcp-server-relay.c index 3cfcab7e997..62c2d822f24 100644 --- a/src/libsystemd-network/fuzz-dhcp-server-relay.c +++ b/src/libsystemd-network/fuzz-dhcp-server-relay.c @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include #include "fuzz.h" #include "sd-dhcp-server.c" diff --git a/src/libsystemd-network/fuzz-dhcp-server.c b/src/libsystemd-network/fuzz-dhcp-server.c index 3f83aae34d8..47e3c9efa97 100644 --- a/src/libsystemd-network/fuzz-dhcp-server.c +++ b/src/libsystemd-network/fuzz-dhcp-server.c @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include +#include #include "fuzz.h" -#include "path-util.h" #include "rm-rf.h" #include "sd-dhcp-server.c" #include "tmpfile-util.h" diff --git a/src/libsystemd-network/fuzz-dhcp6-client.c b/src/libsystemd-network/fuzz-dhcp6-client.c index 2b6e3357e95..aaa95c2b9dc 100644 --- a/src/libsystemd-network/fuzz-dhcp6-client.c +++ b/src/libsystemd-network/fuzz-dhcp6-client.c @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include "sd-dhcp6-client.h" #include "sd-event.h" #include "dhcp6-internal.h" -#include "event-util.h" #include "fd-util.h" #include "fuzz.h" diff --git a/src/libsystemd-network/fuzz-lldp-rx.c b/src/libsystemd-network/fuzz-lldp-rx.c index 00e6d818094..8567e433ae1 100644 --- a/src/libsystemd-network/fuzz-lldp-rx.c +++ b/src/libsystemd-network/fuzz-lldp-rx.c @@ -1,9 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include #include #include "sd-event.h" +#include "sd-json.h" #include "sd-lldp-rx.h" #include "fd-util.h" diff --git a/src/libsystemd-network/fuzz-ndisc-rs.c b/src/libsystemd-network/fuzz-ndisc-rs.c index e6ee76895f8..0576821666e 100644 --- a/src/libsystemd-network/fuzz-ndisc-rs.c +++ b/src/libsystemd-network/fuzz-ndisc-rs.c @@ -1,20 +1,18 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include +#include "sd-event.h" #include "sd-ndisc.h" #include "sd-radv.h" -#include "alloc-util.h" #include "fd-util.h" #include "fuzz.h" #include "icmp6-packet.h" #include "icmp6-test-util.h" -#include "ndisc-internal.h" +#include "icmp6-util.h" #include "ndisc-option.h" -#include "socket-util.h" +#include "set.h" static void test_with_sd_ndisc(const uint8_t *data, size_t size) { struct ether_addr mac_addr = { diff --git a/src/libsystemd-network/icmp6-packet.c b/src/libsystemd-network/icmp6-packet.c index fe531ba14aa..b4e8e7f8514 100644 --- a/src/libsystemd-network/icmp6-packet.c +++ b/src/libsystemd-network/icmp6-packet.c @@ -6,8 +6,7 @@ #include "icmp6-packet.h" #include "icmp6-util.h" #include "in-addr-util.h" -#include "iovec-util.h" -#include "network-common.h" +#include "log.h" #include "socket-util.h" DEFINE_TRIVIAL_REF_UNREF_FUNC(ICMP6Packet, icmp6_packet, mfree); diff --git a/src/libsystemd-network/icmp6-packet.h b/src/libsystemd-network/icmp6-packet.h index cb961ff641c..3ae33a2039a 100644 --- a/src/libsystemd-network/icmp6-packet.h +++ b/src/libsystemd-network/icmp6-packet.h @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include #include -#include "macro.h" -#include "memory-util.h" +#include "forward.h" #include "time-util.h" typedef struct ICMP6Packet { diff --git a/src/libsystemd-network/icmp6-test-util.c b/src/libsystemd-network/icmp6-test-util.c index 3c781095bc9..761f6a0fb5f 100644 --- a/src/libsystemd-network/icmp6-test-util.c +++ b/src/libsystemd-network/icmp6-test-util.c @@ -1,11 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include +#include #include #include "fd-util.h" #include "icmp6-test-util.h" +#include "icmp6-util.h" +#include "time-util.h" int test_fd[2] = EBADF_PAIR; diff --git a/src/libsystemd-network/icmp6-test-util.h b/src/libsystemd-network/icmp6-test-util.h index d7b0cc84b36..124cab55521 100644 --- a/src/libsystemd-network/icmp6-test-util.h +++ b/src/libsystemd-network/icmp6-test-util.h @@ -1,6 +1,4 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "icmp6-util.h" - extern int test_fd[2]; diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/icmp6-util.c index 58c473c0481..4347f8b723b 100644 --- a/src/libsystemd-network/icmp6-util.c +++ b/src/libsystemd-network/icmp6-util.c @@ -3,21 +3,14 @@ Copyright © 2014 Intel Corporation. All rights reserved. ***/ -#include -#include -#include #include #include -#include #include #include -#include -#include #include "fd-util.h" #include "icmp6-util.h" #include "in-addr-util.h" -#include "iovec-util.h" #include "network-common.h" #include "socket-util.h" diff --git a/src/libsystemd-network/icmp6-util.h b/src/libsystemd-network/icmp6-util.h index 9e5063f51ba..a904564dfe3 100644 --- a/src/libsystemd-network/icmp6-util.h +++ b/src/libsystemd-network/icmp6-util.h @@ -5,12 +5,9 @@ Copyright © 2014-2015 Intel Corporation. All rights reserved. ***/ -#include #include -#include -#include -#include "time-util.h" +#include "forward.h" #define IN6_ADDR_ALL_ROUTERS_MULTICAST \ ((const struct in6_addr) { { { \ diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c index dd2a221403f..e93cf566fa7 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/lldp-neighbor.c @@ -3,12 +3,16 @@ #include "alloc-util.h" #include "escape.h" #include "ether-addr-util.h" +#include "hashmap.h" #include "hexdecoct.h" #include "in-addr-util.h" #include "json-util.h" #include "lldp-neighbor.h" +#include "lldp-rx-internal.h" #include "memory-util.h" #include "missing_network.h" +#include "prioq.h" +#include "siphash24.h" #include "unaligned.h" static void lldp_neighbor_id_hash_func(const LLDPNeighborID *id, struct siphash *state) { diff --git a/src/libsystemd-network/lldp-neighbor.h b/src/libsystemd-network/lldp-neighbor.h index f7945c2edfe..9a2dc7d81d6 100644 --- a/src/libsystemd-network/lldp-neighbor.h +++ b/src/libsystemd-network/lldp-neighbor.h @@ -1,15 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include +#include -#include "sd-json.h" #include "sd-lldp-rx.h" -#include "hash-funcs.h" -#include "lldp-rx-internal.h" +#include "forward.h" +#include "memory-util.h" #include "time-util.h" typedef struct LLDPNeighborID { diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/lldp-network.c index 598669fe20c..38e5ddb691d 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/lldp-network.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include "fd-util.h" #include "lldp-network.h" diff --git a/src/libsystemd-network/lldp-network.h b/src/libsystemd-network/lldp-network.h index bc69b324c2c..b2ae00fb4ac 100644 --- a/src/libsystemd-network/lldp-network.h +++ b/src/libsystemd-network/lldp-network.h @@ -1,6 +1,4 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-event.h" - int lldp_network_bind_raw_socket(int ifindex); diff --git a/src/libsystemd-network/lldp-rx-internal.h b/src/libsystemd-network/lldp-rx-internal.h index 33f0add399b..9c451c183d2 100644 --- a/src/libsystemd-network/lldp-rx-internal.h +++ b/src/libsystemd-network/lldp-rx-internal.h @@ -1,13 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-event.h" -#include "sd-json.h" -#include "sd-lldp-rx.h" +#include + +#include "sd-lldp-rx.h" /* IWYU pragma: export */ -#include "hashmap.h" #include "network-common.h" -#include "prioq.h" +#include "forward.h" struct sd_lldp_rx { unsigned n_ref; diff --git a/src/libsystemd-network/ndisc-internal.h b/src/libsystemd-network/ndisc-internal.h index 4e82fd5a86d..f0488cff8d7 100644 --- a/src/libsystemd-network/ndisc-internal.h +++ b/src/libsystemd-network/ndisc-internal.h @@ -5,8 +5,13 @@ Copyright © 2014 Intel Corporation. All rights reserved. ***/ -#include "sd-ndisc.h" +#include +#include +#include "sd-event.h" +#include "sd-ndisc.h" /* IWYU pragma: export */ + +#include "forward.h" #include "network-common.h" #include "time-util.h" @@ -14,7 +19,7 @@ #define NDISC_MAX_ROUTER_SOLICITATION_INTERVAL (3600U * USEC_PER_SEC) #define NDISC_MAX_ROUTER_SOLICITATIONS 3U -struct sd_ndisc { +typedef struct sd_ndisc { unsigned n_ref; int ifindex; @@ -35,7 +40,7 @@ struct sd_ndisc { sd_ndisc_callback_t callback; void *userdata; -}; +} sd_ndisc; const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_; sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_; diff --git a/src/libsystemd-network/ndisc-neighbor-internal.h b/src/libsystemd-network/ndisc-neighbor-internal.h index aee655665e4..295c093b433 100644 --- a/src/libsystemd-network/ndisc-neighbor-internal.h +++ b/src/libsystemd-network/ndisc-neighbor-internal.h @@ -1,12 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-ndisc.h" +#include -#include "icmp6-packet.h" -#include "set.h" +#include "forward.h" -struct sd_ndisc_neighbor { +typedef struct sd_ndisc_neighbor { unsigned n_ref; ICMP6Packet *packet; @@ -15,7 +14,7 @@ struct sd_ndisc_neighbor { struct in6_addr target_address; Set *options; -}; +} sd_ndisc_neighbor; sd_ndisc_neighbor* ndisc_neighbor_new(ICMP6Packet *packet); int ndisc_neighbor_parse(sd_ndisc *nd, sd_ndisc_neighbor *na); diff --git a/src/libsystemd-network/ndisc-option.c b/src/libsystemd-network/ndisc-option.c index d0f95c896fd..d66f3d235ee 100644 --- a/src/libsystemd-network/ndisc-option.c +++ b/src/libsystemd-network/ndisc-option.c @@ -3,18 +3,24 @@ #include #include +#include "sd-ndisc-protocol.h" + #include "alloc-util.h" #include "dns-def.h" #include "dns-domain.h" #include "dns-resolver-internal.h" #include "ether-addr-util.h" +#include "hash-funcs.h" #include "hostname-util.h" +#include "icmp6-packet.h" #include "icmp6-util.h" #include "in-addr-util.h" #include "iovec-util.h" -#include "missing_network.h" #include "ndisc-option.h" #include "network-common.h" +#include "set.h" +#include "siphash24.h" +#include "string-util.h" #include "strv.h" #include "unaligned.h" @@ -1664,6 +1670,14 @@ int ndisc_parse_options(ICMP6Packet *packet, Set **ret_options) { return 0; } +sd_ndisc_option* ndisc_option_get(Set *options, const sd_ndisc_option *p) { + return set_get(options, ASSERT_PTR(p)); +} + +sd_ndisc_option* ndisc_option_get_by_type(Set *options, uint8_t type) { + return ndisc_option_get(options, &(const sd_ndisc_option) { .type = type }); +} + int ndisc_option_get_mac(Set *options, uint8_t type, struct ether_addr *ret) { assert(IN_SET(type, SD_NDISC_OPTION_SOURCE_LL_ADDRESS, SD_NDISC_OPTION_TARGET_LL_ADDRESS)); @@ -1676,6 +1690,10 @@ int ndisc_option_get_mac(Set *options, uint8_t type, struct ether_addr *ret) { return 0; } +void ndisc_option_remove(Set *options, const sd_ndisc_option *p) { + ndisc_option_free(set_remove(options, ASSERT_PTR(p))); +} + int ndisc_send(int fd, const struct in6_addr *dst, const struct icmp6_hdr *hdr, Set *options, usec_t timestamp) { int r; diff --git a/src/libsystemd-network/ndisc-option.h b/src/libsystemd-network/ndisc-option.h index d9408be79a9..8517f68dfba 100644 --- a/src/libsystemd-network/ndisc-option.h +++ b/src/libsystemd-network/ndisc-option.h @@ -1,19 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include #include -#include -#include #include -#include #include "sd-dns-resolver.h" -#include "sd-ndisc-protocol.h" -#include "icmp6-packet.h" -#include "macro.h" -#include "set.h" #include "time-util.h" typedef struct sd_ndisc_raw { @@ -131,17 +123,11 @@ int ndisc_option_parse( int ndisc_parse_options(ICMP6Packet *p, Set **ret_options); -static inline sd_ndisc_option* ndisc_option_get(Set *options, const sd_ndisc_option *p) { - return set_get(options, ASSERT_PTR(p)); -} -static inline sd_ndisc_option* ndisc_option_get_by_type(Set *options, uint8_t type) { - return ndisc_option_get(options, &(const sd_ndisc_option) { .type = type }); -} +sd_ndisc_option* ndisc_option_get(Set *options, const sd_ndisc_option *p); +sd_ndisc_option* ndisc_option_get_by_type(Set *options, uint8_t type); int ndisc_option_get_mac(Set *options, uint8_t type, struct ether_addr *ret); -static inline void ndisc_option_remove(Set *options, const sd_ndisc_option *p) { - ndisc_option_free(set_remove(options, ASSERT_PTR(p))); -} +void ndisc_option_remove(Set *options, const sd_ndisc_option *p); static inline void ndisc_option_remove_by_type(Set *options, uint8_t type) { ndisc_option_remove(options, &(const sd_ndisc_option) { .type = type }); } diff --git a/src/libsystemd-network/ndisc-redirect-internal.h b/src/libsystemd-network/ndisc-redirect-internal.h index e35263a05dd..77d6f8b88f2 100644 --- a/src/libsystemd-network/ndisc-redirect-internal.h +++ b/src/libsystemd-network/ndisc-redirect-internal.h @@ -1,12 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-ndisc.h" +#include -#include "icmp6-packet.h" -#include "set.h" +#include "forward.h" -struct sd_ndisc_redirect { +typedef struct sd_ndisc_redirect { unsigned n_ref; ICMP6Packet *packet; @@ -15,7 +14,7 @@ struct sd_ndisc_redirect { struct in6_addr destination_address; Set *options; -}; +} sd_ndisc_redirect; sd_ndisc_redirect* ndisc_redirect_new(ICMP6Packet *packet); int ndisc_redirect_parse(sd_ndisc *nd, sd_ndisc_redirect *rd); diff --git a/src/libsystemd-network/ndisc-router-internal.h b/src/libsystemd-network/ndisc-router-internal.h index 6df72fd3cce..025cc146a42 100644 --- a/src/libsystemd-network/ndisc-router-internal.h +++ b/src/libsystemd-network/ndisc-router-internal.h @@ -8,10 +8,10 @@ #include "sd-ndisc.h" #include "icmp6-packet.h" +#include "iterator.h" #include "ndisc-option.h" -#include "time-util.h" -struct sd_ndisc_router { +typedef struct sd_ndisc_router { unsigned n_ref; ICMP6Packet *packet; @@ -28,7 +28,7 @@ struct sd_ndisc_router { Set *options; Iterator iterator; sd_ndisc_option *current_option; -}; +} sd_ndisc_router; sd_ndisc_router* ndisc_router_new(ICMP6Packet *packet); int ndisc_router_parse(sd_ndisc *nd, sd_ndisc_router *rt); diff --git a/src/libsystemd-network/ndisc-router-solicit-internal.h b/src/libsystemd-network/ndisc-router-solicit-internal.h index 6f0b0af13aa..2186238a6fd 100644 --- a/src/libsystemd-network/ndisc-router-solicit-internal.h +++ b/src/libsystemd-network/ndisc-router-solicit-internal.h @@ -1,18 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-radv.h" +#include "forward.h" -#include "icmp6-packet.h" -#include "set.h" - -struct sd_ndisc_router_solicit { +typedef struct sd_ndisc_router_solicit { unsigned n_ref; ICMP6Packet *packet; Set *options; -}; +} sd_ndisc_router_solicit; sd_ndisc_router_solicit* ndisc_router_solicit_new(ICMP6Packet *packet); int ndisc_router_solicit_parse(sd_radv *ra, sd_ndisc_router_solicit *rs); diff --git a/src/libsystemd-network/network-common.h b/src/libsystemd-network/network-common.h index 1750f1810bd..933ce170b7e 100644 --- a/src/libsystemd-network/network-common.h +++ b/src/libsystemd-network/network-common.h @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - +#include "forward.h" #include "log-link.h" #include "sparse-endian.h" #include "time-util.h" diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 1563655b794..e7c22c9b76e 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -1,19 +1,17 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include - -#include "sd-ndisc.h" +#include #include "alloc-util.h" #include "dhcp-lease-internal.h" +#include "dns-resolver-internal.h" #include "extract-word.h" #include "hexdecoct.h" #include "in-addr-util.h" -#include "log.h" #include "network-internal.h" #include "parse-util.h" +#include "string-util.h" #include "strv.h" size_t serialize_in_addrs(FILE *f, diff --git a/src/libsystemd-network/network-internal.h b/src/libsystemd-network/network-internal.h index 6a102e92c47..aace983d5be 100644 --- a/src/libsystemd-network/network-internal.h +++ b/src/libsystemd-network/network-internal.h @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "sd-dhcp-lease.h" +#include "forward.h" size_t serialize_in_addrs(FILE *f, const struct in_addr *addresses, diff --git a/src/libsystemd-network/radv-internal.h b/src/libsystemd-network/radv-internal.h index 5ed7784a850..0e34176e8c0 100644 --- a/src/libsystemd-network/radv-internal.h +++ b/src/libsystemd-network/radv-internal.h @@ -5,14 +5,10 @@ Copyright © 2017 Intel Corporation. All rights reserved. ***/ -#include +#include -#include "sd-radv.h" - -#include "list.h" -#include "ndisc-option.h" +#include "forward.h" #include "network-common.h" -#include "sparse-endian.h" #include "time-util.h" /* RFC 4861 section 6.2.1. diff --git a/src/libsystemd-network/sd-dhcp-client-id.c b/src/libsystemd-network/sd-dhcp-client-id.c index d1280fb6192..77614718d71 100644 --- a/src/libsystemd-network/sd-dhcp-client-id.c +++ b/src/libsystemd-network/sd-dhcp-client-id.c @@ -5,6 +5,8 @@ #include "iovec-util.h" #include "json-util.h" #include "log.h" +#include "siphash24.h" +#include "string-util.h" #include "unaligned.h" #include "utf8.h" diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 56e97475289..2cb60b92ce9 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -3,13 +3,9 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include #include -#include #include #include -#include -#include #include "sd-dhcp-client.h" @@ -22,6 +18,7 @@ #include "dhcp-option.h" #include "dhcp-packet.h" #include "dns-domain.h" +#include "errno-util.h" #include "ether-addr-util.h" #include "event-util.h" #include "fd-util.h" @@ -31,12 +28,12 @@ #include "network-common.h" #include "random-util.h" #include "set.h" +#include "socket-util.h" #include "sort-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" #include "time-util.h" -#include "utf8.h" #include "web-util.h" #define MAX_MAC_ADDR_LEN CONST_MAX(INFINIBAND_ALEN, ETH_ALEN) diff --git a/src/libsystemd-network/sd-dhcp-duid.c b/src/libsystemd-network/sd-dhcp-duid.c index 4782ec62d7a..b0caa10976f 100644 --- a/src/libsystemd-network/sd-dhcp-duid.c +++ b/src/libsystemd-network/sd-dhcp-duid.c @@ -1,15 +1,17 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include +#include +#include "alloc-util.h" #include "dhcp-duid-internal.h" #include "hexdecoct.h" #include "netif-util.h" #include "network-common.h" #include "siphash24.h" #include "string-table.h" +#include "string-util.h" #include "unaligned.h" #define HASH_KEY SD_ID128_MAKE(80,11,8c,c2,fe,4a,03,ee,3e,d6,0c,6f,36,39,14,09) diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 2eb9bf25eef..a98ec7fc63b 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -4,11 +4,7 @@ ***/ #include -#include -#include #include -#include -#include #include "sd-dhcp-lease.h" diff --git a/src/libsystemd-network/sd-dhcp-server-lease.c b/src/libsystemd-network/sd-dhcp-server-lease.c index d9ea5304e85..35a1e7bb185 100644 --- a/src/libsystemd-network/sd-dhcp-server-lease.c +++ b/src/libsystemd-network/sd-dhcp-server-lease.c @@ -1,14 +1,20 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include + +#include "sd-event.h" + #include "alloc-util.h" #include "dhcp-server-lease-internal.h" -#include "dns-def.h" #include "errno-util.h" #include "fd-util.h" #include "fs-util.h" +#include "hashmap.h" +#include "in-addr-util.h" #include "iovec-util.h" #include "json-util.h" #include "mkdir.h" +#include "string-util.h" #include "tmpfile-util.h" static sd_dhcp_server_lease* dhcp_server_lease_free(sd_dhcp_server_lease *lease) { diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 88c51d5458a..af87b152386 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -3,10 +3,8 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include -#include - #include "sd-dhcp-server.h" +#include "sd-event.h" #include "sd-id128.h" #include "alloc-util.h" @@ -16,6 +14,7 @@ #include "dhcp-server-internal.h" #include "dhcp-server-lease-internal.h" #include "dns-domain.h" +#include "errno-util.h" #include "fd-util.h" #include "in-addr-util.h" #include "iovec-util.h" @@ -24,9 +23,9 @@ #include "ordered-set.h" #include "path-util.h" #include "siphash24.h" +#include "socket-util.h" #include "string-util.h" #include "unaligned.h" -#include "utf8.h" #define DHCP_DEFAULT_LEASE_TIME_USEC USEC_PER_HOUR #define DHCP_MAX_LEASE_TIME_USEC (USEC_PER_HOUR*12) diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index b806a7debb0..36585c85543 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -3,27 +3,30 @@ Copyright © 2014-2015 Intel Corporation. All rights reserved. ***/ -#include #include #include -#include #include "sd-dhcp6-client.h" +#include "sd-dhcp6-option.h" #include "alloc-util.h" #include "device-util.h" #include "dhcp-duid-internal.h" +#include "dhcp6-client-internal.h" #include "dhcp6-internal.h" #include "dhcp6-lease-internal.h" #include "dns-domain.h" +#include "errno-util.h" #include "event-util.h" #include "fd-util.h" #include "hostname-util.h" #include "in-addr-util.h" #include "iovec-util.h" +#include "ordered-set.h" #include "random-util.h" #include "socket-util.h" #include "sort-util.h" +#include "string-util.h" #include "strv.h" #include "web-util.h" diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c index 2ff1e87a2e4..4d8df252c87 100644 --- a/src/libsystemd-network/sd-dhcp6-lease.c +++ b/src/libsystemd-network/sd-dhcp6-lease.c @@ -3,14 +3,17 @@ Copyright © 2014-2015 Intel Corporation. All rights reserved. ***/ -#include +#include "sd-dhcp6-option.h" #include "alloc-util.h" #include "dhcp6-internal.h" #include "dhcp6-lease-internal.h" #include "dns-domain.h" +#include "dns-resolver-internal.h" #include "network-common.h" +#include "set.h" #include "sort-util.h" +#include "string-util.h" #include "strv.h" #include "unaligned.h" diff --git a/src/libsystemd-network/sd-dns-resolver.c b/src/libsystemd-network/sd-dns-resolver.c index 673208106c7..e7f69da202b 100644 --- a/src/libsystemd-network/sd-dns-resolver.c +++ b/src/libsystemd-network/sd-dns-resolver.c @@ -3,8 +3,7 @@ #include "alloc-util.h" #include "dns-resolver-internal.h" #include "errno-util.h" -#include "log.h" -#include "macro.h" +#include "siphash24.h" #include "socket-netlink.h" #include "stdio-util.h" #include "string-table.h" diff --git a/src/libsystemd-network/sd-dns-resolver.h b/src/libsystemd-network/sd-dns-resolver.h index 5acd4fe4f68..8a574263ccb 100644 --- a/src/libsystemd-network/sd-dns-resolver.h +++ b/src/libsystemd-network/sd-dns-resolver.h @@ -1,13 +1,10 @@ #ifndef SD_DNS_RESOLVER_H #define SD_DNS_RESOLVER_H -#include -#include -#include -#include - #include "_sd-common.h" +#include "forward.h" + _SD_BEGIN_DECLARATIONS; typedef struct sd_dns_resolver sd_dns_resolver; diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c index 17db4a53f71..87bf46ad296 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/sd-ipv4acd.c @@ -3,16 +3,14 @@ Copyright © 2014 Axis Communications AB. All rights reserved. ***/ -#include -#include #include #include -#include #include "sd-ipv4acd.h" #include "alloc-util.h" #include "arp-util.h" +#include "errno-util.h" #include "ether-addr-util.h" #include "event-util.h" #include "fd-util.h" @@ -20,7 +18,7 @@ #include "memory-util.h" #include "network-common.h" #include "random-util.h" -#include "siphash24.h" +#include "socket-util.h" #include "string-table.h" #include "string-util.h" #include "time-util.h" diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c index 557c145509c..b679d206e6f 100644 --- a/src/libsystemd-network/sd-ipv4ll.c +++ b/src/libsystemd-network/sd-ipv4ll.c @@ -3,11 +3,6 @@ Copyright © 2014 Axis Communications AB. All rights reserved. ***/ -#include -#include -#include -#include - #include "sd-id128.h" #include "sd-ipv4acd.h" #include "sd-ipv4ll.h" @@ -16,10 +11,8 @@ #include "ether-addr-util.h" #include "in-addr-util.h" #include "network-common.h" -#include "random-util.h" #include "siphash24.h" #include "sparse-endian.h" -#include "string-util.h" #define IPV4LL_NETWORK UINT32_C(0xA9FE0000) #define IPV4LL_NETMASK UINT32_C(0xFFFF0000) diff --git a/src/libsystemd-network/sd-lldp-rx.c b/src/libsystemd-network/sd-lldp-rx.c index 029ee0282cf..288ed2ee969 100644 --- a/src/libsystemd-network/sd-lldp-rx.c +++ b/src/libsystemd-network/sd-lldp-rx.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include @@ -8,17 +7,21 @@ #include "sd-lldp-rx.h" #include "alloc-util.h" +#include "errno-util.h" #include "ether-addr-util.h" #include "event-util.h" #include "fd-util.h" +#include "hashmap.h" #include "lldp-neighbor.h" #include "lldp-network.h" #include "lldp-rx-internal.h" #include "memory-util.h" #include "network-common.h" +#include "prioq.h" #include "socket-util.h" #include "sort-util.h" #include "string-table.h" +#include "string-util.h" #define LLDP_DEFAULT_NEIGHBORS_MAX 128U diff --git a/src/libsystemd-network/sd-lldp-tx.c b/src/libsystemd-network/sd-lldp-tx.c index 38a619168ee..9e93a77cd1d 100644 --- a/src/libsystemd-network/sd-lldp-tx.c +++ b/src/libsystemd-network/sd-lldp-tx.c @@ -1,9 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include - #include "sd-event.h" #include "sd-id128.h" #include "sd-lldp-tx.h" diff --git a/src/libsystemd-network/sd-ndisc-neighbor.c b/src/libsystemd-network/sd-ndisc-neighbor.c index 1bb6ebf610b..5ce1da06da3 100644 --- a/src/libsystemd-network/sd-ndisc-neighbor.c +++ b/src/libsystemd-network/sd-ndisc-neighbor.c @@ -5,10 +5,12 @@ #include "sd-ndisc.h" #include "alloc-util.h" +#include "icmp6-packet.h" #include "in-addr-util.h" #include "ndisc-internal.h" #include "ndisc-neighbor-internal.h" #include "ndisc-option.h" +#include "set.h" static sd_ndisc_neighbor* ndisc_neighbor_free(sd_ndisc_neighbor *na) { if (!na) diff --git a/src/libsystemd-network/sd-ndisc-redirect.c b/src/libsystemd-network/sd-ndisc-redirect.c index a1fceb2dff3..1637ad36a22 100644 --- a/src/libsystemd-network/sd-ndisc-redirect.c +++ b/src/libsystemd-network/sd-ndisc-redirect.c @@ -5,10 +5,12 @@ #include "sd-ndisc.h" #include "alloc-util.h" +#include "icmp6-packet.h" #include "in-addr-util.h" #include "ndisc-internal.h" #include "ndisc-option.h" #include "ndisc-redirect-internal.h" +#include "set.h" static sd_ndisc_redirect* ndisc_redirect_free(sd_ndisc_redirect *rd) { if (!rd) diff --git a/src/libsystemd-network/sd-ndisc-router-solicit.c b/src/libsystemd-network/sd-ndisc-router-solicit.c index 742ec9a1d2a..ccd14be3cb9 100644 --- a/src/libsystemd-network/sd-ndisc-router-solicit.c +++ b/src/libsystemd-network/sd-ndisc-router-solicit.c @@ -2,13 +2,16 @@ #include +#include "sd-ndisc-protocol.h" +#include "sd-ndisc-router-solicit.h" #include "sd-radv.h" #include "alloc-util.h" -#include "in-addr-util.h" +#include "icmp6-packet.h" #include "ndisc-option.h" #include "ndisc-router-solicit-internal.h" #include "radv-internal.h" +#include "set.h" static sd_ndisc_router_solicit* ndisc_router_solicit_free(sd_ndisc_router_solicit *rs) { if (!rs) diff --git a/src/libsystemd-network/sd-ndisc-router.c b/src/libsystemd-network/sd-ndisc-router.c index 6936ea34e24..69fab9f6d0b 100644 --- a/src/libsystemd-network/sd-ndisc-router.c +++ b/src/libsystemd-network/sd-ndisc-router.c @@ -8,12 +8,11 @@ #include "sd-ndisc.h" #include "alloc-util.h" -#include "dns-domain.h" -#include "dns-resolver-internal.h" #include "ndisc-internal.h" #include "ndisc-router-internal.h" +#include "set.h" #include "string-table.h" -#include "unaligned.h" +#include "string-util.h" static sd_ndisc_router* ndisc_router_free(sd_ndisc_router *rt) { if (!rt) diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index ca15f942f56..0f2f94eab60 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -21,6 +21,7 @@ #include "ndisc-router-internal.h" #include "network-common.h" #include "random-util.h" +#include "set.h" #include "socket-util.h" #include "string-table.h" #include "string-util.h" diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index 48a198099dc..02d6131e8a4 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -3,31 +3,29 @@ Copyright © 2017 Intel Corporation. All rights reserved. ***/ -#include #include #include #include +#include "sd-ndisc-protocol.h" +#include "sd-ndisc-router-solicit.h" #include "sd-radv.h" #include "alloc-util.h" -#include "dns-domain.h" -#include "ether-addr-util.h" #include "event-util.h" #include "fd-util.h" +#include "icmp6-packet.h" #include "icmp6-util.h" #include "in-addr-util.h" -#include "iovec-util.h" -#include "macro.h" #include "memory-util.h" +#include "ndisc-option.h" #include "ndisc-router-solicit-internal.h" #include "network-common.h" #include "radv-internal.h" #include "random-util.h" +#include "set.h" #include "socket-util.h" #include "string-util.h" -#include "strv.h" -#include "unaligned.h" int sd_radv_new(sd_radv **ret) { _cleanup_(sd_radv_unrefp) sd_radv *ra = NULL; diff --git a/src/libsystemd-network/test-acd.c b/src/libsystemd-network/test-acd.c index c00e87605ab..e85a9d267a0 100644 --- a/src/libsystemd-network/test-acd.c +++ b/src/libsystemd-network/test-acd.c @@ -1,10 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include -#include +#include #include "sd-event.h" #include "sd-ipv4acd.h" diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c index fe2a88d8f3c..72d8ad4d0cf 100644 --- a/src/libsystemd-network/test-dhcp-client.c +++ b/src/libsystemd-network/test-dhcp-client.c @@ -3,10 +3,9 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include -#include #include #include +#include #include #include #if HAVE_VALGRIND_VALGRIND_H @@ -14,6 +13,7 @@ #endif #include "sd-dhcp-client.h" +#include "sd-dhcp-lease.h" #include "sd-event.h" #include "alloc-util.h" @@ -24,7 +24,6 @@ #include "ether-addr-util.h" #include "fd-util.h" #include "log.h" -#include "random-util.h" #include "tests.h" static struct hw_addr_data hw_addr = { diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test-dhcp-option.c index 2a07256ea03..9e36e038599 100644 --- a/src/libsystemd-network/test-dhcp-option.c +++ b/src/libsystemd-network/test-dhcp-option.c @@ -1,17 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include #include #include #include "alloc-util.h" #include "dhcp-option.h" #include "dhcp-packet.h" -#include "ether-addr-util.h" -#include "log.h" -#include "macro.h" #include "memory-util.h" #include "tests.h" diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test-dhcp-server.c index a067fc0da59..61189fe5452 100644 --- a/src/libsystemd-network/test-dhcp-server.c +++ b/src/libsystemd-network/test-dhcp-server.c @@ -3,13 +3,14 @@ Copyright © 2013 Intel Corporation. All rights reserved. ***/ -#include #include #include "sd-dhcp-server.h" #include "sd-event.h" #include "dhcp-server-internal.h" +#include "hashmap.h" +#include "siphash24.h" #include "tests.h" static void test_pool(struct in_addr *address, unsigned size, int ret) { diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index 195aa145949..0775209e021 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -5,23 +5,20 @@ #include #include -#include #include -#include +#include #include #include "sd-dhcp6-client.h" +#include "sd-dhcp6-protocol.h" #include "sd-event.h" -#include "dhcp-duid-internal.h" #include "dhcp6-internal.h" #include "dhcp6-lease-internal.h" #include "dhcp6-protocol.h" #include "fd-util.h" -#include "macro.h" +#include "in-addr-util.h" #include "memory-util.h" -#include "socket-util.h" -#include "string-util.h" #include "strv.h" #include "tests.h" #include "time-util.h" diff --git a/src/libsystemd-network/test-ipv4ll-manual.c b/src/libsystemd-network/test-ipv4ll-manual.c index 1fc6d11b88f..97f54087020 100644 --- a/src/libsystemd-network/test-ipv4ll-manual.c +++ b/src/libsystemd-network/test-ipv4ll-manual.c @@ -1,16 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include -#include +#include #include "sd-event.h" #include "sd-ipv4ll.h" #include "sd-netlink.h" -#include "alloc-util.h" #include "in-addr-util.h" #include "log.h" #include "parse-util.h" diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test-ipv4ll.c index 17c981307b6..a26000d5f19 100644 --- a/src/libsystemd-network/test-ipv4ll.c +++ b/src/libsystemd-network/test-ipv4ll.c @@ -3,19 +3,15 @@ Copyright © 2014 Axis Communications AB. All rights reserved. ***/ -#include #include #include -#include -#include -#include +#include "sd-event.h" #include "sd-ipv4ll.h" #include "arp-util.h" #include "fd-util.h" -#include "log.h" -#include "socket-util.h" +#include "in-addr-util.h" #include "tests.h" static bool verbose = false; diff --git a/src/libsystemd-network/test-lldp-rx.c b/src/libsystemd-network/test-lldp-rx.c index 704c9a00153..7f497a4de43 100644 --- a/src/libsystemd-network/test-lldp-rx.c +++ b/src/libsystemd-network/test-lldp-rx.c @@ -1,20 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include +#include #include +#include #include #include "sd-event.h" #include "sd-lldp-rx.h" -#include "alloc-util.h" #include "fd-util.h" #include "lldp-network.h" -#include "log.h" -#include "macro.h" -#include "string-util.h" #include "tests.h" #define TEST_LLDP_PORT "em1" diff --git a/src/libsystemd-network/test-ndisc-ra.c b/src/libsystemd-network/test-ndisc-ra.c index cc7007f15a2..84dc73e84fa 100644 --- a/src/libsystemd-network/test-ndisc-ra.c +++ b/src/libsystemd-network/test-ndisc-ra.c @@ -3,18 +3,19 @@ Copyright © 2017 Intel Corporation. All rights reserved. ***/ -#include +#include #include #include +#include "sd-event.h" +#include "sd-ndisc-protocol.h" #include "sd-radv.h" #include "alloc-util.h" -#include "hexdecoct.h" #include "icmp6-test-util.h" +#include "in-addr-util.h" #include "radv-internal.h" #include "socket-util.h" -#include "strv.h" #include "tests.h" static struct ether_addr mac_addr = { diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index effed116154..71af4c24788 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -3,7 +3,6 @@ Copyright © 2014 Intel Corporation. All rights reserved. ***/ -#include #include #include @@ -14,8 +13,8 @@ #include "hexdecoct.h" #include "icmp6-packet.h" #include "icmp6-test-util.h" +#include "in-addr-util.h" #include "ndisc-internal.h" -#include "socket-util.h" #include "strv.h" #include "tests.h" diff --git a/src/libsystemd-network/test-ndisc-send.c b/src/libsystemd-network/test-ndisc-send.c index 52bd9fa637e..2b40ea77a3c 100644 --- a/src/libsystemd-network/test-ndisc-send.c +++ b/src/libsystemd-network/test-ndisc-send.c @@ -1,6 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include + +#include "sd-ndisc-protocol.h" +#include "sd-netlink.h" #include "alloc-util.h" #include "build.h" @@ -14,7 +18,8 @@ #include "netlink-util.h" #include "network-common.h" #include "parse-util.h" -#include "socket-util.h" +#include "set.h" +#include "string-util.h" #include "strv.h" #include "time-util.h" diff --git a/src/libsystemd-network/test-sd-dhcp-lease.c b/src/libsystemd-network/test-sd-dhcp-lease.c index 5bb0b39180e..32f9a6b9a34 100644 --- a/src/libsystemd-network/test-sd-dhcp-lease.c +++ b/src/libsystemd-network/test-sd-dhcp-lease.c @@ -1,11 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "dhcp-lease-internal.h" -#include "log.h" -#include "macro.h" -#include "string-util.h" #include "strv.h" #include "tests.h" diff --git a/src/libsystemd/sd-bus/bus-common-errors.c b/src/libsystemd/sd-bus/bus-common-errors.c index 1075c29ed64..812e75a3023 100644 --- a/src/libsystemd/sd-bus/bus-common-errors.c +++ b/src/libsystemd/sd-bus/bus-common-errors.c @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "sd-bus.h" #include "bus-common-errors.h" diff --git a/src/libsystemd/sd-bus/bus-container.c b/src/libsystemd/sd-bus/bus-container.c index 54da4169a67..73e86bb78c8 100644 --- a/src/libsystemd/sd-bus/bus-container.c +++ b/src/libsystemd/sd-bus/bus-container.c @@ -7,6 +7,7 @@ #include "bus-internal.h" #include "bus-socket.h" #include "fd-util.h" +#include "format-util.h" #include "log.h" #include "namespace-util.h" #include "process-util.h" diff --git a/src/libsystemd/sd-bus/bus-container.h b/src/libsystemd/sd-bus/bus-container.h index cb503a59705..bca37304c01 100644 --- a/src/libsystemd/sd-bus/bus-container.h +++ b/src/libsystemd/sd-bus/bus-container.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" +#include "forward.h" int bus_container_connect_socket(sd_bus *b); diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index fdcd5ff2da6..daa700ebf50 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -1,23 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#if HAVE_VALGRIND_MEMCHECK_H -#include -#endif - -#include -#include - #include "sd-bus.h" #include "alloc-util.h" #include "bus-control.h" #include "bus-internal.h" #include "bus-message.h" -#include "capability-util.h" #include "fd-util.h" #include "log.h" +#include "pidref.h" #include "process-util.h" -#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "user-util.h" diff --git a/src/libsystemd/sd-bus/bus-control.h b/src/libsystemd/sd-bus/bus-control.h index 1cd4fb88d96..56b4a70cdaa 100644 --- a/src/libsystemd/sd-bus/bus-control.h +++ b/src/libsystemd/sd-bus/bus-control.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" +#include "forward.h" int bus_add_match_internal(sd_bus *bus, const char *match, uint64_t timeout_usec, uint64_t *ret_counter); int bus_add_match_internal_async(sd_bus *bus, sd_bus_slot **ret, const char *match, sd_bus_message_handler_t callback, void *userdata, uint64_t timeout_usec); diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c index b59338a5d14..034ee49f00f 100644 --- a/src/libsystemd/sd-bus/bus-convenience.c +++ b/src/libsystemd/sd-bus/bus-convenience.c @@ -1,14 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include "alloc-util.h" +#include "sd-bus.h" + #include "bus-internal.h" #include "bus-message.h" #include "bus-signature.h" #include "bus-type.h" -#include "log.h" #include "string-util.h" _public_ int sd_bus_message_send(sd_bus_message *reply) { diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index 9e93712bfd6..700e7d24a9e 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include + +#include "sd-bus.h" #include "alloc-util.h" #include "audit-util.h" @@ -17,6 +18,7 @@ #include "hexdecoct.h" #include "nulstr-util.h" #include "parse-util.h" +#include "pidref.h" #include "process-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h index d7ad1dc96b3..089442e8857 100644 --- a/src/libsystemd/sd-bus/bus-creds.h +++ b/src/libsystemd/sd-bus/bus-creds.h @@ -1,14 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include +#include "forward.h" -#include "sd-bus.h" - -#include "pidref.h" -#include "user-util.h" - -struct sd_bus_creds { +typedef struct sd_bus_creds { bool allocated; unsigned n_ref; @@ -65,7 +60,7 @@ struct sd_bus_creds { char *cgroup_root; char *description, *unescaped_description; -}; +} sd_bus_creds; #define SD_BUS_CREDS_INIT_FIELDS \ .uid = UID_INVALID, \ diff --git a/src/libsystemd/sd-bus/bus-dump-json.c b/src/libsystemd/sd-bus/bus-dump-json.c index d753f50a0cd..b6fc5f598f7 100644 --- a/src/libsystemd/sd-bus/bus-dump-json.c +++ b/src/libsystemd/sd-bus/bus-dump-json.c @@ -6,8 +6,7 @@ #include "bus-internal.h" #include "bus-message.h" #include "json-util.h" -#include "macro.h" -#include "memory-util.h" +#include "string-util.h" #include "time-util.h" static int json_transform_one(sd_bus_message *m, sd_json_variant **ret); diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 07df7d7d34c..d71274968c3 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include "sd-bus.h" #include "alloc-util.h" #include "ansi-color.h" @@ -14,11 +14,10 @@ #include "format-util.h" #include "glyph-util.h" #include "log.h" -#include "macro.h" #include "pcapng.h" #include "string-util.h" #include "strv.h" -#include "terminal-util.h" +#include "time-util.h" static char* indent(unsigned level, uint64_t flags) { if (FLAGS_SET(flags, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY) && level > 0) diff --git a/src/libsystemd/sd-bus/bus-dump.h b/src/libsystemd/sd-bus/bus-dump.h index e7470ba6817..ba38da16861 100644 --- a/src/libsystemd/sd-bus/bus-dump.h +++ b/src/libsystemd/sd-bus/bus-dump.h @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "sd-bus.h" +#include "forward.h" int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse); diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index 9b812dd36c1..b61df06632d 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -1,20 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include -#include - #include "sd-bus.h" #include "alloc-util.h" #include "bus-error.h" #include "errno-list.h" #include "errno-util.h" -#include "log.h" #include "string-util.h" -#include "strv.h" BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { SD_BUS_ERROR_MAP(SD_BUS_ERROR_FAILED, EACCES), @@ -592,7 +584,7 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static if (e && e->message) return e->message; - return strerror_r(abs(error), buf, ERRNO_BUF_LEN); + return strerror_r(ABS(error), buf, ERRNO_BUF_LEN); } static bool map_ok(const sd_bus_error_map *map) { diff --git a/src/libsystemd/sd-bus/bus-error.h b/src/libsystemd/sd-bus/bus-error.h index c8768c9a7b6..3757fe7c279 100644 --- a/src/libsystemd/sd-bus/bus-error.h +++ b/src/libsystemd/sd-bus/bus-error.h @@ -1,12 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" +#include "sd-bus-protocol.h" #include "errno-util.h" -#include "macro.h" +#include "forward.h" bool bus_error_is_dirty(sd_bus_error *e); diff --git a/src/libsystemd/sd-bus/bus-internal.c b/src/libsystemd/sd-bus/bus-internal.c index 6a448c797fe..ffb99bd8248 100644 --- a/src/libsystemd/sd-bus/bus-internal.c +++ b/src/libsystemd/sd-bus/bus-internal.c @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + #include "alloc-util.h" +#include "bus-error.h" #include "bus-internal.h" #include "bus-message.h" #include "escape.h" diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h index 25fe4bd9564..e9052b76b31 100644 --- a/src/libsystemd/sd-bus/bus-internal.h +++ b/src/libsystemd/sd-bus/bus-internal.h @@ -1,20 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include +#include "sd-id128.h" -#include "sd-bus.h" - -#include "bus-error.h" #include "bus-kernel.h" #include "bus-match.h" #include "constants.h" -#include "hashmap.h" +#include "forward.h" #include "list.h" -#include "prioq.h" #include "runtime-scope.h" #include "socket-util.h" -#include "time-util.h" /* Note that we use the new /run prefix here (instead of /var/run) since we require them to be aliases and * that way we become independent of /var being mounted */ @@ -126,7 +121,7 @@ typedef enum BusSlotType { _BUS_SLOT_INVALID = -EINVAL, } BusSlotType; -struct sd_bus_slot { +typedef struct sd_bus_slot { unsigned n_ref; BusSlotType type:8; @@ -157,7 +152,7 @@ struct sd_bus_slot { struct node_object_manager node_object_manager; struct node_vtable node_vtable; }; -}; +} sd_bus_slot; enum bus_state { BUS_UNSET, @@ -181,7 +176,7 @@ enum bus_auth { BUS_AUTH_ANONYMOUS }; -struct sd_bus { +typedef struct sd_bus { unsigned n_ref; enum bus_state state; @@ -327,7 +322,7 @@ struct sd_bus { /* zero means use value specified by $SYSTEMD_BUS_TIMEOUT= environment variable or built-in default */ usec_t method_call_timeout; -}; +} sd_bus; /* For method calls we timeout at 25s, like in the D-Bus reference implementation */ #define BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC)) diff --git a/src/libsystemd/sd-bus/bus-introspect.c b/src/libsystemd/sd-bus/bus-introspect.c index 4c3914ff960..2bbc9329393 100644 --- a/src/libsystemd/sd-bus/bus-introspect.c +++ b/src/libsystemd/sd-bus/bus-introspect.c @@ -1,15 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include + +#include "sd-bus-vtable.h" + #include "bus-internal.h" #include "bus-introspect.h" #include "bus-objects.h" -#include "bus-protocol.h" #include "bus-signature.h" -#include "fd-util.h" -#include "fileio.h" -#include "log.h" -#include "memory-util.h" #include "memstream-util.h" +#include "ordered-set.h" #include "string-util.h" #define BUS_INTROSPECT_DOCTYPE \ diff --git a/src/libsystemd/sd-bus/bus-introspect.h b/src/libsystemd/sd-bus/bus-introspect.h index 83bcfb2dadb..f9d87c499b6 100644 --- a/src/libsystemd/sd-bus/bus-introspect.h +++ b/src/libsystemd/sd-bus/bus-introspect.h @@ -1,12 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" - +#include "forward.h" #include "memstream-util.h" -#include "ordered-set.h" struct introspect { MemStream m; diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index b726957c767..90fc60afbde 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1,31 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#if HAVE_VALGRIND_MEMCHECK_H -#include -#endif - -#include -#include #include -#include -#include "alloc-util.h" -#include "bus-internal.h" #include "bus-kernel.h" -#include "bus-label.h" -#include "bus-message.h" -#include "capability-util.h" +#include "bus-internal.h" #include "fd-util.h" -#include "fileio.h" -#include "format-util.h" -#include "log.h" -#include "memfd-util.h" #include "memory-util.h" -#include "parse-util.h" -#include "stdio-util.h" -#include "string-util.h" -#include "strv.h" -#include "user-util.h" void close_and_munmap(int fd, void *address, size_t size) { if (size > 0) { diff --git a/src/libsystemd/sd-bus/bus-kernel.h b/src/libsystemd/sd-bus/bus-kernel.h index be8e0ceb9b6..c364f62a8dc 100644 --- a/src/libsystemd/sd-bus/bus-kernel.h +++ b/src/libsystemd/sd-bus/bus-kernel.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" +#include "forward.h" #define MEMFD_CACHE_MAX 32 diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index a07d9d05216..fc05f385e86 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -1,15 +1,16 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + #include "alloc-util.h" #include "bus-internal.h" #include "bus-match.h" #include "bus-message.h" -#include "fd-util.h" -#include "fileio.h" +#include "hashmap.h" #include "hexdecoct.h" -#include "log.h" #include "memstream-util.h" #include "sort-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd/sd-bus/bus-match.h b/src/libsystemd/sd-bus/bus-match.h index 138123c70b9..622e00d94c6 100644 --- a/src/libsystemd/sd-bus/bus-match.h +++ b/src/libsystemd/sd-bus/bus-match.h @@ -1,11 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" - -#include "hashmap.h" +#include "forward.h" enum bus_match_node_type { BUS_MATCH_ROOT, diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 8eff8781ab2..6636285526c 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include "sd-bus.h" @@ -18,7 +16,6 @@ #include "memory-util.h" #include "string-util.h" #include "strv.h" -#include "time-util.h" #include "utf8.h" static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index 76f0d853d36..0f1cc8f33e5 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -2,15 +2,14 @@ #pragma once #include -#include -#include +#include -#include "sd-bus.h" +#include "sd-bus-protocol.h" #include "bus-creds.h" #include "bus-protocol.h" -#include "macro.h" -#include "time-util.h" +#include "forward.h" +#include "memory-util.h" struct bus_container { char enclosing; @@ -42,7 +41,7 @@ struct bus_body_part { bool is_zero:1; }; -struct sd_bus_message { +typedef struct sd_bus_message { /* Caveat: a message can be referenced in two different ways: the main (user-facing) way will also * pin the bus connection object the message is associated with. The secondary way ("queued") is used * when a message is in the read or write queues of the bus connection object, which will not pin the @@ -119,7 +118,7 @@ struct sd_bus_message { unsigned n_header_offsets; uint64_t read_counter; -}; +} sd_bus_message; static inline bool BUS_MESSAGE_NEED_BSWAP(sd_bus_message *m) { return m->header->endian != BUS_NATIVE_ENDIAN; diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index e7ec43a19d9..3e827770c84 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -2,6 +2,8 @@ #include +#include "sd-bus.h" + #include "alloc-util.h" #include "bus-internal.h" #include "bus-introspect.h" @@ -10,7 +12,7 @@ #include "bus-signature.h" #include "bus-slot.h" #include "bus-type.h" -#include "log.h" +#include "ordered-set.h" #include "set.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd/sd-bus/bus-objects.h b/src/libsystemd/sd-bus/bus-objects.h index 20fccfa1d86..51bfa70ae5e 100644 --- a/src/libsystemd/sd-bus/bus-objects.h +++ b/src/libsystemd/sd-bus/bus-objects.h @@ -1,8 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "bus-internal.h" -#include "bus-introspect.h" +#include "forward.h" + +struct node; const sd_bus_vtable* bus_vtable_next(const sd_bus_vtable *vtable, const sd_bus_vtable *v); bool bus_vtable_has_names(const sd_bus_vtable *vtable); diff --git a/src/libsystemd/sd-bus/bus-protocol.h b/src/libsystemd/sd-bus/bus-protocol.h index be46b5f6a73..92e251727c1 100644 --- a/src/libsystemd/sd-bus/bus-protocol.h +++ b/src/libsystemd/sd-bus/bus-protocol.h @@ -3,7 +3,7 @@ #include -#include "macro.h" +#include "forward.h" /* Packet header */ diff --git a/src/libsystemd/sd-bus/bus-signature.c b/src/libsystemd/sd-bus/bus-signature.c index 16693bcad6b..d2f202067bd 100644 --- a/src/libsystemd/sd-bus/bus-signature.c +++ b/src/libsystemd/sd-bus/bus-signature.c @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "sd-bus.h" +#include "sd-bus-protocol.h" -#include "assert-util.h" #include "bus-signature.h" #include "bus-type.h" diff --git a/src/libsystemd/sd-bus/bus-signature.h b/src/libsystemd/sd-bus/bus-signature.h index 0fea7507447..b75df7335d4 100644 --- a/src/libsystemd/sd-bus/bus-signature.h +++ b/src/libsystemd/sd-bus/bus-signature.h @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include +#include "forward.h" bool signature_is_single(const char *s, bool allow_dict_entry); bool signature_is_pair(const char *s); diff --git a/src/libsystemd/sd-bus/bus-slot.c b/src/libsystemd/sd-bus/bus-slot.c index ed9da966383..3b6debadb03 100644 --- a/src/libsystemd/sd-bus/bus-slot.c +++ b/src/libsystemd/sd-bus/bus-slot.c @@ -6,7 +6,7 @@ #include "bus-control.h" #include "bus-objects.h" #include "bus-slot.h" -#include "log.h" +#include "prioq.h" #include "set.h" #include "string-util.h" diff --git a/src/libsystemd/sd-bus/bus-slot.h b/src/libsystemd/sd-bus/bus-slot.h index 8116195d4dd..5bd3b081eac 100644 --- a/src/libsystemd/sd-bus/bus-slot.h +++ b/src/libsystemd/sd-bus/bus-slot.h @@ -1,9 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" - #include "bus-internal.h" +#include "forward.h" sd_bus_slot *bus_slot_allocate(sd_bus *bus, bool floating, BusSlotType type, size_t extra, void *userdata); diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index 7271c68971d..9d911aaaa61 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -1,8 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include #include #include +#include #include #include "sd-bus.h" @@ -12,22 +14,21 @@ #include "bus-internal.h" #include "bus-message.h" #include "bus-socket.h" +#include "errno-util.h" #include "escape.h" #include "fd-util.h" -#include "format-util.h" #include "fs-util.h" #include "hexdecoct.h" #include "io-util.h" #include "iovec-util.h" #include "log.h" -#include "macro.h" #include "memory-util.h" #include "path-util.h" #include "process-util.h" #include "random-util.h" -#include "signal-util.h" #include "stdio-util.h" #include "string-util.h" +#include "time-util.h" #include "user-util.h" #include "utf8.h" diff --git a/src/libsystemd/sd-bus/bus-socket.h b/src/libsystemd/sd-bus/bus-socket.h index fc8c1eda09a..1c1d3561eee 100644 --- a/src/libsystemd/sd-bus/bus-socket.h +++ b/src/libsystemd/sd-bus/bus-socket.h @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" +#include "forward.h" void bus_socket_setup(sd_bus *b); diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c index 3c3e0c18ec5..9e5b5e96206 100644 --- a/src/libsystemd/sd-bus/bus-track.c +++ b/src/libsystemd/sd-bus/bus-track.c @@ -5,6 +5,7 @@ #include "alloc-util.h" #include "bus-internal.h" #include "bus-track.h" +#include "hashmap.h" #include "log.h" #include "string-util.h" diff --git a/src/libsystemd/sd-bus/bus-track.h b/src/libsystemd/sd-bus/bus-track.h index 6868cda1e2c..0ecd42e6d37 100644 --- a/src/libsystemd/sd-bus/bus-track.h +++ b/src/libsystemd/sd-bus/bus-track.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -typedef struct sd_bus_track sd_bus_track; +#include "forward.h" void bus_track_dispatch(sd_bus_track *track); void bus_track_close(sd_bus_track *track); diff --git a/src/libsystemd/sd-bus/bus-type.c b/src/libsystemd/sd-bus/bus-type.c index d1fc836dde3..91b76b4c026 100644 --- a/src/libsystemd/sd-bus/bus-type.c +++ b/src/libsystemd/sd-bus/bus-type.c @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "sd-bus.h" #include "bus-internal.h" #include "bus-type.h" -#include "log.h" bool bus_type_is_valid(char c) { static const char valid[] = { diff --git a/src/libsystemd/sd-bus/bus-type.h b/src/libsystemd/sd-bus/bus-type.h index 490108a2c64..0e851b0249e 100644 --- a/src/libsystemd/sd-bus/bus-type.h +++ b/src/libsystemd/sd-bus/bus-type.h @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "macro.h" +#include "forward.h" bool bus_type_is_valid(char c) _const_; bool bus_type_is_basic(char c) _const_; diff --git a/src/libsystemd/sd-bus/fuzz-bus-match.c b/src/libsystemd/sd-bus/fuzz-bus-match.c index 16da534245e..e6e3dd97d0f 100644 --- a/src/libsystemd/sd-bus/fuzz-bus-match.c +++ b/src/libsystemd/sd-bus/fuzz-bus-match.c @@ -1,11 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + #include "alloc-util.h" #include "bus-internal.h" #include "bus-match.h" #include "env-util.h" -#include "fd-util.h" -#include "fileio.h" #include "fuzz.h" #include "memstream-util.h" diff --git a/src/libsystemd/sd-bus/fuzz-bus-message.c b/src/libsystemd/sd-bus/fuzz-bus-message.c index e369f532c91..e2c4167f3c9 100644 --- a/src/libsystemd/sd-bus/fuzz-bus-message.c +++ b/src/libsystemd/sd-bus/fuzz-bus-message.c @@ -1,11 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + #include "alloc-util.h" -#include "bus-dump.h" #include "bus-message.h" #include "env-util.h" -#include "fd-util.h" -#include "fileio.h" #include "fuzz.h" #include "memstream-util.h" diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index b0d0b0e1d14..c13a8982121 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1,22 +1,21 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include +#include #include -#include #include -#include #include -#include #include #include #include "sd-bus.h" +#include "sd-event.h" #include "af-list.h" #include "alloc-util.h" #include "bus-container.h" #include "bus-control.h" +#include "bus-error.h" #include "bus-internal.h" #include "bus-kernel.h" #include "bus-label.h" @@ -28,7 +27,6 @@ #include "bus-track.h" #include "bus-type.h" #include "cgroup-util.h" -#include "constants.h" #include "errno-util.h" #include "fd-util.h" #include "format-util.h" @@ -38,16 +36,16 @@ #include "io-util.h" #include "log.h" #include "log-context.h" -#include "macro.h" #include "memory-util.h" -#include "missing_syscall.h" #include "origin-id.h" #include "parse-util.h" #include "path-util.h" +#include "prioq.h" #include "process-util.h" -#include "stdio-util.h" +#include "set.h" #include "string-util.h" #include "strv.h" +#include "time-util.h" #include "user-util.h" #define log_debug_bus_message(m) \ diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c index 78ae564aeb1..4063d79159a 100644 --- a/src/libsystemd/sd-bus/test-bus-benchmark.c +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c @@ -1,5 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include +#include +#include #include #include #include @@ -8,10 +11,7 @@ #include "alloc-util.h" #include "bus-internal.h" -#include "bus-kernel.h" -#include "constants.h" #include "fd-util.h" -#include "string-util.h" #include "tests.h" #include "time-util.h" diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index d06853b22c0..df1be5ceca3 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -2,7 +2,6 @@ #include #include -#include #include #include "sd-bus.h" @@ -15,9 +14,9 @@ #include "fd-util.h" #include "format-util.h" #include "log.h" -#include "macro.h" #include "string-util.h" #include "tests.h" +#include "time-util.h" static int match_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { log_info("Match triggered! destination=%s interface=%s member=%s", diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c index b569986a946..7c9899e129f 100644 --- a/src/libsystemd/sd-bus/test-bus-cleanup.c +++ b/src/libsystemd/sd-bus/test-bus-cleanup.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include "sd-bus.h" diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c index 31b04002b59..d52683ea87e 100644 --- a/src/libsystemd/sd-bus/test-bus-marshal.c +++ b/src/libsystemd/sd-bus/test-bus-marshal.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include /* We make an exception here to our usual "include system headers first" rule because we need one of these * macros to disable a warning triggered by the glib headers. */ @@ -20,13 +19,10 @@ REENABLE_WARNING #include "sd-bus.h" #include "alloc-util.h" -#include "bus-dump.h" #include "bus-label.h" #include "bus-message.h" #include "bus-util.h" #include "escape.h" -#include "fd-util.h" -#include "fileio.h" #include "log.h" #include "memstream-util.h" #include "tests.h" diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index 2d7755711e5..7b212c8eaa5 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -1,10 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + +#include "bus-internal.h" #include "bus-match.h" #include "bus-message.h" -#include "bus-slot.h" #include "log.h" -#include "macro.h" #include "memory-util.h" #include "tests.h" diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c index c9ec474856d..fac3e150857 100644 --- a/src/libsystemd/sd-bus/test-bus-objects.c +++ b/src/libsystemd/sd-bus/test-bus-objects.c @@ -1,16 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include "sd-bus.h" #include "alloc-util.h" -#include "bus-dump.h" #include "bus-internal.h" #include "bus-message.h" #include "log.h" -#include "macro.h" #include "strv.h" #include "tests.h" diff --git a/src/libsystemd/sd-bus/test-bus-peersockaddr.c b/src/libsystemd/sd-bus/test-bus-peersockaddr.c index 8b11a7af33d..32072097ba5 100644 --- a/src/libsystemd/sd-bus/test-bus-peersockaddr.c +++ b/src/libsystemd/sd-bus/test-bus-peersockaddr.c @@ -6,11 +6,10 @@ #include "sd-bus.h" #include "bus-dump.h" -#include "bus-util.h" #include "fd-util.h" +#include "pidref.h" #include "process-util.h" #include "socket-util.h" -#include "sort-util.h" #include "tests.h" #include "user-util.h" diff --git a/src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c b/src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c index 7c2fa72e84e..debe78c7e2c 100644 --- a/src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c +++ b/src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #include "sd-bus.h" #include "main-func.h" diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c index 8049e332949..68f5e00040a 100644 --- a/src/libsystemd/sd-bus/test-bus-server.c +++ b/src/libsystemd/sd-bus/test-bus-server.c @@ -1,13 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include +#include #include "sd-bus.h" -#include "bus-internal.h" +#include "bus-error.h" #include "log.h" -#include "macro.h" #include "memory-util.h" #include "string-util.h" #include "tests.h" diff --git a/src/libsystemd/sd-bus/test-bus-signature.c b/src/libsystemd/sd-bus/test-bus-signature.c index 5a4c8118643..24172082817 100644 --- a/src/libsystemd/sd-bus/test-bus-signature.c +++ b/src/libsystemd/sd-bus/test-bus-signature.c @@ -3,7 +3,6 @@ #include "bus-internal.h" #include "bus-signature.h" #include "log.h" -#include "string-util.h" #include "tests.h" int main(int argc, char *argv[]) { diff --git a/src/libsystemd/sd-bus/test-bus-track.c b/src/libsystemd/sd-bus/test-bus-track.c index 5604e84f522..4f14787f306 100644 --- a/src/libsystemd/sd-bus/test-bus-track.c +++ b/src/libsystemd/sd-bus/test-bus-track.c @@ -1,11 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include "sd-bus.h" +#include "sd-event.h" -#include "macro.h" #include "tests.h" static bool track_cb_called_x = false; diff --git a/src/libsystemd/sd-bus/test-bus-vtable.c b/src/libsystemd/sd-bus/test-bus-vtable.c index bc6be901adc..17cd1bb51c3 100644 --- a/src/libsystemd/sd-bus/test-bus-vtable.c +++ b/src/libsystemd/sd-bus/test-bus-vtable.c @@ -1,18 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include - /* We use system assert.h here, because we don't want to keep macro.h and log.h C++ compatible */ #undef NDEBUG #include -#include #include #include "sd-bus.h" #include "sd-bus-vtable.h" #ifndef __cplusplus +# include "alloc-util.h" # include "bus-objects.h" # include "log.h" #endif diff --git a/src/libsystemd/sd-bus/test-bus-watch-bind.c b/src/libsystemd/sd-bus/test-bus-watch-bind.c index f7ba14a6a80..c6c072440ec 100644 --- a/src/libsystemd/sd-bus/test-bus-watch-bind.c +++ b/src/libsystemd/sd-bus/test-bus-watch-bind.c @@ -17,6 +17,7 @@ #include "socket-util.h" #include "string-util.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" static int method_foobar(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c index b7635a60b6b..14733d0f175 100644 --- a/src/libsystemd/sd-daemon/sd-daemon.c +++ b/src/libsystemd/sd-daemon/sd-daemon.c @@ -1,14 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include #include -#include -#include #include -#include #include #include #include @@ -16,6 +11,7 @@ #include "sd-daemon.h" #include "alloc-util.h" +#include "errno-util.h" #include "extract-word.h" #include "fd-util.h" #include "fs-util.h" diff --git a/src/libsystemd/sd-device/device-enumerator-private.h b/src/libsystemd/sd-device/device-enumerator-private.h index cf62fabdad9..f4b836e16a5 100644 --- a/src/libsystemd/sd-device/device-enumerator-private.h +++ b/src/libsystemd/sd-device/device-enumerator-private.h @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-device.h" +#include "forward.h" typedef enum MatchInitializedType { MATCH_INITIALIZED_NO, /* only devices without a db entry */ diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c index 8230763ddd9..1b2b534530a 100644 --- a/src/libsystemd/sd-device/device-enumerator.c +++ b/src/libsystemd/sd-device/device-enumerator.c @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include #include "sd-device.h" @@ -12,6 +10,8 @@ #include "device-util.h" #include "dirent-util.h" #include "fd-util.h" +#include "log.h" +#include "path-util.h" #include "set.h" #include "sort-util.h" #include "string-util.h" diff --git a/src/libsystemd/sd-device/device-filter.c b/src/libsystemd/sd-device/device-filter.c index bf7d4d4be51..cffc91ce930 100644 --- a/src/libsystemd/sd-device/device-filter.c +++ b/src/libsystemd/sd-device/device-filter.c @@ -1,10 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include "sd-device.h" #include "alloc-util.h" #include "device-filter.h" +#include "hashmap.h" #include "path-util.h" +#include "set.h" #include "strv.h" int update_match_strv(Hashmap **match_strv, const char *key, const char *value, bool clear_on_null) { diff --git a/src/libsystemd/sd-device/device-filter.h b/src/libsystemd/sd-device/device-filter.h index 0c5f34e242d..d72cbab7e8c 100644 --- a/src/libsystemd/sd-device/device-filter.h +++ b/src/libsystemd/sd-device/device-filter.h @@ -1,12 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-device.h" - -#include "hashmap.h" -#include "set.h" +#include "forward.h" int update_match_strv(Hashmap **match_strv, const char *key, const char *value, bool clear_on_null); bool device_match_sysattr(sd_device *device, Hashmap *match_sysattr, Hashmap *nomatch_sysattr); diff --git a/src/libsystemd/sd-device/device-internal.h b/src/libsystemd/sd-device/device-internal.h index cbd89849bde..1f9cf59d512 100644 --- a/src/libsystemd/sd-device/device-internal.h +++ b/src/libsystemd/sd-device/device-internal.h @@ -3,10 +3,8 @@ #include "sd-device.h" -#include "device-private.h" -#include "hashmap.h" -#include "set.h" -#include "time-util.h" +#include "forward.h" +#include "iterator.h" #define LATEST_UDEV_DATABASE_VERSION 1 diff --git a/src/libsystemd/sd-device/device-monitor-private.h b/src/libsystemd/sd-device/device-monitor-private.h index 79f9d834ff3..309d4979e22 100644 --- a/src/libsystemd/sd-device/device-monitor-private.h +++ b/src/libsystemd/sd-device/device-monitor-private.h @@ -1,11 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-device.h" - -#include "socket-util.h" +#include "forward.h" typedef enum MonitorNetlinkGroup { MONITOR_GROUP_NONE, diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c index 99bdc7f3427..5ae1eb6390a 100644 --- a/src/libsystemd/sd-device/device-monitor.c +++ b/src/libsystemd/sd-device/device-monitor.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include #include @@ -22,13 +21,13 @@ #include "hashmap.h" #include "io-util.h" #include "iovec-util.h" +#include "log.h" #include "log-context.h" -#include "missing_socket.h" #include "mountpoint-util.h" #include "set.h" +#include "socket-util.h" #include "stat-util.h" #include "string-util.h" -#include "strv.h" #include "uid-range.h" #define log_monitor(m, format, ...) \ diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c index 270e0293e15..9896e0e7ac4 100644 --- a/src/libsystemd/sd-device/device-private.c +++ b/src/libsystemd/sd-device/device-private.c @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include +#include +#include +#include #include "sd-device.h" @@ -10,21 +10,21 @@ #include "device-internal.h" #include "device-private.h" #include "device-util.h" +#include "extract-word.h" #include "fd-util.h" #include "fileio.h" #include "fs-util.h" #include "hashmap.h" -#include "macro.h" #include "mkdir.h" #include "nulstr-util.h" #include "parse-util.h" #include "path-util.h" #include "set.h" -#include "stdio-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" #include "strxcpyx.h" +#include "time-util.h" #include "tmpfile-util.h" #include "user-util.h" diff --git a/src/libsystemd/sd-device/device-private.h b/src/libsystemd/sd-device/device-private.h index 7d609d1a414..b5a24dde1c0 100644 --- a/src/libsystemd/sd-device/device-private.h +++ b/src/libsystemd/sd-device/device-private.h @@ -1,16 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include -#include -#include +#include "sd-device.h" /* IWYU pragma: export */ -#include "sd-device.h" +#include "forward.h" -#include "chase.h" -#include "macro.h" +typedef enum ChaseFlags ChaseFlags; int device_new_from_mode_and_devnum(sd_device **ret, mode_t mode, dev_t devnum); int device_new_from_nulstr(sd_device **ret, char *nulstr, size_t len); diff --git a/src/libsystemd/sd-device/device-util.c b/src/libsystemd/sd-device/device-util.c index 5169c24d848..718b7030666 100644 --- a/src/libsystemd/sd-device/device-util.c +++ b/src/libsystemd/sd-device/device-util.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "alloc-util.h" #include "device-private.h" #include "device-util.h" #include "devnum-util.h" @@ -29,6 +28,11 @@ int devname_from_devnum(mode_t mode, dev_t devnum, char **ret) { return strdup_to(ret, devname); } +int devname_from_stat_rdev(const struct stat *st, char **ret) { + assert(st); + return devname_from_devnum(st->st_mode, st->st_rdev, ret); +} + int device_open_from_devnum(mode_t mode, dev_t devnum, int flags, char **ret_devname) { _cleanup_(sd_device_unrefp) sd_device *dev = NULL; _cleanup_close_ int fd = -EBADF; diff --git a/src/libsystemd/sd-device/device-util.h b/src/libsystemd/sd-device/device-util.h index 5b899ecfcdf..136d399d7eb 100644 --- a/src/libsystemd/sd-device/device-util.h +++ b/src/libsystemd/sd-device/device-util.h @@ -1,15 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include - #include "sd-device.h" -#include "alloc-util.h" +#include "forward.h" #include "log.h" -#include "macro.h" #define device_unref_and_replace(a, b) \ unref_and_replace_full(a, b, sd_device_ref, sd_device_unref) @@ -95,10 +90,7 @@ #define log_device_error_errno(device, error, ...) log_device_full_errno(device, LOG_ERR, error, __VA_ARGS__) int devname_from_devnum(mode_t mode, dev_t devnum, char **ret); -static inline int devname_from_stat_rdev(const struct stat *st, char **ret) { - assert(st); - return devname_from_devnum(st->st_mode, st->st_rdev, ret); -} +int devname_from_stat_rdev(const struct stat *st, char **ret); int device_open_from_devnum(mode_t mode, dev_t devnum, int flags, char **ret_devname); char** device_make_log_fields(sd_device *device); diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index c90d267456c..aef02350ccd 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include +#include #include "sd-device.h" +#include "sd-id128.h" #include "alloc-util.h" #include "chase.h" @@ -15,24 +13,23 @@ #include "devnum-util.h" #include "dirent-util.h" #include "env-util.h" +#include "errno-util.h" +#include "extract-word.h" #include "fd-util.h" #include "fileio.h" -#include "format-util.h" #include "fs-util.h" #include "hashmap.h" -#include "id128-util.h" -#include "macro.h" #include "missing_magic.h" #include "netlink-util.h" #include "parse-util.h" #include "path-util.h" #include "set.h" #include "socket-util.h" +#include "stat-util.h" #include "stdio-util.h" #include "string-util.h" #include "strv.h" -#include "strxcpyx.h" -#include "user-util.h" +#include "time-util.h" int device_new_aux(sd_device **ret) { sd_device *device; diff --git a/src/libsystemd/sd-device/test-device-util.c b/src/libsystemd/sd-device/test-device-util.c index aa3fb8215fa..030beff8b35 100644 --- a/src/libsystemd/sd-device/test-device-util.c +++ b/src/libsystemd/sd-device/test-device-util.c @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-device.h" + #include "device-util.h" #include "mountpoint-util.h" #include "tests.h" diff --git a/src/libsystemd/sd-device/test-sd-device-monitor.c b/src/libsystemd/sd-device/test-sd-device-monitor.c index 362ce0a85ee..c1c720b364b 100644 --- a/src/libsystemd/sd-device/test-sd-device-monitor.c +++ b/src/libsystemd/sd-device/test-sd-device-monitor.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include "sd-device.h" @@ -10,13 +9,13 @@ #include "device-private.h" #include "device-util.h" #include "io-util.h" -#include "macro.h" #include "mountpoint-util.h" #include "path-util.h" +#include "socket-util.h" #include "stat-util.h" #include "string-util.h" #include "tests.h" -#include "virt.h" +#include "time-util.h" static void prepare_loopback(sd_device **ret) { _cleanup_(sd_device_unrefp) sd_device *dev = NULL; diff --git a/src/libsystemd/sd-device/test-sd-device-thread.c b/src/libsystemd/sd-device/test-sd-device-thread.c index 539dabd7a6b..1738ddb620c 100644 --- a/src/libsystemd/sd-device/test-sd-device-thread.c +++ b/src/libsystemd/sd-device/test-sd-device-thread.c @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include -#include #include "sd-device.h" @@ -12,7 +9,7 @@ #define handle_error_errno(error, msg) \ ({ \ - errno = abs(error); \ + errno = ABS(error); \ perror(msg); \ EXIT_FAILURE; \ }) diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c index ff59d3bd501..4173f76dd81 100644 --- a/src/libsystemd/sd-device/test-sd-device.c +++ b/src/libsystemd/sd-device/test-sd-device.c @@ -1,10 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include -#include "device-enumerator-private.h" +#include "sd-event.h" + #include "device-internal.h" #include "device-private.h" #include "device-util.h" @@ -15,10 +15,10 @@ #include "nulstr-util.h" #include "path-util.h" #include "rm-rf.h" +#include "set.h" #include "stat-util.h" #include "string-util.h" #include "tests.h" -#include "time-util.h" #include "tmpfile-util.h" #include "udev-util.h" diff --git a/src/libsystemd/sd-event/event-source.h b/src/libsystemd/sd-event/event-source.h index d05bcf0538d..3be9a0e6c12 100644 --- a/src/libsystemd/sd-event/event-source.h +++ b/src/libsystemd/sd-event/event-source.h @@ -1,16 +1,14 @@ -#pragma once /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once -#include -#include -#include +#include +#include #include "sd-event.h" -#include "hashmap.h" +#include "forward.h" #include "inotify-util.h" #include "list.h" -#include "prioq.h" #include "ratelimit.h" typedef enum EventSourceType { diff --git a/src/libsystemd/sd-event/event-util.c b/src/libsystemd/sd-event/event-util.c index d7f15882c8f..7e8c481bcf4 100644 --- a/src/libsystemd/sd-event/event-util.c +++ b/src/libsystemd/sd-event/event-util.c @@ -1,13 +1,16 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include "sd-event.h" -#include "errno-util.h" +#include "alloc-util.h" #include "event-source.h" #include "event-util.h" #include "fd-util.h" +#include "hash-funcs.h" #include "log.h" +#include "pidref.h" #include "string-util.h" +#include "time-util.h" #define SI_FLAG_FORWARD (INT32_C(1) << 30) #define SI_FLAG_POSITIVE (INT32_C(1) << 29) diff --git a/src/libsystemd/sd-event/event-util.h b/src/libsystemd/sd-event/event-util.h index 02dc3929ca7..7cc56a38d88 100644 --- a/src/libsystemd/sd-event/event-util.h +++ b/src/libsystemd/sd-event/event-util.h @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-event.h" -#include "hash-funcs.h" -#include "pidref.h" +#include "forward.h" extern const struct hash_ops event_source_hash_ops; diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 5e055330e01..6d8a207b5d4 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include #include #include #include @@ -11,20 +11,19 @@ #include "sd-messages.h" #include "alloc-util.h" -#include "env-util.h" +#include "errno-util.h" #include "event-source.h" #include "fd-util.h" -#include "fs-util.h" +#include "format-util.h" #include "glyph-util.h" #include "hashmap.h" #include "hexdecoct.h" #include "list.h" +#include "log.h" #include "logarithm.h" -#include "macro.h" #include "mallinfo-util.h" #include "memory-util.h" #include "missing_magic.h" -#include "missing_syscall.h" #include "missing_wait.h" #include "origin-id.h" #include "path-util.h" @@ -34,6 +33,7 @@ #include "psi-util.h" #include "set.h" #include "signal-util.h" +#include "siphash24.h" #include "socket-util.h" #include "stat-util.h" #include "string-table.h" diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c index 6394507994f..23a45c7276a 100644 --- a/src/libsystemd/sd-event/test-event.c +++ b/src/libsystemd/sd-event/test-event.c @@ -1,22 +1,17 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#if HAVE_PIDFD_OPEN -#include -#endif #include #include #include "sd-event.h" #include "alloc-util.h" -#include "exec-util.h" #include "fd-util.h" #include "fs-util.h" #include "log.h" -#include "macro.h" -#include "missing_syscall.h" #include "parse-util.h" #include "path-util.h" +#include "pidfd-util.h" #include "process-util.h" #include "random-util.h" #include "rm-rf.h" @@ -24,6 +19,7 @@ #include "stdio-util.h" #include "string-util.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" static int prepare_handler(sd_event_source *s, void *userdata) { diff --git a/src/libsystemd/sd-hwdb/hwdb-internal.h b/src/libsystemd/sd-hwdb/hwdb-internal.h index b26eb594edc..65c810416a2 100644 --- a/src/libsystemd/sd-hwdb/hwdb-internal.h +++ b/src/libsystemd/sd-hwdb/hwdb-internal.h @@ -1,11 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include #include -#include "constants.h" -#include "hashmap.h" +#include "forward.h" +#include "iterator.h" #include "sparse-endian.h" #define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' } diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index fce62e12e44..bc96e409074 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -3,9 +3,7 @@ Copyright © 2008 Alan Jenkins ***/ -#include #include -#include #include #include #include @@ -21,7 +19,6 @@ #include "log.h" #include "nulstr-util.h" #include "string-util.h" -#include "time-util.h" struct linebuf { char bytes[LINE_MAX]; diff --git a/src/libsystemd/sd-id128/id128-util.c b/src/libsystemd/sd-id128/id128-util.c index 44b0e1dddab..f5dcf2ecf25 100644 --- a/src/libsystemd/sd-id128/id128-util.c +++ b/src/libsystemd/sd-id128/id128-util.c @@ -1,19 +1,19 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include +#include +#include #include #include "fd-util.h" #include "fs-util.h" -#include "hexdecoct.h" +#include "hash-funcs.h" #include "id128-util.h" #include "io-util.h" -#include "log.h" #include "namespace-util.h" #include "process-util.h" #include "sha256.h" -#include "stdio-util.h" +#include "siphash24.h" #include "string-util.h" #include "strv.h" #include "sync-util.h" diff --git a/src/libsystemd/sd-id128/id128-util.h b/src/libsystemd/sd-id128/id128-util.h index 458d4307719..874fc9f4460 100644 --- a/src/libsystemd/sd-id128/id128-util.h +++ b/src/libsystemd/sd-id128/id128-util.h @@ -1,14 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - #include "sd-id128.h" #include "errno-util.h" -#include "hash-funcs.h" -#include "macro.h" +#include "forward.h" bool id128_is_valid(const char *s) _pure_; diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c index 54fb403a54b..54fab9284a7 100644 --- a/src/libsystemd/sd-id128/sd-id128.c +++ b/src/libsystemd/sd-id128/sd-id128.c @@ -1,9 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include +#include #include -#include #include "sd-id128.h" @@ -13,10 +12,7 @@ #include "hexdecoct.h" #include "hmac.h" #include "id128-util.h" -#include "io-util.h" #include "keyring-util.h" -#include "log.h" -#include "macro.h" #include "missing_syscall.h" #include "path-util.h" #include "random-util.h" diff --git a/src/libsystemd/sd-journal/audit-type.h b/src/libsystemd/sd-journal/audit-type.h index fffc58ad92a..85b4c47bb02 100644 --- a/src/libsystemd/sd-journal/audit-type.h +++ b/src/libsystemd/sd-journal/audit-type.h @@ -3,8 +3,7 @@ #include -#include "alloc-util.h" -#include "macro.h" +#include "forward.h" const char* audit_type_to_string(int type); int audit_type_from_string(const char *s); diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c index 1ecf335fb86..3ca3b2dab47 100644 --- a/src/libsystemd/sd-journal/catalog.c +++ b/src/libsystemd/sd-journal/catalog.c @@ -1,13 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include #include +#include #include #include -#include -#include #include "sd-id128.h" @@ -22,7 +20,6 @@ #include "log.h" #include "memory-util.h" #include "mkdir.h" -#include "path-util.h" #include "siphash24.h" #include "sort-util.h" #include "sparse-endian.h" diff --git a/src/libsystemd/sd-journal/catalog.h b/src/libsystemd/sd-journal/catalog.h index e6a8c9b8dbb..c2a20aaddbf 100644 --- a/src/libsystemd/sd-journal/catalog.h +++ b/src/libsystemd/sd-journal/catalog.h @@ -1,12 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "sd-id128.h" - -#include "hashmap.h" +#include "forward.h" int catalog_import_file(OrderedHashmap **h, const char *path); int catalog_update(const char *database, const char *root, const char* const *dirs); diff --git a/src/libsystemd/sd-journal/fsprg.h b/src/libsystemd/sd-journal/fsprg.h index a0594cd4382..f65c5f9e06a 100644 --- a/src/libsystemd/sd-journal/fsprg.h +++ b/src/libsystemd/sd-journal/fsprg.h @@ -7,10 +7,7 @@ * Contact: fsprg@point-at-infinity.org */ -#include -#include - -#include "macro.h" +#include "forward.h" #ifdef __cplusplus extern "C" { diff --git a/src/libsystemd/sd-journal/journal-authenticate.c b/src/libsystemd/sd-journal/journal-authenticate.c index 9ad9ce3ef33..60a60f26f59 100644 --- a/src/libsystemd/sd-journal/journal-authenticate.c +++ b/src/libsystemd/sd-journal/journal-authenticate.c @@ -2,7 +2,9 @@ #include #include +#include +#include "alloc-util.h" #include "fd-util.h" #include "fsprg.h" #include "gcrypt-util.h" @@ -12,6 +14,7 @@ #include "journal-file.h" #include "log.h" #include "memory-util.h" +#include "string-util.h" #include "time-util.h" static void* fssheader_free(FSSHeader *p) { diff --git a/src/libsystemd/sd-journal/journal-authenticate.h b/src/libsystemd/sd-journal/journal-authenticate.h index e895722865d..21c69ad30b8 100644 --- a/src/libsystemd/sd-journal/journal-authenticate.h +++ b/src/libsystemd/sd-journal/journal-authenticate.h @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - +#include "forward.h" #include "journal-file.h" int journal_file_append_tag(JournalFile *f); diff --git a/src/libsystemd/sd-journal/journal-def.h b/src/libsystemd/sd-journal/journal-def.h index 28cccca21a7..f3fef931d03 100644 --- a/src/libsystemd/sd-journal/journal-def.h +++ b/src/libsystemd/sd-journal/journal-def.h @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-id128.h" -#include "macro.h" +#include "forward.h" #include "sparse-endian.h" /* diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index dfc3e8aa913..ec06ea8e20f 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -1,10 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include #include -#include +#include #include #include #include @@ -21,6 +20,7 @@ #include "format-util.h" #include "fs-util.h" #include "gcrypt-util.h" +#include "hashmap.h" #include "id128-util.h" #include "journal-authenticate.h" #include "journal-def.h" @@ -30,19 +30,19 @@ #include "log-ratelimit.h" #include "lookup3.h" #include "memory-util.h" -#include "missing_fs.h" #include "parse-util.h" #include "path-util.h" #include "prioq.h" #include "random-util.h" #include "ratelimit.h" -#include "set.h" #include "sort-util.h" #include "stat-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" +#include "siphash24.h" #include "sync-util.h" +#include "time-util.h" #include "user-util.h" #include "xattr-util.h" diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h index 89b06b08345..12a66468530 100644 --- a/src/libsystemd/sd-journal/journal-file.h +++ b/src/libsystemd/sd-journal/journal-file.h @@ -1,20 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "sd-event.h" -#include "sd-id128.h" - #include "compress.h" +#include "forward.h" #include "gcrypt-util.h" -#include "hashmap.h" #include "journal-def.h" #include "missing_fcntl.h" #include "mmap-cache.h" #include "sparse-endian.h" -#include "time-util.h" typedef struct JournalMetrics { /* For all these: UINT64_MAX means "pick automatically", and 0 means "no limit enforced" */ diff --git a/src/libsystemd/sd-journal/journal-internal.h b/src/libsystemd/sd-journal/journal-internal.h index badec0e9438..15dc934db0f 100644 --- a/src/libsystemd/sd-journal/journal-internal.h +++ b/src/libsystemd/sd-journal/journal-internal.h @@ -1,18 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include - -#include "sd-id128.h" -#include "sd-journal.h" - -#include "hashmap.h" -#include "journal-def.h" #include "journal-file.h" #include "list.h" -#include "prioq.h" +#include "forward.h" +#include "time-util.h" #define JOURNAL_FILES_MAX 7168u @@ -28,7 +20,7 @@ typedef enum MatchType { MATCH_AND_TERM, } MatchType; -struct Match { +typedef struct Match { MatchType type; Match *parent; LIST_FIELDS(Match, matches); @@ -40,9 +32,9 @@ struct Match { /* For terms */ LIST_HEAD(Match, matches); -}; +} Match; -struct Location { +typedef struct Location { LocationType type; bool seqnum_set:1; @@ -59,22 +51,22 @@ struct Location { sd_id128_t boot_id; uint64_t xor_hash; -}; +} Location; -struct Directory { +typedef struct Directory { sd_journal *journal; char *path; int wd; bool is_root; unsigned last_seen_generation; -}; +} Directory; typedef struct NewestByBootId { sd_id128_t boot_id; Prioq *prioq; /* JournalFile objects ordered by monotonic timestamp of last update. */ } NewestByBootId; -struct sd_journal { +typedef struct sd_journal { int toplevel_fd; char *path; @@ -134,7 +126,7 @@ struct sd_journal { Hashmap *directories_by_wd; Hashmap *errors; -}; +} sd_journal; char* journal_make_match_string(sd_journal *j); void journal_print_header(sd_journal *j); diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c index d043e1882d0..8a1e0b1fdf1 100644 --- a/src/libsystemd/sd-journal/journal-send.c +++ b/src/libsystemd/sd-journal/journal-send.c @@ -1,10 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include -#include #include #if HAVE_VALGRIND_VALGRIND_H # include @@ -24,7 +19,6 @@ #include "log.h" #include "memfd-util.h" #include "missing_mman.h" -#include "missing_syscall.h" #include "process-util.h" #include "socket-util.h" #include "stdio-util.h" diff --git a/src/libsystemd/sd-journal/journal-send.h b/src/libsystemd/sd-journal/journal-send.h index 6fe6325090e..e5394e94718 100644 --- a/src/libsystemd/sd-journal/journal-send.h +++ b/src/libsystemd/sd-journal/journal-send.h @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - #include "syslog-util.h" int journal_fd_nonblock(bool nonblock); diff --git a/src/libsystemd/sd-journal/journal-vacuum.c b/src/libsystemd/sd-journal/journal-vacuum.c index b50a0179d0b..7301b72e950 100644 --- a/src/libsystemd/sd-journal/journal-vacuum.c +++ b/src/libsystemd/sd-journal/journal-vacuum.c @@ -12,7 +12,6 @@ #include "format-util.h" #include "fs-util.h" #include "journal-def.h" -#include "journal-file.h" #include "journal-internal.h" #include "journal-vacuum.h" #include "log.h" diff --git a/src/libsystemd/sd-journal/journal-vacuum.h b/src/libsystemd/sd-journal/journal-vacuum.h index d87c847da60..e134a9d4b90 100644 --- a/src/libsystemd/sd-journal/journal-vacuum.h +++ b/src/libsystemd/sd-journal/journal-vacuum.h @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include - -#include "time-util.h" +#include "forward.h" int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t n_max_files, usec_t max_retention_usec, usec_t *oldest_usec, bool verbose); diff --git a/src/libsystemd/sd-journal/journal-verify.c b/src/libsystemd/sd-journal/journal-verify.c index 87d66aac433..db566288b72 100644 --- a/src/libsystemd/sd-journal/journal-verify.c +++ b/src/libsystemd/sd-journal/journal-verify.c @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include -#include #include "alloc-util.h" #include "ansi-color.h" @@ -17,9 +15,8 @@ #include "journal-file.h" #include "journal-verify.h" #include "log.h" -#include "lookup3.h" -#include "macro.h" #include "terminal-util.h" +#include "time-util.h" #include "tmpfile-util.h" static void draw_progress(uint64_t p, usec_t *last_usec) { diff --git a/src/libsystemd/sd-journal/lookup3.h b/src/libsystemd/sd-journal/lookup3.h index 04e493e95ea..e4709490e20 100644 --- a/src/libsystemd/sd-journal/lookup3.h +++ b/src/libsystemd/sd-journal/lookup3.h @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LicenseRef-lookup3-public-domain */ #pragma once -#include -#include - -#include "macro.h" +#include "forward.h" uint32_t jenkins_hashword(const uint32_t *k, size_t length, uint32_t initval) _pure_; void jenkins_hashword2(const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb); diff --git a/src/libsystemd/sd-journal/mmap-cache.c b/src/libsystemd/sd-journal/mmap-cache.c index 49e1e5fc814..2c2f6c677d3 100644 --- a/src/libsystemd/sd-journal/mmap-cache.c +++ b/src/libsystemd/sd-journal/mmap-cache.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include @@ -11,7 +10,6 @@ #include "hashmap.h" #include "list.h" #include "log.h" -#include "macro.h" #include "memory-util.h" #include "mmap-cache.h" #include "sigbus.h" diff --git a/src/libsystemd/sd-journal/mmap-cache.h b/src/libsystemd/sd-journal/mmap-cache.h index 3e088ef8ef8..bdd34945890 100644 --- a/src/libsystemd/sd-journal/mmap-cache.h +++ b/src/libsystemd/sd-journal/mmap-cache.h @@ -1,12 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include - +#include "forward.h" #include "journal-def.h" -#include "memory-util.h" typedef struct MMapCache MMapCache; typedef struct MMapFileDescriptor MMapFileDescriptor; diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index b6d3a7f6277..8ec1fe450c3 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -1,11 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include -#include #include -#include +#include #include #include #include @@ -14,14 +11,13 @@ #include "alloc-util.h" #include "catalog.h" -#include "compress.h" #include "dirent-util.h" #include "env-file.h" #include "escape.h" +#include "extract-word.h" #include "fd-util.h" #include "fileio.h" #include "format-util.h" -#include "fs-util.h" #include "hashmap.h" #include "hostname-util.h" #include "id128-util.h" @@ -31,19 +27,21 @@ #include "journal-file.h" #include "journal-internal.h" #include "list.h" +#include "log.h" #include "lookup3.h" #include "nulstr-util.h" #include "origin-id.h" #include "path-util.h" #include "prioq.h" -#include "process-util.h" #include "replace-var.h" +#include "set.h" #include "sort-util.h" #include "stat-util.h" #include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "syslog-util.h" +#include "time-util.h" #include "uid-classification.h" #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC) diff --git a/src/libsystemd/sd-journal/test-catalog.c b/src/libsystemd/sd-journal/test-catalog.c index ee8bd4e0ec4..d86fd533f7b 100644 --- a/src/libsystemd/sd-journal/test-catalog.c +++ b/src/libsystemd/sd-journal/test-catalog.c @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include @@ -10,12 +8,8 @@ #include "alloc-util.h" #include "catalog.h" #include "fd-util.h" -#include "fs-util.h" +#include "hashmap.h" #include "log.h" -#include "macro.h" -#include "path-util.h" -#include "string-util.h" -#include "strv.h" #include "tests.h" #include "tmpfile-util.h" diff --git a/src/libsystemd/sd-journal/test-journal-append.c b/src/libsystemd/sd-journal/test-journal-append.c index ff4f86329b8..6530cdae8fa 100644 --- a/src/libsystemd/sd-journal/test-journal-append.c +++ b/src/libsystemd/sd-journal/test-journal-append.c @@ -6,8 +6,6 @@ #include #include "chattr-util.h" -#include "fd-util.h" -#include "fs-util.h" #include "iovec-util.h" #include "journal-file-util.h" #include "log.h" @@ -15,9 +13,8 @@ #include "parse-util.h" #include "random-util.h" #include "rm-rf.h" -#include "strv.h" -#include "terminal-util.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" static int journal_append_message(JournalFile *mj, const char *message) { diff --git a/src/libsystemd/sd-journal/test-journal-enum.c b/src/libsystemd/sd-journal/test-journal-enum.c index d101fe76f21..cc17ea18918 100644 --- a/src/libsystemd/sd-journal/test-journal-enum.c +++ b/src/libsystemd/sd-journal/test-journal-enum.c @@ -4,9 +4,6 @@ #include "sd-journal.h" -#include "journal-internal.h" -#include "log.h" -#include "macro.h" #include "tests.h" int main(int argc, char *argv[]) { diff --git a/src/libsystemd/sd-journal/test-journal-file.c b/src/libsystemd/sd-journal/test-journal-file.c index 729de1fe52d..52b1328fb08 100644 --- a/src/libsystemd/sd-journal/test-journal-file.c +++ b/src/libsystemd/sd-journal/test-journal-file.c @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include "journal-file.h" #include "tests.h" -#include "user-util.h" static void test_journal_file_parse_uid_from_filename_simple( const char *path, diff --git a/src/libsystemd/sd-journal/test-journal-flush.c b/src/libsystemd/sd-journal/test-journal-flush.c index 05252d7f096..ef5acca9c0c 100644 --- a/src/libsystemd/sd-journal/test-journal-flush.c +++ b/src/libsystemd/sd-journal/test-journal-flush.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include +#include #include "sd-journal.h" @@ -13,13 +13,13 @@ #include "journal-file-util.h" #include "journal-internal.h" #include "logs-show.h" -#include "macro.h" #include "output-mode.h" #include "path-util.h" #include "rm-rf.h" #include "string-util.h" #include "strv.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" static int open_archive_file(sd_journal **ret) { diff --git a/src/libsystemd/sd-journal/test-journal-init.c b/src/libsystemd/sd-journal/test-journal-init.c index 45663b0dbec..7f7e12fbdd9 100644 --- a/src/libsystemd/sd-journal/test-journal-init.c +++ b/src/libsystemd/sd-journal/test-journal-init.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include "sd-journal.h" diff --git a/src/libsystemd/sd-journal/test-journal-interleaving.c b/src/libsystemd/sd-journal/test-journal-interleaving.c index 9703f46c429..d5d6506a44c 100644 --- a/src/libsystemd/sd-journal/test-journal-interleaving.c +++ b/src/libsystemd/sd-journal/test-journal-interleaving.c @@ -19,6 +19,7 @@ #include "rm-rf.h" #include "strv.h" #include "tests.h" +#include "time-util.h" #include "tmpfile-util.h" /* This program tests skipping around in a multi-file journal. */ diff --git a/src/libsystemd/sd-journal/test-journal-match.c b/src/libsystemd/sd-journal/test-journal-match.c index c2c345fb07f..2b3886445de 100644 --- a/src/libsystemd/sd-journal/test-journal-match.c +++ b/src/libsystemd/sd-journal/test-journal-match.c @@ -6,8 +6,6 @@ #include "alloc-util.h" #include "journal-internal.h" -#include "log.h" -#include "string-util.h" #include "tests.h" int main(int argc, char *argv[]) { diff --git a/src/libsystemd/sd-journal/test-journal-send.c b/src/libsystemd/sd-journal/test-journal-send.c index ca1fe7c3030..e4959521f6a 100644 --- a/src/libsystemd/sd-journal/test-journal-send.c +++ b/src/libsystemd/sd-journal/test-journal-send.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include @@ -8,8 +7,6 @@ #include "fileio.h" #include "journal-send.h" -#include "macro.h" -#include "memory-util.h" #include "tests.h" TEST(journal_print) { diff --git a/src/libsystemd/sd-journal/test-journal-stream.c b/src/libsystemd/sd-journal/test-journal-stream.c index c8103bf113a..512ec132ef6 100644 --- a/src/libsystemd/sd-journal/test-journal-stream.c +++ b/src/libsystemd/sd-journal/test-journal-stream.c @@ -11,10 +11,10 @@ #include "journal-file-util.h" #include "journal-internal.h" #include "log.h" -#include "macro.h" #include "parse-util.h" #include "rm-rf.h" #include "tests.h" +#include "time-util.h" #define N_ENTRIES 200 diff --git a/src/libsystemd/sd-journal/test-journal-verify.c b/src/libsystemd/sd-journal/test-journal-verify.c index 9bf4f862587..bc66a96aee0 100644 --- a/src/libsystemd/sd-journal/test-journal-verify.c +++ b/src/libsystemd/sd-journal/test-journal-verify.c @@ -2,6 +2,7 @@ #include #include +#include #include #include "ansi-color.h" @@ -13,9 +14,8 @@ #include "log.h" #include "mmap-cache.h" #include "rm-rf.h" -#include "strv.h" -#include "terminal-util.h" #include "tests.h" +#include "time-util.h" #define N_ENTRIES 6000 #define RANDOM_RANGE 77 diff --git a/src/libsystemd/sd-journal/test-journal.c b/src/libsystemd/sd-journal/test-journal.c index 6f6aa9d2751..fb0a02d9bfb 100644 --- a/src/libsystemd/sd-journal/test-journal.c +++ b/src/libsystemd/sd-journal/test-journal.c @@ -12,6 +12,7 @@ #include "log.h" #include "rm-rf.h" #include "tests.h" +#include "time-util.h" static bool arg_keep = false; diff --git a/src/libsystemd/sd-journal/test-mmap-cache.c b/src/libsystemd/sd-journal/test-mmap-cache.c index ce5ea123c68..dc7e3342478 100644 --- a/src/libsystemd/sd-journal/test-mmap-cache.c +++ b/src/libsystemd/sd-journal/test-mmap-cache.c @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include #include "fd-util.h" -#include "macro.h" #include "mmap-cache.h" #include "tests.h" #include "tmpfile-util.h" diff --git a/src/libsystemd/sd-json/json-internal.h b/src/libsystemd/sd-json/json-internal.h index 9ecdd6bb1a1..d42d1c6be5b 100644 --- a/src/libsystemd/sd-json/json-internal.h +++ b/src/libsystemd/sd-json/json-internal.h @@ -2,11 +2,7 @@ #pragma once -#include - -#include "sd-json.h" - -#include "macro.h" +#include "forward.h" /* This header should include all prototypes only the JSON parser itself and * its tests need access to. Normal code consuming the JSON parser should not diff --git a/src/libsystemd/sd-json/json-util.c b/src/libsystemd/sd-json/json-util.c index a4beb54cba5..2c7f3240b61 100644 --- a/src/libsystemd/sd-json/json-util.c +++ b/src/libsystemd/sd-json/json-util.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include "alloc-util.h" @@ -8,15 +9,16 @@ #include "errno-util.h" #include "fd-util.h" #include "glyph-util.h" -#include "in-addr-util.h" #include "iovec-util.h" #include "json-util.h" #include "log.h" #include "mountpoint-util.h" #include "parse-util.h" #include "path-util.h" +#include "pidref.h" #include "process-util.h" #include "stat-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "syslog-util.h" diff --git a/src/libsystemd/sd-json/json-util.h b/src/libsystemd/sd-json/json-util.h index 861c1876ff1..0d0f41bf378 100644 --- a/src/libsystemd/sd-json/json-util.h +++ b/src/libsystemd/sd-json/json-util.h @@ -5,9 +5,9 @@ #include "sd-json.h" +#include "forward.h" #include "log.h" -#include "macro.h" -#include "pidref.h" +#include "string-util.h" #define JSON_VARIANT_REPLACE(v, q) \ do { \ diff --git a/src/libsystemd/sd-json/sd-json.c b/src/libsystemd/sd-json/sd-json.c index 03f94ce663e..9add7be9a88 100644 --- a/src/libsystemd/sd-json/sd-json.c +++ b/src/libsystemd/sd-json/sd-json.c @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include -#include #include -#include #include "sd-json.h" #include "sd-messages.h" @@ -15,31 +12,26 @@ #include "errno-util.h" #include "escape.h" #include "ether-addr-util.h" -#include "fd-util.h" #include "fileio.h" #include "float.h" -#include "glyph-util.h" #include "hexdecoct.h" #include "in-addr-util.h" -#include "iovec-util.h" #include "json-internal.h" #include "json-util.h" #include "log.h" -#include "macro.h" #include "math-util.h" #include "memory-util.h" #include "memstream-util.h" #include "ordered-set.h" #include "parse-util.h" -#include "path-util.h" -#include "process-util.h" +#include "pidref.h" #include "ratelimit.h" -#include "set.h" #include "signal-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" #include "terminal-util.h" +#include "time-util.h" #include "user-util.h" #include "utf8.h" diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index cf5f39b90ac..efe40c70f5b 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include #include @@ -18,15 +17,12 @@ #include "fs-util.h" #include "hostname-util.h" #include "io-util.h" -#include "log.h" #include "login-util.h" -#include "macro.h" #include "parse-util.h" #include "path-util.h" #include "pidfd-util.h" -#include "process-util.h" +#include "pidref.h" #include "socket-util.h" -#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "user-util.h" diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c index f7dab9b7236..a4ab2659b21 100644 --- a/src/libsystemd/sd-login/test-login.c +++ b/src/libsystemd/sd-login/test-login.c @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#if HAVE_PIDFD_OPEN -#include -#endif +#include #include "sd-login.h" @@ -13,8 +11,7 @@ #include "fd-util.h" #include "format-util.h" #include "log.h" -#include "missing_syscall.h" -#include "mountpoint-util.h" +#include "pidfd-util.h" #include "process-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd/sd-login/test-sd-login.c b/src/libsystemd/sd-login/test-sd-login.c index a388a199a96..1153fb0965a 100644 --- a/src/libsystemd/sd-login/test-sd-login.c +++ b/src/libsystemd/sd-login/test-sd-login.c @@ -3,11 +3,13 @@ #include "sd-login.h" #include "alloc-util.h" +#include "errno-util.h" #include "format-util.h" +#include "log.h" #include "main-func.h" #include "parse-util.h" +#include "string-util.h" #include "strv.h" -#include "tests.h" static const char *arg_verb = NULL; /* NULL means all */ static pid_t arg_pid = 0; /* 0 == self */ diff --git a/src/libsystemd/sd-netlink/netlink-genl.c b/src/libsystemd/sd-netlink/netlink-genl.c index 9c31105772f..d4d33ae52da 100644 --- a/src/libsystemd/sd-netlink/netlink-genl.c +++ b/src/libsystemd/sd-netlink/netlink-genl.c @@ -5,10 +5,12 @@ #include "sd-netlink.h" #include "alloc-util.h" +#include "hashmap.h" #include "log.h" #include "netlink-genl.h" #include "netlink-internal.h" #include "netlink-types.h" +#include "string-util.h" typedef struct GenericNetlinkFamily { sd_netlink *genl; diff --git a/src/libsystemd/sd-netlink/netlink-genl.h b/src/libsystemd/sd-netlink/netlink-genl.h index b06be05952d..ea9135ac32a 100644 --- a/src/libsystemd/sd-netlink/netlink-genl.h +++ b/src/libsystemd/sd-netlink/netlink-genl.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-netlink.h" +#include "forward.h" #define CTRL_GENL_NAME "nlctrl" diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h index 7346902bdc9..625b73263a8 100644 --- a/src/libsystemd/sd-netlink/netlink-internal.h +++ b/src/libsystemd/sd-netlink/netlink-internal.h @@ -2,14 +2,11 @@ #pragma once #include +#include -#include "sd-netlink.h" - +#include "forward.h" #include "list.h" #include "netlink-types.h" -#include "ordered-set.h" -#include "prioq.h" -#include "time-util.h" #define NETLINK_DEFAULT_TIMEOUT_USEC ((usec_t) (25 * USEC_PER_SEC)) @@ -40,7 +37,7 @@ typedef enum NetlinkSlotType { _NETLINK_SLOT_INVALID = -EINVAL, } NetlinkSlotType; -struct sd_netlink_slot { +typedef struct sd_netlink_slot { unsigned n_ref; NetlinkSlotType type:8; bool floating; @@ -56,9 +53,9 @@ struct sd_netlink_slot { struct reply_callback reply_callback; struct match_callback match_callback; }; -}; +} sd_netlink_slot; -struct sd_netlink { +typedef struct sd_netlink { unsigned n_ref; int fd; @@ -98,7 +95,7 @@ struct sd_netlink { Hashmap *genl_family_by_name; Hashmap *genl_family_by_id; -}; +} sd_netlink; struct netlink_attribute { size_t offset; /* offset from hdr to attribute */ @@ -113,7 +110,7 @@ struct netlink_container { uint16_t max_attribute; /* the maximum attribute in container */ }; -struct sd_netlink_message { +typedef struct sd_netlink_message { unsigned n_ref; int protocol; @@ -125,7 +122,7 @@ struct sd_netlink_message { bool sealed:1; sd_netlink_message *next; /* next in a chain of multi-part messages */ -}; +} sd_netlink_message; int message_new_empty(sd_netlink *nl, sd_netlink_message **ret); int message_new_full( @@ -138,10 +135,7 @@ int message_new_full( int message_new(sd_netlink *nl, sd_netlink_message **ret, uint16_t type, uint16_t flags); int message_new_synthetic_error(sd_netlink *nl, int error, uint32_t serial, sd_netlink_message **ret); -static inline uint32_t message_get_serial(sd_netlink_message *m) { - assert(m); - return ASSERT_PTR(m->hdr)->nlmsg_seq; -} +uint32_t message_get_serial(sd_netlink_message *m); void message_seal(sd_netlink_message *m); diff --git a/src/libsystemd/sd-netlink/netlink-message-nfnl.c b/src/libsystemd/sd-netlink/netlink-message-nfnl.c index 321b9b2006d..d33a690e36d 100644 --- a/src/libsystemd/sd-netlink/netlink-message-nfnl.c +++ b/src/libsystemd/sd-netlink/netlink-message-nfnl.c @@ -3,15 +3,14 @@ #include #include #include -#include #include "sd-netlink.h" #include "alloc-util.h" +#include "errno-util.h" #include "iovec-util.h" #include "log.h" #include "netlink-internal.h" -#include "netlink-types.h" #include "netlink-util.h" bool nfproto_is_valid(int nfproto) { diff --git a/src/libsystemd/sd-netlink/netlink-message-rtnl.c b/src/libsystemd/sd-netlink/netlink-message-rtnl.c index b730b63fb02..ee6bba8d03a 100644 --- a/src/libsystemd/sd-netlink/netlink-message-rtnl.c +++ b/src/libsystemd/sd-netlink/netlink-message-rtnl.c @@ -4,18 +4,11 @@ #include #include #include -#include -#include -#include #include "sd-netlink.h" -#include "format-util.h" -#include "log.h" +#include "in-addr-util.h" #include "netlink-internal.h" -#include "netlink-types.h" -#include "netlink-util.h" -#include "socket-util.h" static bool rtnl_message_type_is_neigh(uint16_t type) { return IN_SET(type, RTM_NEWNEIGH, RTM_GETNEIGH, RTM_DELNEIGH); diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c index 76617b686d1..e55b0f0da5e 100644 --- a/src/libsystemd/sd-netlink/netlink-message.c +++ b/src/libsystemd/sd-netlink/netlink-message.c @@ -1,19 +1,18 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include #include "sd-netlink.h" #include "alloc-util.h" -#include "format-util.h" +#include "ether-addr-util.h" #include "log.h" #include "memory-util.h" #include "netlink-internal.h" #include "netlink-types.h" #include "netlink-util.h" #include "socket-util.h" +#include "string-util.h" #include "strv.h" #define GET_CONTAINER(m, i) ((struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset)) @@ -112,6 +111,11 @@ int message_new_synthetic_error(sd_netlink *nl, int error, uint32_t serial, sd_n return 0; } +uint32_t message_get_serial(sd_netlink_message *m) { + assert(m); + return ASSERT_PTR(m->hdr)->nlmsg_seq; +} + int sd_netlink_message_set_request_dump(sd_netlink_message *m, int dump) { assert_return(m, -EINVAL); assert_return(m->hdr, -EINVAL); diff --git a/src/libsystemd/sd-netlink/netlink-slot.c b/src/libsystemd/sd-netlink/netlink-slot.c index 145c376ca46..f1e270de6ac 100644 --- a/src/libsystemd/sd-netlink/netlink-slot.c +++ b/src/libsystemd/sd-netlink/netlink-slot.c @@ -1,13 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include - #include "sd-netlink.h" #include "alloc-util.h" -#include "log.h" +#include "hashmap.h" #include "netlink-internal.h" #include "netlink-slot.h" +#include "prioq.h" #include "string-util.h" int netlink_slot_allocate( diff --git a/src/libsystemd/sd-netlink/netlink-slot.h b/src/libsystemd/sd-netlink/netlink-slot.h index 4098061d31f..9ed1746b619 100644 --- a/src/libsystemd/sd-netlink/netlink-slot.h +++ b/src/libsystemd/sd-netlink/netlink-slot.h @@ -1,10 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-netlink.h" - +#include "forward.h" #include "netlink-internal.h" int netlink_slot_allocate( diff --git a/src/libsystemd/sd-netlink/netlink-sock-diag.c b/src/libsystemd/sd-netlink/netlink-sock-diag.c index 0ed222ea200..177be0c2bc8 100644 --- a/src/libsystemd/sd-netlink/netlink-sock-diag.c +++ b/src/libsystemd/sd-netlink/netlink-sock-diag.c @@ -5,7 +5,6 @@ #include "netlink-internal.h" #include "netlink-sock-diag.h" -#include "netlink-util.h" int sd_sock_diag_socket_open(sd_netlink **ret) { return netlink_open_family(ret, NETLINK_SOCK_DIAG); diff --git a/src/libsystemd/sd-netlink/netlink-sock-diag.h b/src/libsystemd/sd-netlink/netlink-sock-diag.h index 043913889c8..e12e55a2859 100644 --- a/src/libsystemd/sd-netlink/netlink-sock-diag.h +++ b/src/libsystemd/sd-netlink/netlink-sock-diag.h @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-netlink.h" /* TODO: to be exported later */ diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c index 0f00e3f2fcc..28fd2bc3d9b 100644 --- a/src/libsystemd/sd-netlink/netlink-socket.c +++ b/src/libsystemd/sd-netlink/netlink-socket.c @@ -1,19 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include -#include -#include - #include "sd-netlink.h" #include "alloc-util.h" -#include "fd-util.h" -#include "format-util.h" +#include "errno-util.h" +#include "hashmap.h" #include "iovec-util.h" #include "log.h" #include "netlink-internal.h" #include "netlink-types.h" +#include "ordered-set.h" #include "socket-util.h" static int broadcast_groups_get(sd_netlink *nl) { diff --git a/src/libsystemd/sd-netlink/netlink-types-genl.c b/src/libsystemd/sd-netlink/netlink-types-genl.c index ebb091b90fb..422ae7e6910 100644 --- a/src/libsystemd/sd-netlink/netlink-types-genl.c +++ b/src/libsystemd/sd-netlink/netlink-types-genl.c @@ -4,12 +4,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include "missing_network.h" #include "netlink-genl.h" diff --git a/src/libsystemd/sd-netlink/netlink-types-internal.h b/src/libsystemd/sd-netlink/netlink-types-internal.h index 1412514f9ba..d634098eba1 100644 --- a/src/libsystemd/sd-netlink/netlink-types-internal.h +++ b/src/libsystemd/sd-netlink/netlink-types-internal.h @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "macro.h" #include "netlink-types.h" /* C.f. see 'struct nla_policy' at include/net/netlink.h. */ diff --git a/src/libsystemd/sd-netlink/netlink-types-nfnl.c b/src/libsystemd/sd-netlink/netlink-types-nfnl.c index 8ef4d45d426..289040935bd 100644 --- a/src/libsystemd/sd-netlink/netlink-types-nfnl.c +++ b/src/libsystemd/sd-netlink/netlink-types-nfnl.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "netlink-types-internal.h" diff --git a/src/libsystemd/sd-netlink/netlink-types-rtnl.c b/src/libsystemd/sd-netlink/netlink-types-rtnl.c index 7af44ab1448..4dc98f0504e 100644 --- a/src/libsystemd/sd-netlink/netlink-types-rtnl.c +++ b/src/libsystemd/sd-netlink/netlink-types-rtnl.c @@ -5,24 +5,17 @@ #include #include #include -#include #include #include #include #include #include -#include #include -#include -#include #include -#include #include -#include #include #include #include -#include #include #include diff --git a/src/libsystemd/sd-netlink/netlink-types-sdnl.c b/src/libsystemd/sd-netlink/netlink-types-sdnl.c index 146f4177fde..6b72efb86bc 100644 --- a/src/libsystemd/sd-netlink/netlink-types-sdnl.c +++ b/src/libsystemd/sd-netlink/netlink-types-sdnl.c @@ -1,9 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include -#include "missing_network.h" #include "netlink-types-internal.h" #include "netlink-types.h" diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index e10a90c5aad..c9951a040e7 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -2,9 +2,9 @@ #include -#include "netlink-genl.h" #include "netlink-internal.h" #include "netlink-types-internal.h" +#include "string-util.h" static const NLAPolicy empty_policies[1] = { /* fake array to avoid .types==NULL, which denotes invalid type-systems */ diff --git a/src/libsystemd/sd-netlink/netlink-types.h b/src/libsystemd/sd-netlink/netlink-types.h index 85ff925edd4..99d1246ef6d 100644 --- a/src/libsystemd/sd-netlink/netlink-types.h +++ b/src/libsystemd/sd-netlink/netlink-types.h @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-netlink.h" +#include "forward.h" typedef enum NLAType { NETLINK_TYPE_UNSPEC, /* NLA_UNSPEC */ diff --git a/src/libsystemd/sd-netlink/netlink-util.c b/src/libsystemd/sd-netlink/netlink-util.c index 2a561827509..3cb5820ff61 100644 --- a/src/libsystemd/sd-netlink/netlink-util.c +++ b/src/libsystemd/sd-netlink/netlink-util.c @@ -2,7 +2,9 @@ #include "sd-netlink.h" +#include "ether-addr-util.h" #include "fd-util.h" +#include "hashmap.h" #include "iovec-util.h" #include "log.h" #include "memory-util.h" @@ -10,6 +12,8 @@ #include "netlink-util.h" #include "parse-util.h" #include "process-util.h" +#include "socket-util.h" +#include "string-util.h" #include "strv.h" static int parse_newlink_message( diff --git a/src/libsystemd/sd-netlink/netlink-util.h b/src/libsystemd/sd-netlink/netlink-util.h index 25b27291bac..a25e38d4732 100644 --- a/src/libsystemd/sd-netlink/netlink-util.h +++ b/src/libsystemd/sd-netlink/netlink-util.h @@ -3,12 +3,8 @@ #include -#include "sd-netlink.h" - -#include "ether-addr-util.h" +#include "forward.h" #include "in-addr-util.h" -#include "ordered-set.h" -#include "socket-util.h" #define RTA_FLAGS(rta) ((rta)->rta_type & ~NLA_TYPE_MASK) #define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK) diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c index d71a1c579c2..57e5a652149 100644 --- a/src/libsystemd/sd-netlink/sd-netlink.c +++ b/src/libsystemd/sd-netlink/sd-netlink.c @@ -1,22 +1,28 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include +#include +#include "sd-event.h" #include "sd-netlink.h" #include "alloc-util.h" +#include "errno-util.h" #include "fd-util.h" #include "hashmap.h" #include "io-util.h" #include "log.h" -#include "macro.h" #include "netlink-genl.h" #include "netlink-internal.h" #include "netlink-slot.h" #include "netlink-util.h" +#include "ordered-set.h" +#include "prioq.h" #include "process-util.h" #include "socket-util.h" #include "string-util.h" +#include "time-util.h" /* Some really high limit, to catch programming errors */ #define REPLY_CALLBACKS_MAX UINT16_MAX @@ -68,7 +74,7 @@ static int netlink_new(sd_netlink **ret) { int sd_netlink_open_fd(sd_netlink **ret, int fd) { _cleanup_(sd_netlink_unrefp) sd_netlink *nl = NULL; - int r, protocol; + int r, protocol = 0; /* Avoid maybe-uninitialized false positive */ assert_return(ret, -EINVAL); assert_return(fd >= 0, -EBADF); diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c index 252bb46b6ef..ae29b438df4 100644 --- a/src/libsystemd/sd-netlink/test-netlink.c +++ b/src/libsystemd/sd-netlink/test-netlink.c @@ -6,27 +6,27 @@ #include #include #include +#include #include -#include #include #include #include +#include "sd-event.h" #include "sd-netlink.h" #include "alloc-util.h" -#include "ether-addr-util.h" #include "fd-util.h" -#include "macro.h" +#include "missing_network.h" #include "netlink-genl.h" #include "netlink-internal.h" #include "netlink-sock-diag.h" #include "netlink-util.h" #include "socket-util.h" #include "stdio-util.h" -#include "string-util.h" #include "strv.h" #include "tests.h" +#include "time-util.h" TEST(message_newlink_bridge) { _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; diff --git a/src/libsystemd/sd-network/network-util.h b/src/libsystemd/sd-network/network-util.h index 80b4cc3cd61..84ae36ad367 100644 --- a/src/libsystemd/sd-network/network-util.h +++ b/src/libsystemd/sd-network/network-util.h @@ -1,12 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include -#include -#include +#include #include "constants.h" -#include "macro.h" +#include "forward.h" #define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network")) #define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network") diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index 60213c2fcf5..9d95f8b5be2 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -1,8 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include +#include +#include #include "sd-network.h" @@ -11,9 +12,7 @@ #include "errno-util.h" #include "extract-word.h" #include "fd-util.h" -#include "fs-util.h" #include "inotify-util.h" -#include "macro.h" #include "parse-util.h" #include "stdio-util.h" #include "string-util.h" diff --git a/src/libsystemd/sd-path/path-lookup.c b/src/libsystemd/sd-path/path-lookup.c index a3b09208cb3..3ddbda0e9f8 100644 --- a/src/libsystemd/sd-path/path-lookup.c +++ b/src/libsystemd/sd-path/path-lookup.c @@ -1,21 +1,16 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include -#include #include #include "alloc-util.h" #include "fs-util.h" #include "log.h" -#include "macro.h" -#include "nulstr-util.h" #include "path-lookup.h" #include "path-util.h" #include "stat-util.h" #include "string-util.h" #include "strv.h" #include "tmpfile-util.h" -#include "user-util.h" int user_search_dirs(const char *suffix, char ***ret_config_dirs, char ***ret_data_dirs) { _cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL; diff --git a/src/libsystemd/sd-path/path-lookup.h b/src/libsystemd/sd-path/path-lookup.h index 1289e7ac6fc..84570533394 100644 --- a/src/libsystemd/sd-path/path-lookup.h +++ b/src/libsystemd/sd-path/path-lookup.h @@ -1,10 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - #include "sd-path.h" +#include "forward.h" #include "runtime-scope.h" typedef enum LookupPathsFlags { diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index b8fd0ae0a78..f562e3a7ecb 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include + #include "sd-path.h" #include "alloc-util.h" @@ -7,7 +9,6 @@ #include "fd-util.h" #include "fileio.h" #include "fs-util.h" -#include "log.h" #include "network-util.h" #include "nulstr-util.h" #include "path-lookup.h" diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c index 81052e7ec1c..03ebfbb02cd 100644 --- a/src/libsystemd/sd-resolve/sd-resolve.c +++ b/src/libsystemd/sd-resolve/sd-resolve.c @@ -1,18 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include +#include #include #include -#include #include -#include #include -#include #include -#include #include #include +#include "sd-event.h" #include "sd-resolve.h" #include "alloc-util.h" @@ -24,7 +21,6 @@ #include "list.h" #include "log.h" #include "memory-util.h" -#include "missing_syscall.h" #include "process-util.h" #include "resolve-private.h" #include "socket-util.h" diff --git a/src/libsystemd/sd-resolve/test-resolve.c b/src/libsystemd/sd-resolve/test-resolve.c index 7a599925f4c..18e29d9835e 100644 --- a/src/libsystemd/sd-resolve/test-resolve.c +++ b/src/libsystemd/sd-resolve/test-resolve.c @@ -1,16 +1,14 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include -#include +#include #include -#include #include +#include #include "sd-resolve.h" #include "alloc-util.h" -#include "macro.h" #include "socket-util.h" #include "string-util.h" #include "tests.h" diff --git a/src/libsystemd/sd-varlink/sd-varlink-idl.c b/src/libsystemd/sd-varlink/sd-varlink-idl.c index 1184bd5951c..c0afc8c4e71 100644 --- a/src/libsystemd/sd-varlink/sd-varlink-idl.c +++ b/src/libsystemd/sd-varlink/sd-varlink-idl.c @@ -4,12 +4,13 @@ #include "alloc-util.h" #include "ansi-color.h" +#include "extract-word.h" #include "json-util.h" #include "log.h" #include "memstream-util.h" #include "set.h" +#include "string-util.h" #include "strv.h" -#include "terminal-util.h" #include "utf8.h" #include "varlink-idl-util.h" diff --git a/src/libsystemd/sd-varlink/sd-varlink.c b/src/libsystemd/sd-varlink/sd-varlink.c index d20b36704fb..3255bf8ed37 100644 --- a/src/libsystemd/sd-varlink/sd-varlink.c +++ b/src/libsystemd/sd-varlink/sd-varlink.c @@ -1,16 +1,20 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include +#include +#include #include "sd-daemon.h" +#include "sd-event.h" #include "sd-varlink.h" #include "alloc-util.h" #include "errno-list.h" #include "errno-util.h" #include "escape.h" +#include "extract-word.h" #include "fd-util.h" +#include "format-util.h" #include "glyph-util.h" #include "hashmap.h" #include "io-util.h" @@ -21,7 +25,6 @@ #include "mkdir.h" #include "path-util.h" #include "process-util.h" -#include "set.h" #include "socket-util.h" #include "string-table.h" #include "string-util.h" diff --git a/src/libsystemd/sd-varlink/varlink-idl-util.h b/src/libsystemd/sd-varlink/varlink-idl-util.h index 990eb804a97..0640a269959 100644 --- a/src/libsystemd/sd-varlink/varlink-idl-util.h +++ b/src/libsystemd/sd-varlink/varlink-idl-util.h @@ -4,7 +4,7 @@ #include "sd-varlink.h" #include "sd-varlink-idl.h" -#include "memory-util.h" +#include "forward.h" bool varlink_idl_field_name_is_valid(const char *name); bool varlink_idl_symbol_name_is_valid(const char *name); diff --git a/src/libsystemd/sd-varlink/varlink-internal.h b/src/libsystemd/sd-varlink/varlink-internal.h index 5ff233f210e..a163f81061d 100644 --- a/src/libsystemd/sd-varlink/varlink-internal.h +++ b/src/libsystemd/sd-varlink/varlink-internal.h @@ -3,11 +3,10 @@ #include -#include "sd-event.h" #include "sd-varlink.h" -#include "hashmap.h" #include "list.h" +#include "forward.h" typedef enum VarlinkState { /* Client side states */ diff --git a/src/libsystemd/sd-varlink/varlink-util.c b/src/libsystemd/sd-varlink/varlink-util.c index 438ef6bd7ad..dfefe088628 100644 --- a/src/libsystemd/sd-varlink/varlink-util.c +++ b/src/libsystemd/sd-varlink/varlink-util.c @@ -3,8 +3,9 @@ #include "alloc-util.h" #include "errno-util.h" #include "log.h" +#include "pidref.h" +#include "set.h" #include "string-util.h" -#include "varlink-internal.h" #include "varlink-util.h" #include "version.h" diff --git a/src/libsystemd/sd-varlink/varlink-util.h b/src/libsystemd/sd-varlink/varlink-util.h index 449b9627670..3a340b22165 100644 --- a/src/libsystemd/sd-varlink/varlink-util.h +++ b/src/libsystemd/sd-varlink/varlink-util.h @@ -3,8 +3,7 @@ #include "sd-varlink.h" -#include "pidref.h" -#include "set.h" +#include "forward.h" int varlink_get_peer_pidref(sd_varlink *v, PidRef *ret); diff --git a/src/systemd/_sd-common.h b/src/systemd/_sd-common.h index 00537eaf164..bf2e20e2011 100644 --- a/src/systemd/_sd-common.h +++ b/src/systemd/_sd-common.h @@ -17,6 +17,13 @@ along with systemd; If not, see . ***/ +#include +#include +#include +#include +#include +#include + /* This is a private header; never even think of including this directly! */ #if defined(__INCLUDE_LEVEL__) && __INCLUDE_LEVEL__ <= 1 && !defined(__COVERITY__) && !defined(__clang_analyzer__) diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h index 4ab5cf674f9..5c11ca8ae5b 100644 --- a/src/systemd/sd-bus-vtable.h +++ b/src/systemd/sd-bus-vtable.h @@ -17,9 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" #include "sd-bus-protocol.h" diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 77cb834121e..8842aa63ec3 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -17,10 +17,7 @@ along with systemd; If not, see . ***/ -#include -#include #include -#include #include #include "_sd-common.h" diff --git a/src/systemd/sd-daemon.h b/src/systemd/sd-daemon.h index a18a9211b90..932e8ea53e0 100644 --- a/src/systemd/sd-daemon.h +++ b/src/systemd/sd-daemon.h @@ -17,9 +17,7 @@ along with systemd; If not, see . ***/ -#include #include -#include #include "_sd-common.h" diff --git a/src/systemd/sd-device.h b/src/systemd/sd-device.h index 71d8c89983b..05e977c5ce1 100644 --- a/src/systemd/sd-device.h +++ b/src/systemd/sd-device.h @@ -17,11 +17,8 @@ along with systemd; If not, see . ***/ -#include -#include #include #include -#include #include "_sd-common.h" #include "sd-event.h" diff --git a/src/systemd/sd-dhcp-client-id.h b/src/systemd/sd-dhcp-client-id.h index 404c01b1ebe..21a237af0a9 100644 --- a/src/systemd/sd-dhcp-client-id.h +++ b/src/systemd/sd-dhcp-client-id.h @@ -17,15 +17,12 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" -#include "sd-dhcp-duid.h" _SD_BEGIN_DECLARATIONS; typedef struct sd_dhcp_client_id sd_dhcp_client_id; +typedef struct sd_dhcp_duid sd_dhcp_duid; int sd_dhcp_client_id_new(sd_dhcp_client_id **ret); sd_dhcp_client_id* sd_dhcp_client_id_free(sd_dhcp_client_id *client_id); diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h index 0fb87e2684a..4e288f08285 100644 --- a/src/systemd/sd-dhcp-client.h +++ b/src/systemd/sd-dhcp-client.h @@ -19,21 +19,20 @@ along with systemd; If not, see . ***/ -#include -#include -#include #include -#include #include "_sd-common.h" -#include "sd-device.h" -#include "sd-dhcp-client-id.h" -#include "sd-dhcp-lease.h" -#include "sd-dhcp-option.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct in_addr; + +typedef struct sd_device sd_device; +typedef struct sd_dhcp_client_id sd_dhcp_client_id; +typedef struct sd_dhcp_lease sd_dhcp_lease; +typedef struct sd_dhcp_option sd_dhcp_option; +typedef struct sd_event sd_event; + enum { SD_DHCP_CLIENT_EVENT_STOP = 0, SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, diff --git a/src/systemd/sd-dhcp-duid.h b/src/systemd/sd-dhcp-duid.h index 555b40e9d89..6451c7fcaeb 100644 --- a/src/systemd/sd-dhcp-duid.h +++ b/src/systemd/sd-dhcp-duid.h @@ -17,9 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h index fa5772019c7..4bdfb5bf2dd 100644 --- a/src/systemd/sd-dhcp-lease.h +++ b/src/systemd/sd-dhcp-lease.h @@ -18,17 +18,14 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include - #include "_sd-common.h" -#include "sd-dhcp-client-id.h" _SD_BEGIN_DECLARATIONS; +struct in_addr; +struct in6_addr; + +typedef struct sd_dhcp_client_id sd_dhcp_client_id; typedef struct sd_dhcp_lease sd_dhcp_lease; typedef struct sd_dhcp_route sd_dhcp_route; typedef struct sd_dns_resolver sd_dns_resolver; diff --git a/src/systemd/sd-dhcp-option.h b/src/systemd/sd-dhcp-option.h index 14141da1dba..bfb5be8b2bd 100644 --- a/src/systemd/sd-dhcp-option.h +++ b/src/systemd/sd-dhcp-option.h @@ -17,11 +17,8 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" -#include "sd-dhcp-protocol.h" +#include "sd-dhcp-protocol.h" /* IWYU pragma: export */ _SD_BEGIN_DECLARATIONS; diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h index 0ef4d132cfd..d6940ac7f86 100644 --- a/src/systemd/sd-dhcp-server.h +++ b/src/systemd/sd-dhcp-server.h @@ -18,16 +18,15 @@ along with systemd; If not, see . ***/ -#include #include #include "_sd-common.h" #include "sd-dhcp-lease.h" -#include "sd-dhcp-option.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +typedef struct sd_event sd_event; +typedef struct sd_dhcp_option sd_dhcp_option; typedef struct sd_dhcp_server sd_dhcp_server; enum { diff --git a/src/systemd/sd-dhcp6-client.h b/src/systemd/sd-dhcp6-client.h index 6054dc44323..b388acc137b 100644 --- a/src/systemd/sd-dhcp6-client.h +++ b/src/systemd/sd-dhcp6-client.h @@ -19,19 +19,18 @@ along with systemd; If not, see . ***/ -#include -#include -#include - #include "_sd-common.h" -#include "sd-device.h" -#include "sd-dhcp-duid.h" -#include "sd-dhcp6-lease.h" -#include "sd-dhcp6-option.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct in6_addr; + +typedef struct sd_dhcp_duid sd_dhcp_duid; +typedef struct sd_dhcp6_option sd_dhcp6_option; +typedef struct sd_dhcp6_lease sd_dhcp6_lease; +typedef struct sd_device sd_device; +typedef struct sd_event sd_event; + enum { SD_DHCP6_CLIENT_EVENT_STOP = 0, SD_DHCP6_CLIENT_EVENT_RESEND_EXPIRE = 10, diff --git a/src/systemd/sd-dhcp6-lease.h b/src/systemd/sd-dhcp6-lease.h index 5d082b0cbe7..766adf3121b 100644 --- a/src/systemd/sd-dhcp6-lease.h +++ b/src/systemd/sd-dhcp6-lease.h @@ -19,16 +19,15 @@ along with systemd; If not, see . ***/ -#include -#include -#include #include "_sd-common.h" -#include "sd-dhcp6-option.h" _SD_BEGIN_DECLARATIONS; +struct in6_addr; + typedef struct sd_dhcp6_lease sd_dhcp6_lease; +typedef struct sd_dhcp6_option sd_dhcp6_option; typedef struct sd_dns_resolver sd_dns_resolver; int sd_dhcp6_lease_get_timestamp(sd_dhcp6_lease *lease, clockid_t clock, uint64_t *ret); diff --git a/src/systemd/sd-dhcp6-option.h b/src/systemd/sd-dhcp6-option.h index 69f3eaa39de..b86441d93f7 100644 --- a/src/systemd/sd-dhcp6-option.h +++ b/src/systemd/sd-dhcp6-option.h @@ -17,11 +17,8 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" -#include "sd-dhcp6-protocol.h" +#include "sd-dhcp6-protocol.h" /* IWYU pragma: export */ _SD_BEGIN_DECLARATIONS; diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h index 4d89b3472c0..ac98b67da45 100644 --- a/src/systemd/sd-event.h +++ b/src/systemd/sd-event.h @@ -17,12 +17,10 @@ along with systemd; If not, see . ***/ -#include #include #include #include #include -#include #include #include diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h index 7be690400d1..da095a1e17f 100644 --- a/src/systemd/sd-id128.h +++ b/src/systemd/sd-id128.h @@ -17,8 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include #include #include "_sd-common.h" diff --git a/src/systemd/sd-ipv4acd.h b/src/systemd/sd-ipv4acd.h index 33879af5166..bcc5222aec1 100644 --- a/src/systemd/sd-ipv4acd.h +++ b/src/systemd/sd-ipv4acd.h @@ -18,15 +18,17 @@ along with systemd; If not, see . ***/ -#include -#include #include #include "_sd-common.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in_addr; + +typedef struct sd_event sd_event; + enum { SD_IPV4ACD_EVENT_STOP = 0, SD_IPV4ACD_EVENT_BIND = 1, diff --git a/src/systemd/sd-ipv4ll.h b/src/systemd/sd-ipv4ll.h index 6c687fef20c..351cce0c2fc 100644 --- a/src/systemd/sd-ipv4ll.h +++ b/src/systemd/sd-ipv4ll.h @@ -19,14 +19,15 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in_addr; + +typedef struct sd_event sd_event; + enum { SD_IPV4LL_EVENT_STOP = 0, SD_IPV4LL_EVENT_BIND = 1, diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h index ca062ca681e..ec1568904e5 100644 --- a/src/systemd/sd-journal.h +++ b/src/systemd/sd-journal.h @@ -17,9 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include -#include #include #include diff --git a/src/systemd/sd-json.h b/src/systemd/sd-json.h index 754ce73db86..fabec8a7a40 100644 --- a/src/systemd/sd-json.h +++ b/src/systemd/sd-json.h @@ -17,10 +17,7 @@ along with systemd; If not, see . ***/ -#include #include -#include -#include #include #include "_sd-common.h" diff --git a/src/systemd/sd-lldp-rx.h b/src/systemd/sd-lldp-rx.h index d4e135512e7..552ab813293 100644 --- a/src/systemd/sd-lldp-rx.h +++ b/src/systemd/sd-lldp-rx.h @@ -17,17 +17,14 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include - #include "_sd-common.h" -#include "sd-event.h" -#include "sd-lldp.h" +#include "sd-lldp.h" /* IWYU pragma: export*/ _SD_BEGIN_DECLARATIONS; +struct ether_addr; + +typedef struct sd_event sd_event; typedef struct sd_lldp_rx sd_lldp_rx; typedef struct sd_lldp_neighbor sd_lldp_neighbor; diff --git a/src/systemd/sd-lldp-tx.h b/src/systemd/sd-lldp-tx.h index 73b9f2ad3c3..107292027da 100644 --- a/src/systemd/sd-lldp-tx.h +++ b/src/systemd/sd-lldp-tx.h @@ -17,17 +17,14 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include - #include "_sd-common.h" -#include "sd-event.h" -#include "sd-lldp.h" +#include "sd-lldp.h" /* IWYU pragma: export*/ _SD_BEGIN_DECLARATIONS; +struct ether_addr; + +typedef struct sd_event sd_event; typedef struct sd_lldp_tx sd_lldp_tx; __extension__ typedef enum _SD_ENUM_TYPE_S64(sd_lldp_multicast_mode_t) { diff --git a/src/systemd/sd-lldp.h b/src/systemd/sd-lldp.h index 4069c5b2999..7c68dc6e331 100644 --- a/src/systemd/sd-lldp.h +++ b/src/systemd/sd-lldp.h @@ -17,8 +17,6 @@ along with systemd; If not, see . ***/ -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; diff --git a/src/systemd/sd-login.h b/src/systemd/sd-login.h index cb80431b16f..dbf69c2106a 100644 --- a/src/systemd/sd-login.h +++ b/src/systemd/sd-login.h @@ -17,9 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" /* diff --git a/src/systemd/sd-ndisc-neighbor.h b/src/systemd/sd-ndisc-neighbor.h index 2ea033741fa..750f048b870 100644 --- a/src/systemd/sd-ndisc-neighbor.h +++ b/src/systemd/sd-ndisc-neighbor.h @@ -17,16 +17,13 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; +struct in6_addr; +struct ether_addr; + typedef struct sd_ndisc_neighbor sd_ndisc_neighbor; sd_ndisc_neighbor *sd_ndisc_neighbor_ref(sd_ndisc_neighbor *na); diff --git a/src/systemd/sd-ndisc-redirect.h b/src/systemd/sd-ndisc-redirect.h index 60b43f769de..6c3a7b9f78d 100644 --- a/src/systemd/sd-ndisc-redirect.h +++ b/src/systemd/sd-ndisc-redirect.h @@ -17,17 +17,14 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in6_addr; +struct ip6_hdr; + typedef struct sd_ndisc_redirect sd_ndisc_redirect; sd_ndisc_redirect* sd_ndisc_redirect_ref(sd_ndisc_redirect *na); diff --git a/src/systemd/sd-ndisc-router-solicit.h b/src/systemd/sd-ndisc-router-solicit.h index ff8c903af83..819f3b874ef 100644 --- a/src/systemd/sd-ndisc-router-solicit.h +++ b/src/systemd/sd-ndisc-router-solicit.h @@ -17,13 +17,11 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include - #include "_sd-common.h" +struct in6_addr; +struct ether_addr; + _SD_BEGIN_DECLARATIONS; typedef struct sd_ndisc_router_solicit sd_ndisc_router_solicit; diff --git a/src/systemd/sd-ndisc-router.h b/src/systemd/sd-ndisc-router.h index a7f1365381c..823f3aede8f 100644 --- a/src/systemd/sd-ndisc-router.h +++ b/src/systemd/sd-ndisc-router.h @@ -17,16 +17,13 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in6_addr; + typedef struct sd_ndisc_router sd_ndisc_router; typedef struct sd_dns_resolver sd_dns_resolver; diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h index a8f8c47b68a..57cb32ef758 100644 --- a/src/systemd/sd-ndisc.h +++ b/src/systemd/sd-ndisc.h @@ -19,21 +19,18 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include - #include "_sd-common.h" -#include "sd-event.h" -#include "sd-ndisc-neighbor.h" -#include "sd-ndisc-protocol.h" -#include "sd-ndisc-redirect.h" -#include "sd-ndisc-router.h" +#include "sd-ndisc-neighbor.h" /* IWYU pragma: export */ +#include "sd-ndisc-protocol.h" /* IWYU pragma: export */ +#include "sd-ndisc-redirect.h" /* IWYU pragma: export */ +#include "sd-ndisc-router.h" /* IWYU pragma: export */ _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in6_addr; + +typedef struct sd_event sd_event; typedef struct sd_ndisc sd_ndisc; __extension__ typedef enum _SD_ENUM_TYPE_S64(sd_ndisc_event_t) { diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h index 5f8f143db1a..ea7a5cf69db 100644 --- a/src/systemd/sd-netlink.h +++ b/src/systemd/sd-netlink.h @@ -17,19 +17,22 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include -#include -#include -#include +#include /* IWYU pragma: export */ #include "_sd-common.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in_addr; +struct in6_addr; +struct sockaddr_in; +struct sockaddr_in6; +struct sock_filter; +struct ifa_cacheinfo; + +typedef struct sd_event sd_event; + typedef struct sd_netlink sd_netlink; typedef struct sd_netlink_message sd_netlink_message; typedef struct sd_netlink_slot sd_netlink_slot; diff --git a/src/systemd/sd-network.h b/src/systemd/sd-network.h index d310d238d07..2a9261b246f 100644 --- a/src/systemd/sd-network.h +++ b/src/systemd/sd-network.h @@ -17,10 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include -#include - #include "_sd-common.h" /* @@ -44,6 +40,8 @@ _SD_BEGIN_DECLARATIONS; +struct stat; + /* Get overall operational state * Possible states: down, up, dormant, carrier, degraded, routable * Possible return codes: diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h index bd3a60150cd..5d5bdfe2066 100644 --- a/src/systemd/sd-path.h +++ b/src/systemd/sd-path.h @@ -17,8 +17,6 @@ along with systemd; If not, see . ***/ -#include - #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; diff --git a/src/systemd/sd-radv.h b/src/systemd/sd-radv.h index 6c1c4154e25..8823049b525 100644 --- a/src/systemd/sd-radv.h +++ b/src/systemd/sd-radv.h @@ -19,18 +19,14 @@ along with systemd; If not, see . ***/ -#include -#include -#include -#include - #include "_sd-common.h" -#include "sd-event.h" -#include "sd-ndisc-protocol.h" -#include "sd-ndisc-router-solicit.h" _SD_BEGIN_DECLARATIONS; +struct ether_addr; +struct in6_addr; + +typedef struct sd_event sd_event; typedef struct sd_radv sd_radv; int sd_radv_new(sd_radv **ret); diff --git a/src/systemd/sd-resolve.h b/src/systemd/sd-resolve.h index 53780406847..ad05bd7e400 100644 --- a/src/systemd/sd-resolve.h +++ b/src/systemd/sd-resolve.h @@ -22,16 +22,16 @@ #define _GNU_SOURCE 1 #endif -#include -#include #include -#include #include "_sd-common.h" -#include "sd-event.h" _SD_BEGIN_DECLARATIONS; +struct addrinfo; + +typedef struct sd_event sd_event; + /* An opaque sd-resolve session structure */ typedef struct sd_resolve sd_resolve; diff --git a/src/systemd/sd-varlink-idl.h b/src/systemd/sd-varlink-idl.h index 0fe49b8677e..c0d49716b0a 100644 --- a/src/systemd/sd-varlink-idl.h +++ b/src/systemd/sd-varlink-idl.h @@ -17,7 +17,6 @@ along with systemd; If not, see . ***/ -#include #include #include "_sd-common.h" diff --git a/src/systemd/sd-varlink.h b/src/systemd/sd-varlink.h index c584112bfaf..d1f50874926 100644 --- a/src/systemd/sd-varlink.h +++ b/src/systemd/sd-varlink.h @@ -17,9 +17,6 @@ along with systemd; If not, see . ***/ -#include -#include - #include "_sd-common.h" #include "sd-event.h" #include "sd-json.h"