diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c index ad61614f12..a017cb7ab2 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 b66a81bf9b..4152c3a098 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 382575e7a2..f43d278cdd 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 247fd9d912..3248e1098b 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 0d3d6b5cef..061786cd02 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 394c71bdf0..0ed8c3fc93 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 207f68a5e6..24b8c12011 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 eb9dab4453..c493cfeee5 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 4945acfd56..a840b61462 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 289e833443..c3738b87c1 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 6dcfe80672..46317c997c 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 751321b92f..a7f2e12b4f 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 b3b247a567..ca872a8081 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 0b2fa96524..1da18cce60 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 f206e0118f..4a36df6ead 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 6c17f5749b..1a84053735 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 2ef8dc8690..5762966c26 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 62c3858841..ac7fb588ef 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 dbe4253164..b794d8858c 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 2767c6f7fc..1de4bacd1b 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 614b4f8a43..9deee41ae4 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 39f5040f9d..75608348cd 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 a02aa05bf2..1ae775096d 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 3ed21ee175..23471f89fc 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 3cfcab7e99..62c2d822f2 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 3f83aae34d..47e3c9efa9 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 2b6e3357e9..aaa95c2b9d 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 00e6d81809..8567e433ae 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 e6ee76895f..0576821666 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 fe531ba14a..b4e8e7f851 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 cb961ff641..3ae33a2039 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 3c781095bc..761f6a0fb5 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 d7b0cc84b3..124cab5552 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 58c473c048..4347f8b723 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 9e5063f51b..a904564dfe 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 dd2a221403..e93cf566fa 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 f7945c2edf..9a2dc7d81d 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 598669fe20..38e5ddb691 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 bc69b324c2..b2ae00fb4a 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 33f0add399..9c451c183d 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 4e82fd5a86..f0488cff8d 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 aee655665e..295c093b43 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 d0f95c896f..d66f3d235e 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 d9408be79a..8517f68dfb 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 e35263a05d..77d6f8b88f 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 6df72fd3cc..025cc146a4 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 6f0b0af13a..2186238a6f 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 1750f1810b..933ce170b7 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 1563655b79..e7c22c9b76 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 6a102e92c4..aace983d5b 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 5ed7784a85..0e34176e8c 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 d1280fb619..77614718d7 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 56e9747528..2cb60b92ce 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 4782ec62d7..b0caa10976 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 2eb9bf25ee..a98ec7fc63 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 d9ea5304e8..35a1e7bb18 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 88c51d5458..af87b15238 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 b806a7debb..36585c8554 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 2ff1e87a2e..4d8df252c8 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 673208106c..e7f69da202 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 5acd4fe4f6..8a574263cc 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 17db4a53f7..87bf46ad29 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 557c145509..b679d206e6 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 029ee0282c..288ed2ee96 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 38a619168e..9e93a77cd1 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 1bb6ebf610..5ce1da06da 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 a1fceb2dff..1637ad36a2 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 742ec9a1d2..ccd14be3cb 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 6936ea34e2..69fab9f6d0 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 ca15f942f5..0f2f94eab6 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 48a198099d..02d6131e8a 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 c00e87605a..e85a9d267a 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 fe2a88d8f3..72d8ad4d0c 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 2a07256ea0..9e36e03859 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 a067fc0da5..61189fe545 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 195aa14594..0775209e02 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 1fc6d11b88..97f5408702 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 17c981307b..a26000d5f1 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 704c9a0015..7f497a4de4 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 cc7007f15a..84dc73e84f 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 effed11615..71af4c2478 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 52bd9fa637..2b40ea77a3 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 5bb0b39180..32f9a6b9a3 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 1075c29ed6..812e75a302 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 54da4169a6..73e86bb78c 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 cb503a5970..bca37304c0 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 fdcd5ff2da..daa700ebf5 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 1cd4fb88d9..56b4a70cda 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 b59338a5d1..034ee49f00 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 9e93712bfd..700e7d24a9 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 d7ad1dc96b..089442e885 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 d753f50a0c..b6fc5f598f 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 07df7d7d34..d71274968c 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 e7470ba681..ba38da1686 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 9b812dd36c..b61df06632 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 c8768c9a7b..3757fe7c27 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 6a448c797f..ffb99bd824 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 25fe4bd956..e9052b76b3 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 4c3914ff96..2bbc932939 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 83bcfb2dad..f9d87c499b 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 b726957c76..90fc60afbd 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 be8e0ceb9b..c364f62a8d 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 a07d9d0521..fc05f385e8 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 138123c70b..622e00d94c 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 8eff8781ab..6636285526 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 76f0d853d3..0f1cc8f33e 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 e7ec43a19d..3e827770c8 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 20fccfa1d8..51bfa70ae5 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 be46b5f6a7..92e251727c 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 16693bcad6..d2f202067b 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 0fea750744..b75df7335d 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 ed9da96638..3b6debadb0 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 8116195d4d..5bd3b081ea 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 7271c68971..9d911aaaa6 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 fc8c1eda09..1c1d3561ee 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 3c3e0c18ec..9e5b5e9620 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 6868cda1e2..0ecd42e6d3 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 d1fc836dde..91b76b4c02 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 490108a2c6..0e851b0249 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 16da534245..e6e3dd97d0 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 e369f532c9..e2c4167f3c 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 b0d0b0e1d1..c13a898212 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 78ae564aeb..4063d79159 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 d06853b22c..df1be5ceca 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 b569986a94..7c9899e129 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 31b04002b5..d52683ea87 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 2d7755711e..7b212c8eaa 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 c9ec474856..fac3e15085 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 8b11a7af33..32072097ba 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 7c2fa72e84..debe78c7e2 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 8049e33294..68f5e00040 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 5a4c811864..2417208281 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 5604e84f52..4f14787f30 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 bc6be901ad..17cd1bb51c 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 f7ba14a6a8..c6c072440e 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 b7635a60b6..14733d0f17 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 cf62fabdad..f4b836e16a 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 8230763ddd..1b2b534530 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 bf7d4d4be5..cffc91ce93 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 0c5f34e242..d72cbab7e8 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 cbd89849bd..1f9cf59d51 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 79f9d834ff..309d4979e2 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 99bdc7f342..5ae1eb6390 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 270e0293e1..9896e0e7ac 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 7d609d1a41..b5a24dde1c 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 5169c24d84..718b703066 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 5b899ecfcd..136d399d7e 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 c90d267456..aef02350cc 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 aa3fb8215f..030beff8b3 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 362ce0a85e..c1c720b364 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 539dabd7a6..1738ddb620 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 ff59d3bd50..4173f76dd8 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 d05bcf0538..3be9a0e6c1 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 d7f15882c8..7e8c481bcf 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 02dc3929ca..7cc56a38d8 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 5e055330e0..6d8a207b5d 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 6394507994..23a45c7276 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 b26eb594ed..65c810416a 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 fce62e12e4..bc96e40907 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 44b0e1ddda..f5dcf2ecf2 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 458d430771..874fc9f446 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 54fb403a54..54fab9284a 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 fffc58ad92..85b4c47bb0 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 1ecf335fb8..3ca3b2dab4 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 e6a8c9b8db..c2a20aaddb 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 a0594cd438..f65c5f9e06 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 9ad9ce3ef3..60a60f26f5 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 e895722865..21c69ad30b 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 28cccca21a..f3fef931d0 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 dfc3e8aa91..ec06ea8e20 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 89b06b0834..12a6646853 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 badec0e943..15dc934db0 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 d043e1882d..8a1e0b1fdf 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 6fe6325090..e5394e9471 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 b50a0179d0..7301b72e95 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 d87c847da6..e134a9d4b9 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 87d66aac43..db566288b7 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 04e493e95e..e4709490e2 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 49e1e5fc81..2c2f6c677d 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 3e088ef8ef..bdd3494589 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 b6d3a7f627..8ec1fe450c 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 ee8bd4e0ec..d86fd533f7 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 ff4f86329b..6530cdae8f 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 d101fe76f2..cc17ea1891 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 729de1fe52..52b1328fb0 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 05252d7f09..ef5acca9c0 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 45663b0dbe..7f7e12fbdd 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 9703f46c42..d5d6506a44 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 c2c345fb07..2b3886445d 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 ca1fe7c303..e4959521f6 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 c8103bf113..512ec132ef 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 9bf4f86258..bc66a96aee 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 6f6aa9d275..fb0a02d9bf 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 ce5ea123c6..dc7e334247 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 9ecdd6bb1a..d42d1c6be5 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 a4beb54cba..2c7f3240b6 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 861c1876ff..0d0f41bf37 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 03f94ce663..9add7be9a8 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 cf5f39b90a..efe40c70f5 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 f7dab9b723..a4ab2659b2 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 a388a199a9..1153fb0965 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 9c31105772..d4d33ae52d 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 b06be05952..ea9135ac32 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 7346902bdc..625b73263a 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 321b9b2006..d33a690e36 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 b730b63fb0..ee6bba8d03 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 76617b686d..e55b0f0da5 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 145c376ca4..f1e270de6a 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 4098061d31..9ed1746b61 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 0ed222ea20..177be0c2bc 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 043913889c..e12e55a285 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 0f00e3f2fc..28fd2bc3d9 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 ebb091b90f..422ae7e691 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 1412514f9b..d634098eba 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 8ef4d45d42..289040935b 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 7af44ab144..4dc98f0504 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 146f4177fd..6b72efb86b 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 e10a90c5aa..c9951a040e 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 85ff925edd..99d1246ef6 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 2a56182750..3cb5820ff6 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 25b27291ba..a25e38d473 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 d71a1c579c..57e5a65214 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 252bb46b6e..ae29b438df 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 80b4cc3cd6..84ae36ad36 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 60213c2fcf..9d95f8b5be 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 a3b09208cb..3ddbda0e9f 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 1289e7ac6f..8457053339 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 b8fd0ae0a7..f562e3a7ec 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 81052e7ec1..03ebfbb02c 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 7a599925f4..18e29d9835 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 1184bd5951..c0afc8c4e7 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 d20b36704f..3255bf8ed3 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 990eb804a9..0640a26995 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 5ff233f210..a163f81061 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 438ef6bd7a..dfefe08862 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 449b962767..3a340b2216 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 00537eaf16..bf2e20e201 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 4ab5cf674f..5c11ca8ae5 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 77cb834121..8842aa63ec 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 a18a9211b9..932e8ea53e 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 71d8c89983..05e977c5ce 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 404c01b1eb..21a237af0a 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 0fb87e2684..4e288f0828 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 555b40e9d8..6451c7fcae 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 fa5772019c..4bdfb5bf2d 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 14141da1db..bfb5be8b2b 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 0ef4d132cf..d6940ac7f8 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 6054dc4432..b388acc137 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 5d082b0cbe..766adf3121 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 69f3eaa39d..b86441d93f 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 4d89b3472c..ac98b67da4 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 7be690400d..da095a1e17 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 33879af516..bcc5222aec 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 6c687fef20..351cce0c2f 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 ca062ca681..ec1568904e 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 754ce73db8..fabec8a7a4 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 d4e135512e..552ab81329 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 73b9f2ad3c..107292027d 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 4069c5b299..7c68dc6e33 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 cb80431b16..dbf69c2106 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 2ea033741f..750f048b87 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 60b43f769d..6c3a7b9f78 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 ff8c903af8..819f3b874e 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 a7f1365381..823f3aede8 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 a8f8c47b68..57cb32ef75 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 5f8f143db1..ea7a5cf69d 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 d310d238d0..2a9261b246 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 bd3a60150c..5d5bdfe206 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 6c1c4154e2..8823049b52 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 5378040684..ad05bd7e40 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 0fe49b8677..c0d49716b0 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 c584112bfa..d1f5087492 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"