]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: Clean up includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 09:17:20 +0000 (11:17 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 24 May 2025 12:00:44 +0000 (14:00 +0200)
Split out of #37344.

394 files changed:
src/libsystemd/sd-bus/test-bus-address.c
src/libsystemd/sd-journal/test-journal-flush.c
src/libsystemd/sd-journal/test-journal-interleaving.c
src/libsystemd/sd-journal/test-journal.c
src/libsystemd/sd-login/test-login.c
src/libsystemd/sd-login/test-sd-login.c
src/shared/acl-util.c
src/shared/acl-util.h
src/shared/acpi-fpdt.c
src/shared/acpi-fpdt.h
src/shared/apparmor-util.c
src/shared/apparmor-util.h
src/shared/ask-password-agent.c
src/shared/ask-password-agent.h
src/shared/ask-password-api.c
src/shared/ask-password-api.h
src/shared/async.c
src/shared/async.h
src/shared/barrier.c
src/shared/barrier.h
src/shared/base-filesystem.c
src/shared/base-filesystem.h
src/shared/battery-util.h
src/shared/binfmt-util.c
src/shared/bitmap.c
src/shared/bitmap.h
src/shared/blkid-util.c
src/shared/blkid-util.h
src/shared/blockdev-list.c
src/shared/blockdev-list.h
src/shared/blockdev-util.c
src/shared/blockdev-util.h
src/shared/bond-util.h
src/shared/boot-entry.c
src/shared/boot-entry.h
src/shared/boot-timestamps.c
src/shared/boot-timestamps.h
src/shared/bootspec.c
src/shared/bootspec.h
src/shared/bpf-dlopen.c
src/shared/bpf-dlopen.h
src/shared/bpf-link.h
src/shared/bpf-program.c
src/shared/bpf-program.h
src/shared/bridge-util.h
src/shared/btrfs-util.c
src/shared/btrfs-util.h
src/shared/bus-get-properties.c
src/shared/bus-get-properties.h
src/shared/bus-locator.c
src/shared/bus-locator.h
src/shared/bus-log-control-api.c
src/shared/bus-log-control-api.h
src/shared/bus-map-properties.c
src/shared/bus-map-properties.h
src/shared/bus-message-util.c
src/shared/bus-message-util.h
src/shared/bus-object.c
src/shared/bus-object.h
src/shared/bus-polkit.c
src/shared/bus-polkit.h
src/shared/bus-print-properties.c
src/shared/bus-print-properties.h
src/shared/bus-unit-procs.c
src/shared/bus-unit-procs.h
src/shared/bus-unit-util.c
src/shared/bus-unit-util.h
src/shared/bus-util.c
src/shared/bus-util.h
src/shared/bus-wait-for-jobs.c
src/shared/bus-wait-for-jobs.h
src/shared/bus-wait-for-units.c
src/shared/bus-wait-for-units.h
src/shared/calendarspec.c
src/shared/calendarspec.h
src/shared/cgroup-setup.c
src/shared/cgroup-setup.h
src/shared/cgroup-show.c
src/shared/cgroup-show.h
src/shared/chown-recursive.c
src/shared/chown-recursive.h
src/shared/clean-ipc.c
src/shared/clean-ipc.h
src/shared/clock-util.c
src/shared/color-util.c
src/shared/color-util.h
src/shared/common-signal.c
src/shared/common-signal.h
src/shared/compare-operator.h
src/shared/condition.c
src/shared/condition.h
src/shared/conf-parser.c
src/shared/conf-parser.h
src/shared/copy.c
src/shared/copy.h
src/shared/coredump-util.h
src/shared/cpu-set-util.c
src/shared/cpu-set-util.h
src/shared/creds-util.c
src/shared/creds-util.h
src/shared/cryptsetup-fido2.c
src/shared/cryptsetup-fido2.h
src/shared/cryptsetup-tpm2.c
src/shared/cryptsetup-tpm2.h
src/shared/cryptsetup-util.c
src/shared/cryptsetup-util.h
src/shared/daemon-util.c
src/shared/daemon-util.h
src/shared/data-fd-util.c
src/shared/data-fd-util.h
src/shared/dev-setup.c
src/shared/dev-setup.h
src/shared/device-nodes.c
src/shared/device-nodes.h
src/shared/discover-image.c
src/shared/discover-image.h
src/shared/dissect-image.c
src/shared/dissect-image.h
src/shared/dns-domain.c
src/shared/dns-domain.h
src/shared/dropin.c
src/shared/dropin.h
src/shared/edit-util.c
src/shared/edit-util.h
src/shared/efi-api.c
src/shared/efi-api.h
src/shared/efi-loader.c
src/shared/efi-loader.h
src/shared/elf-util.c
src/shared/elf-util.h
src/shared/enable-mempool.c
src/shared/env-file-label.h
src/shared/ethtool-util.c
src/shared/ethtool-util.h
src/shared/exec-util.c
src/shared/exec-util.h
src/shared/exit-status.c
src/shared/exit-status.h
src/shared/extension-util.c
src/shared/extension-util.h
src/shared/factory-reset.c
src/shared/factory-reset.h
src/shared/fdisk-util.c
src/shared/fdisk-util.h
src/shared/fdset.c
src/shared/fdset.h
src/shared/fido2-util.c
src/shared/fido2-util.h
src/shared/find-esp.c
src/shared/find-esp.h
src/shared/firewall-util-iptables.c
src/shared/firewall-util-nft.c
src/shared/firewall-util-private.h
src/shared/firewall-util.c
src/shared/firewall-util.h
src/shared/fork-journal.c
src/shared/fork-journal.h
src/shared/format-table.c
src/shared/format-table.h
src/shared/fstab-util.c
src/shared/fstab-util.h
src/shared/generator.c
src/shared/generator.h
src/shared/geneve-util.h
src/shared/gpt.c
src/shared/gpt.h
src/shared/group-record.c
src/shared/group-record.h
src/shared/hibernate-util.c
src/shared/hibernate-util.h
src/shared/hostname-setup.c
src/shared/hostname-setup.h
src/shared/hwdb-util.c
src/shared/hwdb-util.h
src/shared/id128-print.c
src/shared/id128-print.h
src/shared/idn-util.c
src/shared/idn-util.h
src/shared/ima-util.h
src/shared/image-policy.c
src/shared/image-policy.h
src/shared/import-util.c
src/shared/import-util.h
src/shared/in-addr-prefix-util.c
src/shared/in-addr-prefix-util.h
src/shared/initreq.h
src/shared/install-file.c
src/shared/install-file.h
src/shared/install-printf.c
src/shared/install-printf.h
src/shared/install.c
src/shared/install.h
src/shared/ip-protocol-list.c
src/shared/ip-protocol-list.h
src/shared/ipvlan-util.c
src/shared/ipvlan-util.h
src/shared/journal-file-util.c
src/shared/journal-file-util.h
src/shared/journal-importer.c
src/shared/journal-importer.h
src/shared/journal-util.c
src/shared/journal-util.h
src/shared/kbd-util.h
src/shared/kernel-config.c
src/shared/kernel-config.h
src/shared/kernel-image.c
src/shared/kernel-image.h
src/shared/killall.c
src/shared/killall.h
src/shared/label-util.c
src/shared/label-util.h
src/shared/libarchive-util.c
src/shared/libarchive-util.h
src/shared/libaudit-util.c
src/shared/libaudit-util.h
src/shared/libcrypt-util.c
src/shared/libcrypt-util.h
src/shared/libfido2-util.c
src/shared/libfido2-util.h
src/shared/libmount-util.c
src/shared/libmount-util.h
src/shared/local-addresses.c
src/shared/local-addresses.h
src/shared/locale-setup.c
src/shared/locale-setup.h
src/shared/logs-show.c
src/shared/logs-show.h
src/shared/loop-util.c
src/shared/loop-util.h
src/shared/loopback-setup.c
src/shared/machine-credential.c
src/shared/machine-credential.h
src/shared/machine-id-setup.c
src/shared/machine-id-setup.h
src/shared/machine-pool.c
src/shared/machine-pool.h
src/shared/macvlan-util.c
src/shared/macvlan-util.h
src/shared/main-func.c
src/shared/main-func.h
src/shared/meson.build
src/shared/mkdir-label.c
src/shared/mkdir-label.h
src/shared/mkfs-util.c
src/shared/mkfs-util.h
src/shared/module-util.c
src/shared/module-util.h
src/shared/mount-setup.c
src/shared/mount-setup.h
src/shared/mount-util.c
src/shared/mount-util.h
src/shared/net-condition.c
src/shared/net-condition.h
src/shared/netif-naming-scheme.c
src/shared/netif-naming-scheme.h
src/shared/netif-sriov.c
src/shared/netif-sriov.h
src/shared/netif-util.c
src/shared/netif-util.h
src/shared/notify-recv.c
src/shared/notify-recv.h
src/shared/nsflags.c
src/shared/nsflags.h
src/shared/nsresource.c
src/shared/nsresource.h
src/shared/numa-util.c
src/shared/numa-util.h
src/shared/open-file.c
src/shared/open-file.h
src/shared/openssl-util.c
src/shared/openssl-util.h
src/shared/osc-context.c
src/shared/osc-context.h
src/shared/output-mode.c
src/shared/output-mode.h
src/shared/pager.c
src/shared/pager.h
src/shared/pam-util.c
src/shared/pam-util.h
src/shared/parse-argument.c
src/shared/parse-argument.h
src/shared/parse-helpers.h
src/shared/password-quality-util-passwdqc.c
src/shared/password-quality-util-passwdqc.h
src/shared/password-quality-util-pwquality.c
src/shared/password-quality-util-pwquality.h
src/shared/password-quality-util.h
src/shared/pcre2-util.c
src/shared/pcre2-util.h
src/shared/pcrextend-util.c
src/shared/pe-binary.h
src/shared/pkcs11-util.c
src/shared/pkcs11-util.h
src/shared/plymouth-util.c
src/shared/plymouth-util.h
src/shared/polkit-agent.c
src/shared/polkit-agent.h
src/shared/portable-util.c
src/shared/portable-util.h
src/shared/pretty-print.c
src/shared/pretty-print.h
src/shared/ptyfwd.c
src/shared/ptyfwd.h
src/shared/qrcode-util.c
src/shared/qrcode-util.h
src/shared/quota-util.c
src/shared/quota-util.h
src/shared/reboot-util.c
src/shared/reboot-util.h
src/shared/recovery-key.c
src/shared/recovery-key.h
src/shared/resize-fs.c
src/shared/resize-fs.h
src/shared/resolve-util.c
src/shared/resolve-util.h
src/shared/rm-rf.c
src/shared/rm-rf.h
src/shared/seccomp-util.c
src/shared/seccomp-util.h
src/shared/securebits-util.c
src/shared/securebits-util.h
src/shared/selinux-util.c
src/shared/selinux-util.h
src/shared/serialize.c
src/shared/serialize.h
src/shared/service-util.c
src/shared/service-util.h
src/shared/shift-uid.c
src/shared/shift-uid.h
src/shared/sleep-config.c
src/shared/sleep-config.h
src/shared/smack-util.c
src/shared/smack-util.h
src/shared/smbios11.c
src/shared/smbios11.h
src/shared/socket-label.c
src/shared/socket-netlink.c
src/shared/socket-netlink.h
src/shared/specifier.c
src/shared/specifier.h
src/shared/switch-root.c
src/shared/switch-root.h
src/shared/test-tables.h
src/shared/tests.c
src/shared/tests.h
src/shared/tmpfile-util-label.h
src/shared/tomoyo-util.h
src/shared/tpm2-event-log.h
src/shared/tpm2-util.c
src/shared/tpm2-util.h
src/shared/udev-util.c
src/shared/udev-util.h
src/shared/unit-file.c
src/shared/unit-file.h
src/shared/user-record-nss.c
src/shared/user-record-nss.h
src/shared/user-record-show.c
src/shared/user-record-show.h
src/shared/user-record.c
src/shared/user-record.h
src/shared/userdb-dropin.c
src/shared/userdb-dropin.h
src/shared/userdb.c
src/shared/userdb.h
src/shared/utmp-wtmp.c
src/shared/utmp-wtmp.h
src/shared/varlink-io.systemd.Login.c
src/shared/varlink-io.systemd.Manager.c
src/shared/varlink-io.systemd.Udev.h
src/shared/varlink-io.systemd.service.c
src/shared/varlink-serialize.c
src/shared/varlink-serialize.h
src/shared/vconsole-util.c
src/shared/vconsole-util.h
src/shared/verb-log-control.c
src/shared/verb-log-control.h
src/shared/verbs.c
src/shared/verbs.h
src/shared/vlan-util.c
src/shared/vlan-util.h
src/shared/volatile-util.c
src/shared/volatile-util.h
src/shared/vpick.c
src/shared/vpick.h
src/shared/wall.c
src/shared/wall.h
src/shared/watchdog.c
src/shared/watchdog.h
src/shared/web-util.c
src/shared/web-util.h
src/shared/wifi-util.c
src/shared/wifi-util.h
src/shared/xml.c
src/shared/xml.h

index 347ba1a39b0554aa92f18954e6b35b7c80e9c1b6..ab668060f308816ad3e17c1c22baf83f701b9653 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "sd-bus.h"
 
+#include "argv-util.h"
 #include "bus-internal.h"
 #include "log.h"
 #include "string-util.h"
index 309220e20a5c6270b118836b1b7bfccfa98994da..05252d7f096ef9f2ce291d4a844f1eb2378df093 100644 (file)
@@ -6,6 +6,7 @@
 #include "sd-journal.h"
 
 #include "alloc-util.h"
+#include "argv-util.h"
 #include "chattr-util.h"
 #include "dirent-util.h"
 #include "fd-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 "tmpfile-util.h"
 
index 6d5eacff02049d0a9f7a9d06611b129b6157477a..9703f46c429423bff97e96df7e42442aa9ef8760 100644 (file)
@@ -7,6 +7,7 @@
 #include "sd-journal.h"
 
 #include "alloc-util.h"
+#include "argv-util.h"
 #include "chattr-util.h"
 #include "iovec-util.h"
 #include "journal-file-util.h"
index 8892bec2cbf8cdf692f5aa149b991abef1b4e3ef..6f6aa9d275193daf2ff0f9738c8e9f08b2dc4809 100644 (file)
@@ -3,6 +3,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "argv-util.h"
 #include "chattr-util.h"
 #include "iovec-util.h"
 #include "journal-authenticate.h"
index 66e427411e4e55cbc818d580462096ced068daa5..f7dab9b72363d3c1058ed663cf9dbe0d97a4c69b 100644 (file)
@@ -8,6 +8,7 @@
 #include "sd-login.h"
 
 #include "alloc-util.h"
+#include "argv-util.h"
 #include "errno-list.h"
 #include "fd-util.h"
 #include "format-util.h"
index a9026eb418250f58874dd93da3814206120e1b51..a388a199a96d6fd08b677f9e656aba94533a7c22 100644 (file)
@@ -3,8 +3,10 @@
 #include "sd-login.h"
 
 #include "alloc-util.h"
+#include "format-util.h"
 #include "main-func.h"
 #include "parse-util.h"
+#include "strv.h"
 #include "tests.h"
 
 static const char *arg_verb = NULL;  /* NULL means all */
index b5c8fa01357395e03c358d87051921474daecc56..a057e8028ce0e3e2ce0a58c1d24e423abf28017b 100644 (file)
@@ -1,15 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdbool.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "acl-util.h"
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "extract-word.h"
-#include "log.h"
 #include "string-util.h"
 #include "strv.h"
 #include "user-util.h"
index 8d62e6460f3ea3aeb3b413be26633147105540d2..2164017de3c6c979c20f20220cfb649e897e4397 100644 (file)
@@ -1,19 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <unistd.h>
+#include "forward.h"
 
 int fd_acl_make_read_only_fallback(int fd);
 int fd_acl_make_writable_fallback(int fd);
 
 #if HAVE_ACL
-#include <acl/libacl.h>
-#include <stdbool.h>
-#include <sys/acl.h>
-
-#include "macro.h"
-#include "memory-util.h"
+#include <acl/libacl.h> /* IWYU pragma: export */
+#include <sys/acl.h>    /* IWYU pragma: export */
 
 int calc_acl_mask_if_needed(acl_t *acl_p);
 int add_base_acls_if_needed(acl_t *acl_p, const char *path);
index 22a36bdd2432bd073b94d282a259844cf898486c..d1551acbc91acbdd5ff4d02d66ac5a88d564f97e 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stddef.h>
-#include <stdint.h>
 #include <string.h>
 #include <unistd.h>
 
index 56f8c9e07701e09ffb4997d393791a451e516534..167813a462aca240515e706f61f68a18578d8efa 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <time-util.h>
+#include "forward.h"
 
 int acpi_get_boot_usec(usec_t *ret_loader_start, usec_t *ret_loader_exit);
index cddf23073eb15eed8aa9423420d25e8cec67b52a..2878517fe971b07256c91f85d27ae2a6d3b59dca 100644 (file)
@@ -1,11 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <stddef.h>
+#include <syslog.h>
 
 #include "alloc-util.h"
 #include "apparmor-util.h"
 #include "fileio.h"
-#include "log.h"
 #include "parse-util.h"
 
 #if HAVE_APPARMOR
index b1b511aed5e32022988d37813a49cfe7c9a5b5ae..3d9df43c714b41d4c7a9a09fc91a916853f8cc8b 100644 (file)
@@ -1,15 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-
-#include "dlfcn-util.h"
+#include "forward.h"
 
 #if HAVE_APPARMOR
 #  include <sys/apparmor.h>
 
-#include "memory-util.h"
+#  include "dlfcn-util.h"
 
 extern DLSYM_PROTOTYPE(aa_change_onexec);
 extern DLSYM_PROTOTYPE(aa_change_profile);
index c5898ca5640464a6b2cd04ca3d2bbe66a2eb4842..015d413506c7e08fa8a57010a933f21b157b5906 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
 
 #include "ask-password-agent.h"
+#include "bus-util.h"
 #include "exec-util.h"
 #include "log.h"
 #include "process-util.h"
index a76cdb11fea3f0df804f7a76f547af1a7e765745..610f910905f60813dfff9be6b81e85c09486bf7f 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "bus-util.h"
+#include "forward.h"
 
 int ask_password_agent_open(void);
 void ask_password_agent_close(void);
index a52d874ad85fb04f678b077c1be03c9ef97c3b41..5709987ce41e018fa29f2bb3dc4db16a619b1da3 100644 (file)
@@ -1,20 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
+#include <poll.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/inotify.h>
 #include <sys/signalfd.h>
 #include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/un.h>
 #include <termios.h>
 #include <unistd.h>
 
@@ -22,7 +13,6 @@
 #include "ansi-color.h"
 #include "ask-password-api.h"
 #include "creds-util.h"
-#include "env-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "format-util.h"
 #include "iovec-util.h"
 #include "keyring-util.h"
 #include "log.h"
-#include "macro.h"
-#include "memory-util.h"
 #include "missing_syscall.h"
-#include "mkdir-label.h"
 #include "nulstr-util.h"
 #include "parse-util.h"
 #include "path-lookup.h"
index f39a3459d6a8fb987b7c55464994bb581b9e93a7..4756e517b19176803073cd80836d53d8ab0abcd7 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "time-util.h"
+#include "forward.h"
 
 typedef enum AskPasswordFlags {
         ASK_PASSWORD_ACCEPT_CACHED = 1 << 0,  /* read from kernel keyring */
index c8f755cb2ecfd1f5f8dad4dd1d54818e419e4416..0d5fbc13a7b6992d9229338132ed6c792ba3698e 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
+#include <sched.h>
 #include <sys/prctl.h>
 #include <sys/wait.h>
 #include <unistd.h>
@@ -10,8 +9,8 @@
 #include "errno-util.h"
 #include "fd-util.h"
 #include "log.h"
-#include "macro.h"
 #include "process-util.h"
+#include "rm-rf.h"
 #include "signal-util.h"
 
 int asynchronous_sync(PidRef *ret_pid) {
index c49b385308309e396dd665964e337245ab8636f0..d887a4ca5512ce24228f04be2c45bf65ce39e63f 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
-
-#include "macro.h"
-#include "pidref.h"
-#include "rm-rf.h"
+#include "forward.h"
 
 /* These functions implement various potentially slow operations that are executed asynchronously. They are
  * carefully written to not use pthreads, but use fork() or clone() (without CLONE_VM) so that the child does
index bd5bdd75908985f13ecfa297fe82196d511d0e47..d08a78d49a9b751582ccdeee9cd83e4b82412057 100644 (file)
@@ -1,19 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
+#include <poll.h>
 #include <sys/eventfd.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "barrier.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "io-util.h"
-#include "macro.h"
 
 /**
  * Barriers
index d9e185646f2f57a842d13df758c7ae37846b64af..0be490bd5458ad1a832d0aa31cd61156d85115cc 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include "macro.h"
-#include "memory-util.h"
+#include "forward.h"
 
 /* See source file for an API description. */
 
index 8cb49c47663c495429cf86c9499ea64526afb7f6..080e13a17a5e65e28f28f2c498cb283ca31eb70d 100644 (file)
@@ -1,23 +1,17 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stdbool.h>
-#include <stdlib.h>
 #include <sys/stat.h>
 #include <syslog.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "architecture.h"
 #include "base-filesystem.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "log.h"
-#include "macro.h"
 #include "nulstr-util.h"
 #include "path-util.h"
-#include "string-util.h"
 #include "umask-util.h"
 #include "user-util.h"
 
index a1ccf451c4752c80a36429fc0725b429716b633a..5c5aa573ef05156089c46520f8b61920021d954c 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include "forward.h"
 
 int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid);
 int base_filesystem_create(const char *root, uid_t uid, gid_t gid);
index c58f30b0b155c76952820bdc28143a8759a82bb0..3c39fc76c9aee5687900ed6b9b9796b2354d1e76 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-device.h"
+#include "forward.h"
 
 int on_ac_power(void);
 
index c96ad24b3d2c129809eb7dc702b1713baeee50dd..c88ce2cd0e29903374f6ac81202d284e8854ff82 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <sys/stat.h>
-#include <sys/statvfs.h>
 #include <sys/vfs.h>
 
 #include "binfmt-util.h"
index 9aa766139bb05c232f13233c19e42f423353cfea..d88a7895d6e69b501a96a4fa68b4f63a585dcc57 100644 (file)
@@ -1,15 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
 
 #include "alloc-util.h"
 #include "bitmap.h"
-#include "hashmap.h"
-#include "macro.h"
 #include "memory-util.h"
 
 /* Bitmaps are only meant to store relatively small numbers
index e77e2e1f889d62015ed3f2cdf012b9142fae7457..cb9a951235cb428aa8198ba59bae3e03fd496897 100644 (file)
@@ -1,10 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "hashmap.h"
-#include "macro.h"
+#include "forward.h"
+#include "iterator.h"
 
 typedef struct Bitmap {
         uint64_t *bitmaps;
index 5446eb0f916b4e0dc2bcfb115162418918701b72..34953ce2a48c5b76b0903120d9815ccc42ad6429 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
-
 #if HAVE_BLKID
 
-#include <errno.h>
+#include "sd-id128.h"
 
 #include "blkid-util.h"
 #include "string-util.h"
index fab4ab298708b769d7ddffcaaf88117f0783ff43..502b867024041b1a8460840ba3d4981bbc845d7e 100644 (file)
@@ -5,9 +5,7 @@
 
 #include <blkid.h>
 
-#include "sd-id128.h"
-
-#include "memory-util.h"
+#include "forward.h"
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(blkid_probe, blkid_free_probe, NULL);
 
index 4c43fb67622f8b8c035658de210c132b69d68359..0e7cd99fad2e424d82ddade16ae404bae3f835b5 100644 (file)
@@ -6,7 +6,6 @@
 #include "blockdev-list.h"
 #include "blockdev-util.h"
 #include "device-util.h"
-#include "macro.h"
 #include "strv.h"
 #include "terminal-util.h"
 
index 7fbf824ab2cf0d5de70a6a0c3ed7811f0759d793..f569cf22e36de73961e28a12aaddd371af9a9f2c 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 typedef enum BlockDevListFlags {
         BLOCKDEV_LIST_SHOW_SYMLINKS              = 1 << 0,
         BLOCKDEV_LIST_REQUIRE_PARTITION_SCANNING = 1 << 1,
index b5c82aaccd68f45279c211aa4ae0f687cc54aa8f..42a5c08b7293b9521a2f9c7f1e5564dd1bfb2ee7 100644 (file)
@@ -1,9 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <linux/blkpg.h>
+#include <linux/fs.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
-#include <sys/mount.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "sd-device.h"
@@ -19,8 +20,9 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
-#include "missing_magic.h"
 #include "parse-util.h"
+#include "path-util.h"
+#include "string-util.h"
 
 static int fd_get_devnum(int fd, BlockDeviceLookupFlag flags, dev_t *ret) {
         struct stat st;
index df52d78c59e0d0905354aedb522d210b8db30533..8bb890aefbbc21cc7f0b4746e4ab67b07b731ca9 100644 (file)
@@ -1,13 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 
-#include "sd-device.h"
-
-#include "macro.h"
+#include "forward.h"
 #include "stdio-util.h"
-#include "string-util.h"
 
 #define SYS_BLOCK_PATH_MAX(suffix)                                      \
         (STRLEN("/sys/dev/block/") + DECIMAL_STR_MAX(dev_t) + 1 + DECIMAL_STR_MAX(dev_t) + STRLEN(suffix))
index 84b18942ee64da431510a0ed7df501389f8b1e2c..11fefedc27c8bd4a39ce423e98968f4b9774c6c1 100644 (file)
@@ -1,11 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
 #include <linux/if_bonding.h>
-#include <netinet/in.h>
 
-#include "macro.h"
+#include "forward.h"
 
 /*
  * Maximum number of targets supported by the kernel for a single
index cbade699a22391a8d8675a1197f5912c89f8534b..3288d0de597895b30aa3af70bef31c9d286aae7c 100644 (file)
@@ -5,7 +5,6 @@
 #include "chase.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "id128-util.h"
 #include "log.h"
 #include "os-util.h"
 #include "path-util.h"
index 836b63733a9b5494440e0f4873467b4b4f46eb37..927802e5eeee9dcb58f477dddf55138fb3c3848e 100644 (file)
@@ -1,10 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
 #include "sd-id128.h"
 
+#include "forward.h"
+
 typedef enum BootEntryTokenType {
         BOOT_ENTRY_TOKEN_MACHINE_ID,
         BOOT_ENTRY_TOKEN_OS_IMAGE_ID,
index e49bd8f1f2ca7e2e20348559e7fcf56b793acf01..06313ac06a714f5cbb51b8fb5c4b72521f7f431c 100644 (file)
@@ -3,7 +3,6 @@
 #include "acpi-fpdt.h"
 #include "boot-timestamps.h"
 #include "efi-loader.h"
-#include "macro.h"
 #include "time-util.h"
 
 int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
index 55b7ad19aa7c96aea619c99bdb27c90294014650..9ccbeb2c04787c17595c8d76fb4e58a590ddb596 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <time-util.h>
+#include "forward.h"
 
 int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader);
index a22bc7062321b6ff5171837a97675b559cc30a9b..f57a3d57407035c994363cf31734e72f777b1358 100644 (file)
@@ -3,16 +3,18 @@
 #include <fnmatch.h>
 #include <unistd.h>
 
+#include "sd-json.h"
+
 #include "alloc-util.h"
 #include "bootspec.h"
 #include "bootspec-fundamental.h"
 #include "chase.h"
-#include "conf-files.h"
 #include "devnum-util.h"
 #include "dirent-util.h"
 #include "efi-loader.h"
+#include "efivars.h"
 #include "env-file.h"
-#include "errno-util.h"
+#include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "find-esp.h"
 #include "pe-binary.h"
 #include "pretty-print.h"
 #include "recurse-dir.h"
+#include "set.h"
 #include "sort-util.h"
 #include "stat-util.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "strv.h"
-#include "terminal-util.h"
 #include "uki.h"
-#include "unaligned.h"
 
 static const char* const boot_entry_type_table[_BOOT_ENTRY_TYPE_MAX] = {
         [BOOT_ENTRY_CONF]        = "Boot Loader Specification Type #1 (.conf)",
index a574a0be93c3a052b6bcf2165967ead4268c91e2..e0c561808c73132f17f8123b79634105136e78f3 100644 (file)
@@ -2,15 +2,7 @@
 
 #pragma once
 
-#include <errno.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "sd-json.h"
-
-#include "set.h"
-#include "string-util.h"
+#include "forward.h"
 
 typedef enum BootEntryType {
         BOOT_ENTRY_CONF,        /* Boot Loader Specification Type #1 entries: *.conf files */
index 5a3b0b6cb3c04659272325a9c3089d6b6347a7bc..5f5402609bff01c7ac1bddcbcf3fea8aa8b033b2 100644 (file)
@@ -3,7 +3,6 @@
 #include "bpf-dlopen.h"
 #include "dlfcn-util.h"
 #include "log.h"
-#include "strv.h"
 
 #if HAVE_LIBBPF
 
index bb78312363f2f0ed0207773a35a467a8401be429..639c1128946a2bede97212c6266b6439efb6db74 100644 (file)
@@ -1,16 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
 #include <syslog.h>
 
 #if HAVE_LIBBPF
 
-#include <bpf/bpf.h>
-#include <bpf/libbpf.h>
+#include <bpf/bpf.h>    /* IWYU pragma: export */
+#include <bpf/libbpf.h> /* IWYU pragma: export */
 
-#include "bpf-compat.h"
+#include "bpf-compat.h" /* IWYU pragma: export */
 #include "dlfcn-util.h"
+#include "forward.h"
 
 extern DLSYM_PROTOTYPE(bpf_link__destroy);
 extern DLSYM_PROTOTYPE(bpf_link__fd);
index 53711e49053063f19f8830964bb7d5774d2d8ac0..acd64f88eb7794b03e2ac6879852791262476278 100644 (file)
@@ -1,14 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
-
 #pragma once
 
 #if HAVE_LIBBPF
 
-#include <stdio.h>
 #include <bpf/libbpf.h>
 
-#include "fdset.h"
-#include "macro.h"
+#include "forward.h"
 
 bool bpf_can_link_program(struct bpf_program *prog);
 
index 83af54ec6816e49c7277fd590cb64da0fdf8e54b..d369b008fd2066d4069cc024170832ee384f2158 100644 (file)
@@ -1,22 +1,26 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <fcntl.h>
+#include <linux/bpf.h>
 #include <linux/bpf_insn.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "bpf-program.h"
 #include "errno-util.h"
 #include "escape.h"
+#include "extract-word.h"
 #include "fd-util.h"
+#include "fdset.h"
+#include "log.h"
 #include "memory-util.h"
 #include "missing_syscall.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "serialize.h"
+#include "set.h"
 #include "string-table.h"
+#include "string-util.h"
 
 static const char *const bpf_cgroup_attach_type_table[__MAX_BPF_ATTACH_TYPE] = {
         [BPF_CGROUP_INET_INGRESS] =     "ingress",
index e820ed8196dc33305ef2bc53512fc12b16481e4b..3b3aae4a75b61baf2598e8cf51086e27ddf0232f 100644 (file)
@@ -1,22 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <linux/bpf.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <sys/syscall.h>
-
-#include "fdset.h"
-#include "list.h"
-#include "macro.h"
-
-typedef struct BPFProgram BPFProgram;
+#include "forward.h"
 
 /* This encapsulates three different concepts: the loaded BPF program, the BPF code, and the attachment to a
  * cgroup. Typically our BPF programs go through all three stages: we build the code, we load it, and finally
  * we attach it, but it might happen that we operate with programs that aren't loaded or aren't attached, or
  * where we don't have the code. */
-struct BPFProgram {
+typedef struct BPFProgram {
         /* The loaded BPF program, if loaded */
         int kernel_fd;
         uint32_t prog_type;
@@ -31,7 +22,7 @@ struct BPFProgram {
         char *attached_path;
         int attached_type;
         uint32_t attached_flags;
-};
+} BPFProgram;
 
 int bpf_program_supported(void);
 
index 1ea7b93394c8fd5499de0aad1168a64a5b105ff7..c23a3acf0694b6666098908f6aacc9903c1722e9 100644 (file)
@@ -2,9 +2,8 @@
 #pragma once
 
 #include <linux/if_bridge.h>
-#include <netinet/in.h>
 
-#include "conf-parser.h"
+#include "forward.h"
 
 typedef enum BridgeState {
         NETDEV_BRIDGE_STATE_DISABLED   = BR_STATE_DISABLED,
index 0615b27a02ab1db68d542ec0e257219a59e2ec20..61fe50e012aa999c2d5c901957d3cd9916f9de4c 100644 (file)
@@ -1,37 +1,26 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <linux/btrfs.h>
 #include <linux/btrfs_tree.h>
-#include <linux/loop.h>
 #include <linux/magic.h>
-#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/sysmacros.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "blockdev-util.h"
 #include "btrfs-util.h"
 #include "chase.h"
 #include "chattr-util.h"
 #include "copy.h"
 #include "errno-util.h"
 #include "fd-util.h"
-#include "fileio.h"
 #include "fs-util.h"
-#include "io-util.h"
 #include "log.h"
-#include "macro.h"
-#include "missing_fs.h"
 #include "path-util.h"
 #include "rm-rf.h"
-#include "smack-util.h"
 #include "sparse-endian.h"
 #include "stat-util.h"
 #include "string-util.h"
@@ -1904,6 +1893,16 @@ int btrfs_subvol_get_parent(int fd, uint64_t subvol_id, uint64_t *ret) {
         return -ENXIO;
 }
 
+bool btrfs_might_be_subvol(const struct stat *st) {
+        if (!st)
+                return false;
+
+        /* Returns true if this 'struct stat' looks like it could refer to a btrfs subvolume. To make a final
+         * decision, needs to be combined with an fstatfs() check to see if this is actually btrfs. */
+
+        return S_ISDIR(st->st_mode) && st->st_ino == 256;
+}
+
 int btrfs_forget_device(const char *path) {
         _cleanup_close_ int control_fd = -EBADF;
         struct btrfs_ioctl_vol_args args = {};
index 58380029b09dc40c30f7e6c4095f2888154eea95..44438bbaf3f2c1341079de36dbd982062cf6e292 100644 (file)
@@ -1,15 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
 
-#include "btrfs.h"
-#include "copy.h"
-#include "time-util.h"
+#include "btrfs.h"      /* IWYU pragma: export */
+#include "forward.h"
 
 typedef struct BtrfsSubvolInfo {
         uint64_t subvol_id;
@@ -132,15 +127,7 @@ int btrfs_qgroup_get_quota(const char *path, uint64_t qgroupid, BtrfsQuotaInfo *
 
 int btrfs_log_dev_root(int level, int ret, const char *p);
 
-static inline bool btrfs_might_be_subvol(const struct stat *st) {
-        if (!st)
-                return false;
-
-        /* Returns true if this 'struct stat' looks like it could refer to a btrfs subvolume. To make a final
-         * decision, needs to be combined with an fstatfs() check to see if this is actually btrfs. */
-
-        return S_ISDIR(st->st_mode) && st->st_ino == 256;
-}
+bool btrfs_might_be_subvol(const struct stat *st);
 
 int btrfs_forget_device(const char *path);
 
index 5be6bbc90678ed246f630918a79ce4b30ba08409..e21eafc4bafbb5e46c254f25aa9ba0dbb1cc5962 100644 (file)
@@ -1,10 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "bus-get-properties.h"
 #include "bus-message-util.h"
-#include "log.h"
 #include "rlimit-util.h"
-#include "stdio-util.h"
 #include "string-util.h"
 
 BUS_DEFINE_PROPERTY_GET_GLOBAL(bus_property_get_bool_false, "b", 0);
index 95eab4a4bf17e3a126e8d1b659303f1158863c75..a77d3653bea4c56514591a46b8611f51400bb897 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "sd-bus.h"
 
-#include "macro.h"
+#include "forward.h"
 
 int bus_property_get_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
 int bus_property_set_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error);
index 9ceb976b0b65d50573ed32e01a911ff427a8a5c1..a310f61bb98798d293206e72ea8750ae933cf9cd 100644 (file)
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "assert-util.h"
+#include "sd-bus.h"
+
 #include "bus-locator.h"
-#include "macro.h"
 
 const BusLocator* const bus_home_mgr = &(BusLocator){
         .destination = "org.freedesktop.home1",
index 8116aa27c0a8e1a25deeffdd5a1ea65eb746ac54..467bc2b344c9342b29328e2a2e076592e8b81df6 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
+#include "forward.h"
 
 typedef struct BusLocator {
         const char *destination;
index ad667d0e64a7d69c8bffc34f083ba8f62e157661..6ff7a3c04fc0f1c9b55ef3a9696dc251df996957 100644 (file)
@@ -5,10 +5,14 @@
 #include "alloc-util.h"
 #include "bus-get-properties.h"
 #include "bus-log-control-api.h"
-#include "bus-util.h"
+#include "bus-object.h"
 #include "log.h"
 #include "syslog-util.h"
 
+int bus_log_control_api_register(sd_bus *bus) {
+        return bus_add_implementation(bus, &log_control_object, NULL);
+}
+
 int bus_property_get_log_level(
                 sd_bus *bus,
                 const char *path,
index 85f60a7a2f0e2b98c396d913f884b82320ccb99e..76647da02669203db1dde3ad5cd51735fcb9df6a 100644 (file)
@@ -1,14 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "bus-object.h"
+#include "forward.h"
 
 extern const BusObjectImplementation log_control_object;
-static inline int bus_log_control_api_register(sd_bus *bus) {
-        return bus_add_implementation(bus, &log_control_object, NULL);
-}
+
+int bus_log_control_api_register(sd_bus *bus);
 
 int bus_property_get_log_level(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
 int bus_property_set_log_level(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error);
index c2af0498ba16e9150c2b3c9d6b7063f63a6a11f3..1a7f88c5f66be85b9ff50d8f55d2b1ac1b66a59c 100644 (file)
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "alloc-util.h"
+#include "sd-bus.h"
+
 #include "bus-map-properties.h"
-#include "bus-message.h"
 #include "bus-message-util.h"
 #include "bus-util.h"
-#include "log.h"
+#include "string-util.h"
 #include "strv.h"
 
 int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
index 183e9722f1e2a5c4e635ba9c0d5c3b757ef5e9fb..4c36f572f2c023da49fc44287bafc118e846b771 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
+#include "forward.h"
 
 typedef int (*bus_property_set_t) (sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
 
index 20a0d0eb7799c9b45c2bfc538f9021a68f509638..dd939a67525a8ca33b502720fb1f73994aa32d3c 100644 (file)
@@ -2,11 +2,16 @@
 
 #include <unistd.h>
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-message-util.h"
 #include "bus-util.h"
 #include "copy.h"
+#include "in-addr-util.h"
 #include "resolve-util.h"
+#include "set.h"
+#include "socket-netlink.h"
 
 int bus_message_read_id128(sd_bus_message *m, sd_id128_t *ret) {
         const void *a;
index 02c670695e42772cac2b5e257a1da4d6bc787ef9..3580c843c45038c6ab5f1c7e34a8de706d83b38b 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "in-addr-util.h"
-#include "set.h"
-#include "socket-netlink.h"
+#include "forward.h"
 
 int bus_message_read_id128(sd_bus_message *m, sd_id128_t *ret);
 
index 1fa97a1ff2b60af59e6deabd4f44d658eab8e85a..bc5995a67f914144a0d726ec1e6e819193551da1 100644 (file)
@@ -1,10 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-introspect.h"
 #include "bus-object.h"
 #include "log.h"
-#include "macro.h"
+#include "ordered-set.h"
 #include "string-util.h"
 #include "strv.h"
 
index 145bbd268f588158071cf87dddc0b4946063a889..2cdade79135d71f8d97d222d855cc6ebbb6680a0 100644 (file)
@@ -1,19 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "sd-bus.h"
-
-typedef struct BusObjectImplementation BusObjectImplementation;
+#include "forward.h"
 
 typedef struct BusObjectVtablePair {
         const sd_bus_vtable *vtable;
         sd_bus_object_find_t object_find;
 } BusObjectVtablePair;
 
-struct BusObjectImplementation {
+typedef struct BusObjectImplementation {
         const char *path;
         const char *interface;
         const sd_bus_vtable **vtables;
@@ -21,7 +16,7 @@ struct BusObjectImplementation {
         sd_bus_node_enumerator_t node_enumerator;
         bool manager;
         const BusObjectImplementation **children;
-};
+} BusObjectImplementation;
 
 #define BUS_VTABLES(...) ((const sd_bus_vtable* []){ __VA_ARGS__, NULL })
 #define BUS_FALLBACK_VTABLES(...) ((const BusObjectVtablePair[]) { __VA_ARGS__, {} })
index 99d99a5bbb778cb0bf47224c7b4133696e805af4..93a3c7e6a4ed9b88e6cb96490811f9c56d324649 100644 (file)
@@ -1,13 +1,18 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "bus-internal.h"
+#include "sd-bus.h"
+#include "sd-event.h"
+
 #include "bus-message.h"
 #include "bus-polkit.h"
 #include "bus-util.h"
+#include "errno-util.h"
+#include "hashmap.h"
+#include "list.h"
 #include "log.h"
-#include "process-util.h"
+#include "pidref.h"
+#include "string-util.h"
 #include "strv.h"
-#include "user-util.h"
 #include "varlink-util.h"
 
 static int bus_message_check_good_user(sd_bus_message *m, uid_t good_user) {
index 7f6f21b51e616e0f5e2702c50d23ee15f5690bc0..893ce635ead81ed2635893a91b222b725b3fa549 100644 (file)
@@ -1,11 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
+#include "sd-json.h"
 #include "sd-varlink.h"
 
-#include "hashmap.h"
-#include "user-util.h"
+#include "forward.h"
 
 typedef enum PolkitFlags {
         POLKIT_ALLOW_INTERACTIVE = 1 << 0, /* Allow interactive auth (typically not required, because can be derived from bus message/link automatically) */
index ec7e2c95439bf040efcc43503f35c26d435e32bd..5ea670599a37c24b4f617e4facd0868863887e33 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-print-properties.h"
 #include "cap-list.h"
 #include "mountpoint-util.h"
 #include "nsflags.h"
 #include "parse-util.h"
-#include "stdio-util.h"
+#include "set.h"
 #include "string-util.h"
 #include "strv.h"
 #include "time-util.h"
-#include "user-util.h"
 
 int bus_print_property_value(const char *name, const char *expected_value, BusPrintPropertyFlags flags, const char *value) {
         assert(name);
index a17875cc47ce8417e45ae8dd4bc1d94bd618900b..9bbf8a9eceb04c4e8d6cdefac60003f16ccc0a20 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "sd-bus.h"
-
-#include "macro.h"
-#include "set.h"
+#include "forward.h"
 
 typedef enum BusPrintPropertyFlags {
         BUS_PRINT_PROPERTY_ONLY_VALUE = 1 << 0,  /* e.g. systemctl --value */
index c47b8b23b466f78390afb7dd3f548f9791287ed4..cfdfb736f7e2f9b3abfe522609f047fca56ef3b7 100644 (file)
@@ -1,13 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "ansi-color.h"
 #include "bus-locator.h"
 #include "bus-unit-procs.h"
+#include "format-util.h"
 #include "glyph-util.h"
 #include "hashmap.h"
 #include "list.h"
 #include "log.h"
-#include "macro.h"
+#include "output-mode.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "sort-util.h"
index 78c55697aea4709592ebb46af9decacfbbfb10a5..e112ef5dabad889705a527721422df8dfdd30616 100644 (file)
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "output-mode.h"
+#include "forward.h"
 
 int unit_show_processes(sd_bus *bus, const char *unit, const char *cgroup_path, const char *prefix, unsigned n_columns, OutputFlags flags, sd_bus_error *error);
index 63478664535f19646f809f92b262fac3e0a301a3..328caca3396e2c39746c70dc370da9890b971a20 100644 (file)
@@ -1,6 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "af-list.h"
+#include <paths.h>
+#include <sys/mount.h>
+
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-common-errors.h"
 #include "bus-error.h"
 #include "cgroup-setup.h"
 #include "cgroup-util.h"
 #include "condition.h"
+#include "constants.h"
 #include "coredump-util.h"
 #include "cpu-set-util.h"
-#include "dissect-image.h"
 #include "escape.h"
 #include "exec-util.h"
 #include "exit-status.h"
-#include "fileio.h"
+#include "extract-word.h"
 #include "firewall-util.h"
 #include "hexdecoct.h"
 #include "hostname-util.h"
 #include "in-addr-util.h"
+#include "install.h"
 #include "ioprio-util.h"
 #include "ip-protocol-list.h"
-#include "libmount-util.h"
-#include "locale-util.h"
 #include "log.h"
-#include "macro.h"
-#include "missing_fs.h"
 #include "mountpoint-util.h"
 #include "nsflags.h"
 #include "numa-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "percent-util.h"
+#include "pidref.h"
 #include "process-util.h"
 #include "rlimit-util.h"
 #include "seccomp-util.h"
 #include "securebits-util.h"
 #include "signal-util.h"
 #include "socket-util.h"
-#include "sort-util.h"
-#include "stdio-util.h"
 #include "string-util.h"
 #include "syslog-util.h"
-#include "terminal-util.h"
+#include "time-util.h"
 #include "unit-def.h"
-#include "user-util.h"
-#include "utf8.h"
 
 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
         assert(message);
index 8090b36e3d5249e56dd7dfcee723c40388c4bae1..ba3115c080689170469004dd7d17ac12ef0304ca 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "install.h"
-#include "pidref.h"
-#include "unit-def.h"
+#include "forward.h"
 
 typedef enum ExecDirectoryFlags {
         EXEC_DIRECTORY_READ_ONLY      = 1 << 0, /* Public API via DBUS, do not change */
index c3b1a01c1a212e42ecfd643ae611589cfe94b97a..89d96a4045c70b2b5c283457e8d80187c4fd3fac 100644 (file)
@@ -1,12 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
+#include <malloc.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/resource.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "sd-bus.h"
 #include "chase.h"
 #include "daemon-util.h"
 #include "env-util.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "format-util.h"
 #include "log.h"
 #include "memfd-util.h"
 #include "memstream-util.h"
 #include "path-util.h"
+#include "pidref.h"
 #include "socket-util.h"
 #include "stdio-util.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 #include "uid-classification.h"
 
 static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
@@ -64,6 +66,10 @@ int bus_log_connect_full(int log_level, int r, BusTransport transport, RuntimeSc
                                           "Failed to connect to %s scope bus via %s transport: %m", runtime_scope_to_string(scope), bus_transport_to_string(transport));
 }
 
+int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope) {
+        return bus_log_connect_full(LOG_ERR, r, transport, scope);
+}
+
 int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name) {
         const char *match;
         const char *unique;
index 7f890e4b9f2521a430a35af34793c57cf6a5919b..5f160ffcafd190bb4a3d20a82a3bed4d26132799 100644 (file)
@@ -1,22 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/types.h>
+#include "sd-bus.h" /* IWYU pragma: export */
 
-#include "sd-bus.h"
-#include "sd-event.h"
-
-#include "errno-util.h"
 #include "log.h"
-#include "macro.h"
-#include "pidref.h"
-#include "runtime-scope.h"
-#include "set.h"
-#include "string-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 typedef enum BusTransport {
         BUS_TRANSPORT_LOCAL,
@@ -50,9 +38,7 @@ int bus_connect_transport_systemd(BusTransport transport, const char *host, Runt
 
 int bus_log_address_error(int r, BusTransport transport);
 int bus_log_connect_full(int log_level, int r, BusTransport transport, RuntimeScope scope);
-static inline int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope) {
-        return bus_log_connect_full(LOG_ERR, r, transport, scope);
-}
+int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope);
 
 #define bus_log_parse_error(r)                                  \
         log_error_errno(r, "Failed to parse bus message: %m")
index f58422777df94d99cfbd37687f3bf7f824ce0fee..2526e2511fce6658c8e7b3f2106f107e35119194 100644 (file)
@@ -1,12 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-internal.h"
 #include "bus-util.h"
 #include "bus-wait-for-jobs.h"
+#include "errno-util.h"
 #include "escape.h"
 #include "log.h"
 #include "set.h"
+#include "string-util.h"
 #include "strv.h"
 #include "unit-def.h"
 
index ff15ede19cd9608fb3f43c1d164aac6af9110b72..bce4f25ac20d8cdb196bd31f8ea83ed9fe54b2bf 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "macro.h"
-#include "memory-util.h"
+#include "forward.h"
 
 typedef struct BusWaitForJobs BusWaitForJobs;
 
index 8cb2d8ded4d858f9c7cf72b691468ce22f53120b..9730a6c738eed6846123c191912953f9a7457783 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-error.h"
 #include "bus-map-properties.h"
@@ -7,7 +9,6 @@
 #include "hashmap.h"
 #include "log.h"
 #include "string-util.h"
-#include "strv.h"
 #include "unit-def.h"
 
 typedef struct WaitForItem {
index 29725e9adb5b90c3a5a3a583f53da0025296361e..eed7fd1f4b47c7baac9058bfd2fe441285ac64f1 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-bus.h"
-
-#include "macro.h"
-#include "memory-util.h"
+#include "forward.h"
 
 typedef struct BusWaitForUnits BusWaitForUnits;
 
index c95898507c178dd63dc5b6eb7939b74faefe5351..3569f15db4f3f278796bed3813703b594a0f860c 100644 (file)
@@ -1,9 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/mman.h>
@@ -12,10 +8,7 @@
 #include "alloc-util.h"
 #include "calendarspec.h"
 #include "errno-util.h"
-#include "fd-util.h"
-#include "fileio.h"
 #include "log.h"
-#include "macro.h"
 #include "memstream-util.h"
 #include "parse-util.h"
 #include "process-util.h"
index 9a8bdbd21acbb40f8c0759d4279382c3a3b118a5..2289d9cfed1e340999c547f1c09225307fdf9e00 100644 (file)
@@ -4,10 +4,7 @@
 /* A structure for specifying (possibly repetitive) points in calendar
  * time, a la cron */
 
-#include <stdbool.h>
-
-#include "memory-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 typedef struct CalendarComponent {
         int start;
index d804a7746bb3e2faf3d78aea072877673a7f770d..8e6cb55427f7e74a95885c671c5095d475294524 100644 (file)
@@ -7,6 +7,7 @@
 #include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "format-util.h"
 #include "fs-util.h"
 #include "log.h"
 #include "missing_magic.h"
@@ -15,6 +16,8 @@
 #include "path-util.h"
 #include "process-util.h"
 #include "recurse-dir.h"
+#include "set.h"
+#include "stat-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
 #include "user-util.h"
index 5e654426a6d0349fc1c508e14b7fa9738099eb71..4cc5c9f4cc212b95a299b42fed432ae250c9d511 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include "cgroup-util.h"
+#include "forward.h"
 
 int cg_weight_parse(const char *s, uint64_t *ret);
 int cg_cpu_weight_parse(const char *s, uint64_t *ret);
index 0331ce232361099326d683476f863d95a8ae4a25..258229daf3d8c07338d152eedc0f406ff645c990 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <dirent.h>
-#include <errno.h>
-#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
+
+#include "sd-bus.h"
 
 #include "alloc-util.h"
 #include "ansi-color.h"
 #include "escape.h"
 #include "fd-util.h"
 #include "format-util.h"
+#include "glyph-util.h"
 #include "hostname-util.h"
-#include "locale-util.h"
 #include "log.h"
-#include "macro.h"
 #include "nulstr-util.h"
 #include "output-mode.h"
-#include "parse-util.h"
 #include "path-util.h"
 #include "process-util.h"
+#include "runtime-scope.h"
 #include "sort-util.h"
 #include "string-util.h"
 #include "terminal-util.h"
-#include "unit-name.h"
+#include "unit-def.h"
 #include "xattr-util.h"
 
 static void show_pid_array(
index db3c9c9cd0ff368f44b98953ea49064bce51fcaa..9dd81d5933474488a0c11fa6155764afd219c87d 100644 (file)
@@ -1,13 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "sd-bus.h"
-
-#include "logs-show.h"
-#include "output-mode.h"
+#include "forward.h"
 
 int show_cgroup_by_path(const char *path, const char *prefix, size_t n_columns, OutputFlags flags);
 int show_cgroup(const char *controller, const char *path, const char *prefix, size_t n_columns, OutputFlags flags);
index 1bd2bb57057f8cc4c7e6771cfb05502a9ffa201a..73e8b98871ff40e24005ce5132d69ab67efb671f 100644 (file)
@@ -2,15 +2,13 @@
 
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "chown-recursive.h"
 #include "dirent-util.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
-#include "macro.h"
-#include "stdio-util.h"
+#include "path-util.h"
 #include "strv.h"
 #include "user-util.h"
 #include "xattr-util.h"
index 2aab8e74142920c1b89c52e8e43b6fa818701b71..8bf8a80d6b3203874a094a8ca1530010f73f1144 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include "forward.h"
 
 int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask, int flags);
 
index f4afa746d5d13480c30afca92980a3db865ed13f..28ee195e0d18343760c8115df5e8084154e0f660 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <limits.h>
 #include <mqueue.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
@@ -20,9 +17,7 @@
 #include "fileio.h"
 #include "format-util.h"
 #include "log.h"
-#include "macro.h"
-#include "string-util.h"
-#include "strv.h"
+#include "path-util.h"
 #include "user-util.h"
 
 static bool match_uid_gid(uid_t subject_uid, gid_t subject_gid, uid_t delete_uid, gid_t delete_gid) {
index ed348fb6014c0a81f7b41d16638e253d3f8afe19..a1f8b9ec638a773ee1f613fb9863cb5c1b68ab39 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
-
-#include "user-util.h"
+#include "forward.h"
 
 int clean_ipc_internal(uid_t uid, gid_t gid, bool rm);
 
index 8ab2d4ca95f3f9b01aa19d59abc8a73dc12fa90c..edd2669d0373cf6717ed9ecc7c43731848ca9be0 100644 (file)
@@ -1,16 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <stdio.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 
 #include "alloc-util.h"
 #include "clock-util.h"
-#include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "macro.h"
 #include "string-util.h"
+#include "time-util.h"
 
 int clock_is_localtime(const char *adjtime_path) {
         int r;
index e8258de95d13cae180302e6d3f4ea037bfe1992d..191278595472012f3de1dd3d91eed44ff07dcb3b 100644 (file)
@@ -2,9 +2,7 @@
 
 #include <math.h>
 
-#include "assert-util.h"
 #include "color-util.h"
-#include "macro.h"
 
 void rgb_to_hsv(double r, double g, double b,
                 double *ret_h, double *ret_s, double *ret_v) {
index a4ae9eba09f08e7f29e2336b4fdc4b4327a46e4f..1816b7971c06cee7d0192e89360012c156b1c301 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
+#include "forward.h"
 
 void rgb_to_hsv(double r, double g, double b,
                 double *ret_h, double *ret_s, double *ret_v);
index e3f9250361812bfc52a7a7ba46e3463ef235ed94..cbc17778d76b97a5d41b969bb76b8993c72b5780 100644 (file)
@@ -1,12 +1,18 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <malloc.h>
+#include <sys/signalfd.h>
+
+#include "sd-event.h"
+
+#include "alloc-util.h"
 #include "common-signal.h"
-#include "fd-util.h"
-#include "fileio.h"
+#include "format-util.h"
 #include "log.h"
 #include "memstream-util.h"
 #include "process-util.h"
 #include "signal-util.h"
+#include "string-util.h"
 
 int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
         struct sigrtmin18_info *info = userdata;
index 3fd7d8329913b69a0e664b74036cfb321537fe15..07bc4c5f000af61a695e951e58208015ec1c16a6 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <syslog.h>
 
-#include "sd-event.h"
+#include "forward.h"
 
 /* All our long-running services should implement a SIGRTMIN+18 handler that can be used to trigger certain
  * actions that affect service runtime. The specific action is indicated via the "value integer" you can pass
index 900f3e54b20facc991529eb8e1c3f05cefd67fd2..aa19835fd0dfc8d94d0a4d994694162c28decaec 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
+#include "forward.h"
 
 #define COMPARE_OPERATOR_CHARS "!<=>"
 #define COMPARE_OPERATOR_WITH_FNMATCH_CHARS COMPARE_OPERATOR_CHARS "$"
index 63acf3906c6ae732efb018175aec00b68314bc51..61f900c59d880ac59887f57cda273ffcf26a1498 100644 (file)
@@ -1,14 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <ctype.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <gnu/libc-version.h>
-#include <limits.h>
-#include <stdlib.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <sys/utsname.h>
 #include <time.h>
 #include <unistd.h>
@@ -29,8 +24,8 @@
 #include "confidential-virt.h"
 #include "cpu-set-util.h"
 #include "creds-util.h"
-#include "efi-api.h"
 #include "efi-loader.h"
+#include "efivars.h"
 #include "env-file.h"
 #include "env-util.h"
 #include "extract-word.h"
 #include "fs-util.h"
 #include "glob-util.h"
 #include "hostname-setup.h"
-#include "hostname-util.h"
 #include "id128-util.h"
 #include "ima-util.h"
 #include "initrd-util.h"
 #include "libaudit-util.h"
 #include "limits-util.h"
 #include "list.h"
-#include "macro.h"
+#include "log.h"
 #include "mountpoint-util.h"
 #include "nulstr-util.h"
 #include "os-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "percent-util.h"
+#include "pidref.h"
 #include "proc-cmdline.h"
 #include "process-util.h"
 #include "psi-util.h"
@@ -62,6 +57,8 @@
 #include "stat-util.h"
 #include "string-table.h"
 #include "string-util.h"
+#include "strv.h"
+#include "time-util.h"
 #include "tomoyo-util.h"
 #include "tpm2-util.h"
 #include "uid-classification.h"
index 0644ec28f51e7b0252cfc181eceae4ddef642413..a06d2a89d15ae76fbfc23d30995e7919731328e7 100644 (file)
@@ -1,12 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-
 #include "list.h"
-#include "macro.h"
+#include "forward.h"
 
 typedef enum ConditionType {
         CONDITION_ARCHITECTURE,
index 2c5d6275a6f60af85db4bcaa58c46f5d2006f03f..5a2e253175cf6bc502d3f02ff3969555e364f05a 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <limits.h>
 #include <linux/ipv6.h>
-#include <stdint.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
 
 #include "sd-id128.h"
 
@@ -29,7 +24,6 @@
 #include "in-addr-prefix-util.h"
 #include "ip-protocol-list.h"
 #include "log.h"
-#include "macro.h"
 #include "missing_network.h"
 #include "nulstr-util.h"
 #include "parse-helpers.h"
@@ -40,6 +34,7 @@
 #include "rlimit-util.h"
 #include "set.h"
 #include "signal-util.h"
+#include "siphash24.h"
 #include "socket-util.h"
 #include "stat-util.h"
 #include "string-util.h"
@@ -879,6 +874,22 @@ int _hashmap_by_section_find_unused_line(
         return 0;
 }
 
+int hashmap_by_section_find_unused_line(
+        Hashmap *entries_by_section,
+        const char *filename,
+        unsigned *ret) {
+
+        return _hashmap_by_section_find_unused_line(HASHMAP_BASE(entries_by_section), filename, ret);
+}
+
+int ordered_hashmap_by_section_find_unused_line(
+        OrderedHashmap *entries_by_section,
+        const char *filename,
+        unsigned *ret) {
+
+        return _hashmap_by_section_find_unused_line(HASHMAP_BASE(entries_by_section), filename, ret);
+}
+
 #define DEFINE_PARSER(type, vartype, conv_func)                         \
         DEFINE_CONFIG_PARSE_PTR(config_parse_##type, conv_func, vartype)
 
index 2a60eb6ab8247a3453034dc1a9673f8fb9b60ad5..e3f4666dfb74bcea9177aa563615517672d559a2 100644 (file)
@@ -1,17 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <sys/stat.h>
 #include <syslog.h>
 
+#include "alloc-util.h"
 #include "conf-parser-forward.h"
-#include "hashmap.h"
+#include "forward.h"
 #include "log.h"
-#include "memory-util.h"
 
 /* An abstract parser for simple, line based, shallow configuration files consisting of variable assignments only. */
 
@@ -159,18 +154,9 @@ int _hashmap_by_section_find_unused_line(
                 HashmapBase *entries_by_section,
                 const char *filename,
                 unsigned *ret);
-static inline int hashmap_by_section_find_unused_line(
-                Hashmap *entries_by_section,
-                const char *filename,
-                unsigned *ret) {
-        return _hashmap_by_section_find_unused_line(HASHMAP_BASE(entries_by_section), filename, ret);
-}
-static inline int ordered_hashmap_by_section_find_unused_line(
-                OrderedHashmap *entries_by_section,
-                const char *filename,
-                unsigned *ret) {
-        return _hashmap_by_section_find_unused_line(HASHMAP_BASE(entries_by_section), filename, ret);
-}
+
+int hashmap_by_section_find_unused_line(Hashmap *entries_by_section, const char *filename, unsigned *ret);
+int ordered_hashmap_by_section_find_unused_line(OrderedHashmap *entries_by_section, const char *filename, unsigned *ret);
 
 static inline bool section_is_invalid(ConfigSection *section) {
         /* If this returns false, then it does _not_ mean the section is valid. */
index 2f153a97326525c729b8c97c71146c79ba7d0420..08828856c0b3548cb7475ce45a779828922c9174 100644 (file)
@@ -1,20 +1,15 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <linux/btrfs.h>
-#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/sendfile.h>
 #include <sys/sysmacros.h>
-#include <sys/xattr.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "btrfs-util.h"
 #include "chattr-util.h"
 #include "copy.h"
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
-#include "io-util.h"
+#include "hashmap.h"
 #include "log.h"
-#include "macro.h"
-#include "missing_fs.h"
-#include "missing_syscall.h"
-#include "mkdir-label.h"
 #include "mountpoint-util.h"
 #include "nulstr-util.h"
+#include "path-util.h"
 #include "rm-rf.h"
 #include "selinux-util.h"
 #include "signal-util.h"
 #include "stat-util.h"
+#include "set.h"
 #include "stdio-util.h"
 #include "string-util.h"
-#include "strv.h"
 #include "sync-util.h"
-#include "time-util.h"
 #include "tmpfile-util.h"
 #include "umask-util.h"
 #include "user-util.h"
index 4eea560bed10d10e2b8a37c907b7b8bbf410e5cc..3efe877c4b94de5711d21b4aa92cef5a46544ffc 100644 (file)
@@ -1,15 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "set.h"
+#include "forward.h"
 
 typedef enum CopyFlags {
         COPY_REFLINK                      = 1 << 0,  /* Try to reflink */
index a72db4b4e550241232dc56c2df0989591f6a5866..cbf5678ed29a794a0cbc09bc638c9253655b7713 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <pwd.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum CoredumpFilter {
         COREDUMP_FILTER_PRIVATE_ANONYMOUS = 0,
index 711e94ef4525b818887d75916fa4c730274ab826..1703da0ed2f60c4fe8166bc6d49516b358e68f4b 100644 (file)
@@ -1,24 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
 #include <stdio.h>
 #include <syslog.h>
+#include <unistd.h>
 
 #include "alloc-util.h"
 #include "cpu-set-util.h"
-#include "dirent-util.h"
-#include "errno-util.h"
 #include "extract-word.h"
-#include "fd-util.h"
 #include "hexdecoct.h"
 #include "log.h"
-#include "macro.h"
-#include "memory-util.h"
 #include "parse-util.h"
-#include "stat-util.h"
 #include "string-util.h"
-#include "strv.h"
 
 char* cpu_set_to_string(const CPUSet *a) {
         _cleanup_free_ char *str = NULL;
index d62b2d60e6d81ce4bfbc5ada1f46e292c9173460..e2ea839aa89cbbd0a19de1550b87c1592d922af8 100644 (file)
@@ -3,8 +3,7 @@
 
 #include <sched.h>
 
-#include "memory-util.h"
-#include "missing_syscall.h"
+#include "forward.h"
 
 /* This wraps the libc interface with a variable to keep the allocated size. */
 typedef struct CPUSet {
index 6e0149e92e788aff8210ea1193498eb075a42b11..55aeace37694545adb1b5715d52537a568d8898c 100644 (file)
@@ -1,6 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <pwd.h>
 #include <sys/file.h>
+#include <unistd.h>
+#include "efivars.h"
+#include "time-util.h"
 
 #if HAVE_OPENSSL
 #include <openssl/err.h>
@@ -12,9 +16,7 @@
 
 #include "alloc-util.h"
 #include "blockdev-util.h"
-#include "capability-util.h"
 #include "chattr-util.h"
-#include "constants.h"
 #include "copy.h"
 #include "creds-util.h"
 #include "efi-api.h"
@@ -37,6 +39,7 @@
 #include "recurse-dir.h"
 #include "sparse-endian.h"
 #include "stat-util.h"
+#include "string-util.h"
 #include "tmpfile-util.h"
 #include "tpm2-util.h"
 #include "user-util.h"
index 3b9580850ccd969fa82e68903c91ea9f586c6ab2..7124ecd85432e4b985dba6eefdf92fd281937bd0 100644 (file)
@@ -1,14 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
 
 #include "fd-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 #define CREDENTIAL_NAME_MAX FDNAME_MAX
 
index 8d4c1791837d188fade8fdaf89fd2d34fc5c848a..8655acba3e726d8760b4ac88a5f227ebceaf31ed 100644 (file)
@@ -2,16 +2,16 @@
 
 #include "sd-json.h"
 
+#include "alloc-util.h"
 #include "ask-password-api.h"
 #include "cryptsetup-fido2.h"
+#include "cryptsetup-util.h"
 #include "env-util.h"
 #include "fido2-util.h"
-#include "fileio.h"
-#include "hexdecoct.h"
 #include "iovec-util.h"
 #include "libfido2-util.h"
-#include "parse-util.h"
-#include "random-util.h"
+#include "log.h"
+
 #include "strv.h"
 
 int acquire_fido2_key(
@@ -32,6 +32,7 @@ int acquire_fido2_key(
                 void **ret_decrypted_key,
                 size_t *ret_decrypted_key_size) {
 
+#if HAVE_LIBCRYPTSETUP && HAVE_LIBFIDO2
         _cleanup_(erase_and_freep) char *envpw = NULL;
         _cleanup_strv_free_erase_ char **pins = NULL;
         _cleanup_(iovec_done_erase) struct iovec loaded_salt = {};
@@ -128,6 +129,9 @@ int acquire_fido2_key(
 
                 askpw_flags &= ~ASK_PASSWORD_ACCEPT_CACHED;
         }
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "FIDO2 token support not available.");
+#endif
 }
 
 int acquire_fido2_key_auto(
@@ -141,6 +145,7 @@ int acquire_fido2_key_auto(
                 void **ret_decrypted_key,
                 size_t *ret_decrypted_key_size) {
 
+#if HAVE_LIBCRYPTSETUP && HAVE_LIBFIDO2
         _cleanup_free_ void *cid = NULL;
         size_t cid_size = 0;
         int r, ret = -ENOENT;
@@ -276,4 +281,7 @@ int acquire_fido2_key_auto(
 
         log_info("Unlocked volume via automatically discovered security FIDO2 token.");
         return ret;
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "FIDO2 token support not available.");
+#endif
 }
index 3e08b79f7a085cb85c81470e141954050df9c917..63d46cd97faded241b8c4e51d4c5bd573aa2e55b 100644 (file)
@@ -1,15 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
-
-#include "ask-password-api.h"
-#include "cryptsetup-util.h"
-#include "libfido2-util.h"
-#include "log.h"
-#include "time-util.h"
-
-#if HAVE_LIBFIDO2
+#include "forward.h"
 
 int acquire_fido2_key(
                 const char *volume_name,
@@ -39,43 +31,3 @@ int acquire_fido2_key_auto(
                 AskPasswordFlags askpw_flags,
                 void **ret_decrypted_key,
                 size_t *ret_decrypted_key_size);
-
-#else
-
-static inline int acquire_fido2_key(
-                const char *volume_name,
-                const char *friendly_name,
-                const char *device,
-                const char *rp_id,
-                const void *cid,
-                size_t cid_size,
-                const char *key_file,
-                size_t key_file_size,
-                uint64_t key_file_offset,
-                const struct iovec *key_data,
-                usec_t until,
-                Fido2EnrollFlags required,
-                const char *askpw_credential,
-                AskPasswordFlags askpw_flags,
-                void **ret_decrypted_key,
-                size_t *ret_decrypted_key_size) {
-
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
-                               "FIDO2 token support not available.");
-}
-
-static inline int acquire_fido2_key_auto(
-                struct crypt_device *cd,
-                const char *name,
-                const char *friendly_name,
-                const char *fido2_device,
-                usec_t until,
-                const char *askpw_credential,
-                AskPasswordFlags askpw_flags,
-                void **ret_decrypted_key,
-                size_t *ret_decrypted_key_size) {
-
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
-                               "FIDO2 token support not available.");
-}
-#endif
index d7f2e545fd404d3b1d14844bf8d726f0d2e530ae..7fc0bf9fdd83d4e39039675afefa7230dd7f78f4 100644 (file)
@@ -5,14 +5,16 @@
 #include "alloc-util.h"
 #include "ask-password-api.h"
 #include "cryptsetup-tpm2.h"
+#include "cryptsetup-util.h"
 #include "env-util.h"
 #include "fileio.h"
 #include "hexdecoct.h"
-#include "parse-util.h"
+#include "log.h"
 #include "random-util.h"
-#include "sha256.h"
+#include "strv.h"
 #include "tpm2-util.h"
 
+#if HAVE_LIBCRYPTSETUP && HAVE_TPM2
 static int get_pin(
                 usec_t until,
                 const char *askpw_credential,
@@ -59,6 +61,7 @@ static int get_pin(
 
         return r;
 }
+#endif
 
 int acquire_tpm2_key(
                 const char *volume_name,
@@ -86,6 +89,7 @@ int acquire_tpm2_key(
                 AskPasswordFlags askpw_flags,
                 struct iovec *ret_decrypted_key) {
 
+#if HAVE_LIBCRYPTSETUP && HAVE_TPM2
         _cleanup_(sd_json_variant_unrefp) sd_json_variant *signature_json = NULL;
         _cleanup_(iovec_done) struct iovec loaded_blob = {};
         _cleanup_free_ char *auto_device = NULL;
@@ -230,6 +234,9 @@ int acquire_tpm2_key(
 
                 return r;
         }
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "TPM2 support not available.");
+#endif
 }
 
 int find_tpm2_auto_data(
@@ -252,6 +259,7 @@ int find_tpm2_auto_data(
                 int *ret_keyslot,
                 int *ret_token) {
 
+#if HAVE_LIBCRYPTSETUP && HAVE_TPM2
         int r, token;
 
         assert(cd);
@@ -339,4 +347,7 @@ int find_tpm2_auto_data(
         }
 
         return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "No valid TPM2 token data found.");
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "TPM2 support not available.");
+#endif
 }
index 240a09077fdb6202825fc4644187a74a3bb1caca..f66a5168872ef5ee6eff79049a4b3d09e86855ee 100644 (file)
@@ -1,15 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include <sys/uio.h>
 
-#include "ask-password-api.h"
-#include "cryptsetup-util.h"
-#include "log.h"
-#include "time-util.h"
-#include "tpm2-util.h"
-
-#if HAVE_TPM2
+#include "forward.h"
 
 int acquire_tpm2_key(
                 const char *volume_name,
@@ -56,61 +50,3 @@ int find_tpm2_auto_data(
                 TPM2Flags *ret_flags,
                 int *ret_keyslot,
                 int *ret_token);
-
-#else
-
-static inline int acquire_tpm2_key(
-                const char *volume_name,
-                const char *device,
-                uint32_t hash_pcr_mask,
-                uint16_t pcr_bank,
-                const struct iovec *pubkey,
-                uint32_t pubkey_pcr_mask,
-                const char *signature_path,
-                const char *pcrlock_path,
-                uint16_t primary_alg,
-                const char *key_file,
-                size_t key_file_size,
-                uint64_t key_file_offset,
-                const struct iovec blobs[],
-                size_t n_blobs,
-                const struct iovec policy_hash[],
-                size_t n_policy_hash,
-                const struct iovec *salt,
-                const struct iovec *srk,
-                const struct iovec *pcrlock_nv,
-                TPM2Flags flags,
-                usec_t until,
-                const char *askpw_credential,
-                AskPasswordFlags askpw_flags,
-                struct iovec *ret_decrypted_key) {
-
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
-                               "TPM2 support not available.");
-}
-
-static inline int find_tpm2_auto_data(
-                struct crypt_device *cd,
-                uint32_t search_pcr_mask,
-                int start_token,
-                uint32_t *ret_hash_pcr_mask,
-                uint16_t *ret_pcr_bank,
-                struct iovec *ret_pubkey,
-                uint32_t *ret_pubkey_pcr_mask,
-                uint16_t *ret_primary_alg,
-                struct iovec **ret_blobs,
-                size_t *ret_n_blobs,
-                struct iovec **ret_policy_hash,
-                size_t *ret_n_policy_hash,
-                struct iovec *ret_salt,
-                struct iovec *ret_srk,
-                struct iovec *ret_pcrlock_nv,
-                TPM2Flags *ret_flags,
-                int *ret_keyslot,
-                int *ret_token) {
-
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
-                               "TPM2 support not available.");
-}
-
-#endif
index 46f91934537177f8c398c8e1df97a8002091b163..e45e8431bcddd839816d54af23b3077bfa9c5c95 100644 (file)
@@ -1,10 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
+
+#include "sd-json.h"
+
 #include "alloc-util.h"
 #include "cryptsetup-util.h"
 #include "dlfcn-util.h"
 #include "log.h"
 #include "parse-util.h"
+#include "string-util.h"
+#include "strv.h"
 
 #if HAVE_LIBCRYPTSETUP
 static void *cryptsetup_dl = NULL;
@@ -338,3 +344,8 @@ int cryptsetup_get_keyslot_from_token(sd_json_variant *v) {
 
         return keyslot;
 }
+
+const char* mangle_none(const char *s) {
+        /* A helper that turns cryptsetup/integritysetup/veritysetup "options" strings into NULL if they are effectively empty */
+        return isempty(s) || STR_IN_SET(s, "-", "none") ? NULL : s;
+}
index ea3baf9675b0df4c6e74c9f8a21e059799a7ba08..6ecc8f601f0f003b5205b4548da33e6400a4a0b4 100644 (file)
@@ -1,16 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-json.h"
-
-#include "alloc-util.h"
 #include "dlfcn-util.h"
-#include "macro.h"
-#include "string-util.h"
-#include "strv.h"
+#include "forward.h"
 
 #if HAVE_LIBCRYPTSETUP
-#include <libcryptsetup.h>
+#include <libcryptsetup.h> /* IWYU pragma: export */
 
 /* These next two are defined in libcryptsetup.h from cryptsetup version 2.3.4 forwards. */
 #ifndef CRYPT_ACTIVATE_NO_READ_WORKQUEUE
@@ -116,7 +111,4 @@ int dlopen_cryptsetup(void);
 
 int cryptsetup_get_keyslot_from_token(sd_json_variant *v);
 
-static inline const char* mangle_none(const char *s) {
-        /* A helper that turns cryptsetup/integritysetup/veritysetup "options" strings into NULL if they are effectively empty */
-        return isempty(s) || STR_IN_SET(s, "-", "none") ? NULL : s;
-}
+const char* mangle_none(const char *s);
index e189e4013219fb69c45c0435c752214c745d3aa9..21ccfdfd365927f463c8464c3aeacb1cd110306d 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-daemon.h"
+
 #include "alloc-util.h"
 #include "daemon-util.h"
 #include "fd-util.h"
index e3daa9ebf500f09662a8169943d9a56b0a4522c7..6b81fcd75c90d2fd59914f966d46290c2878f340 100644 (file)
@@ -1,11 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "sd-daemon.h" /* IWYU pragma: export */
 
-#include "sd-daemon.h"
-
-#include "macro.h"
+#include "forward.h"
 
 #define NOTIFY_READY_MESSAGE "READY=1\n" "STATUS=Processing requests..."
 #define NOTIFY_STOPPING_MESSAGE "STOPPING=1\n" "STATUS=Shutting down..."
@@ -17,7 +15,6 @@ static inline const char* notify_start(const char *start, const char *stop) {
         return stop;
 }
 
-/* This is intended to be used with _cleanup_ attribute. */
 static inline void notify_on_cleanup(const char **p) {
         if (*p)
                 (void) sd_notify(false, *p);
index 20d54f325d9ce02aa8c2fb723d34e0f4ad7a2c4b..a9b799bd610676dd0fcecce618aeed4f3298d9cb 100644 (file)
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include "copy.h"
 #include "data-fd-util.h"
 #include "fd-util.h"
index db03fba251a8c952a5122fbce2ea85012b457dcf..605ba6b24e2aa03d21a22d756e9b5f80a860f3f8 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stddef.h>
-#include <stdint.h>
+#include "forward.h"
 
 int copy_data_fd(int fd);
 int memfd_clone_fd(int fd, const char *name, int mode);
index 0ac195c86f56f19f26471098fb9a2ec9b165d335..e79db91ddee5339ae3faa0e7a1b233df9f05761d 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdlib.h>
 #include <sys/sysmacros.h>
 #include <unistd.h>
 
 #include "fd-util.h"
 #include "fs-util.h"
 #include "label-util.h"
-#include "lock-util.h"
 #include "log.h"
 #include "mkdir-label.h"
 #include "nulstr-util.h"
 #include "path-util.h"
 #include "stat-util.h"
-#include "terminal-util.h"
 #include "umask-util.h"
 #include "user-util.h"
 
index 92ba6cf76403346dc55a8da9c50a158f4fb6791f..8844d751ac11ef9a54ddeb2cdc5a0083c5374f3b 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include "forward.h"
 
 int dev_setup(const char *prefix, uid_t uid, gid_t gid);
 
index d08c40fe2ca1bd7e8feac275ac7fe6f8be240178..8d4e38ec0638b74f720bab461ce5eabd88fd97ff 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
index 8b17a8e1904bd9859515ee04d713f29f9444c163..f57378c0f6133f08256c617375cd82f253512cba 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stddef.h>
+#include "forward.h"
 
 int encode_devnode_name(const char *str, char *str_enc, size_t len);
 int allow_listed_char_for_devnode(char c, const char *additional);
index 2a973ef57c0891c6c79628bd2c1317c0714bc00b..71d64bed8df5b51b25d9f50245ad951199be407d 100644 (file)
@@ -1,16 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <linux/loop.h>
 #include <linux/magic.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/sysmacros.h>
 #include <unistd.h>
 
+#include "sd-json.h"
 #include "sd-path.h"
 
 #include "alloc-util.h"
 #include "lock-util.h"
 #include "log.h"
 #include "loop-util.h"
-#include "macro.h"
-#include "missing_fs.h"
 #include "mkdir.h"
 #include "nulstr-util.h"
 #include "os-util.h"
 #include "path-util.h"
 #include "rm-rf.h"
+#include "runtime-scope.h"
 #include "stat-util.h"
 #include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
 #include "time-util.h"
-#include "utf8.h"
 #include "vpick.h"
 #include "xattr-util.h"
 
index 27d487136446a7d39d4c58234bdfe92a0a0a7e9b..4b586f68dd837d987625c52ae976cf248ee068fe 100644 (file)
@@ -1,21 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-
 #include "sd-id128.h"
-#include "sd-json.h"
 
-#include "hashmap.h"
-#include "image-policy.h"
-#include "lock-util.h"
-#include "macro.h"
+#include "forward.h"
 #include "os-util.h"
-#include "path-util.h"
-#include "runtime-scope.h"
-#include "string-util.h"
-#include "time-util.h"
 
 typedef enum ImageType {
         IMAGE_DIRECTORY,
index 775f6aaff3fbd4ef2f70e8c1fd8ba1bb52dedb2e..646bbfc6337285c2698a5dac01351222adb819ef 100644 (file)
@@ -1,17 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#if HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
 #include <fnmatch.h>
-#include <linux/dm-ioctl.h>
 #include <linux/loop.h>
 #include <sys/file.h>
 #include <sys/mount.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include <sysexits.h>
 
 #if HAVE_OPENSSL
 #include <openssl/err.h>
 #include "constants.h"
 #include "copy.h"
 #include "cryptsetup-util.h"
-#include "device-nodes.h"
 #include "device-private.h"
-#include "device-util.h"
 #include "devnum-util.h"
-#include "discover-image.h"
 #include "dissect-image.h"
 #include "dm-util.h"
 #include "env-file.h"
 #include "env-util.h"
+#include "errno-util.h"
 #include "extension-util.h"
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "fs-util.h"
+#include "format-util.h"
 #include "fsck-util.h"
 #include "gpt.h"
+#include "hash-funcs.h"
 #include "hexdecoct.h"
 #include "hostname-setup.h"
-#include "id128-util.h"
+#include "image-policy.h"
 #include "import-util.h"
 #include "io-util.h"
 #include "json-util.h"
-#include "missing_syscall.h"
+#include "loop-util.h"
 #include "mkdir-label.h"
 #include "mount-util.h"
 #include "mountpoint-util.h"
 #include "path-util.h"
 #include "proc-cmdline.h"
 #include "process-util.h"
-#include "raw-clone.h"
 #include "resize-fs.h"
 #include "signal-util.h"
-#include "sparse-endian.h"
+#include "siphash24.h"
 #include "stat-util.h"
-#include "stdio-util.h"
-#include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
-#include "tmpfile-util.h"
+#include "time-util.h"
 #include "udev-util.h"
 #include "user-util.h"
 #include "xattr-util.h"
@@ -4029,6 +4017,14 @@ Architecture dissected_image_architecture(DissectedImage *img) {
         return _ARCHITECTURE_INVALID;
 }
 
+bool dissected_image_is_portable(DissectedImage *m) {
+        return m && strv_env_pairs_get(m->os_release, "PORTABLE_PREFIXES");
+}
+
+bool dissected_image_is_initrd(DissectedImage *m) {
+        return m && !strv_isempty(m->initrd_release);
+}
+
 int dissect_loop_device(
                 LoopDevice *loop,
                 const VeritySettings *verity,
index 191bfb8fbb73aa31238ea7c16cc6a7036941cbc6..2343b6b46ddd4583c5c9bfa601f83a30ce3b9a73 100644 (file)
@@ -1,29 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
 #include "sd-id128.h"
 
 #include "architecture.h"
-#include "env-util.h"
+#include "forward.h"
 #include "gpt.h"
 #include "list.h"
-#include "loop-util.h"
-#include "macro.h"
-#include "os-util.h"
-#include "strv.h"
 
-typedef struct DissectedImage DissectedImage;
-typedef struct DissectedPartition DissectedPartition;
 typedef struct DecryptedImage DecryptedImage;
-typedef struct MountOptions MountOptions;
-typedef struct VeritySettings VeritySettings;
-typedef struct ImageFilter ImageFilter;
-typedef struct ImagePolicy ImagePolicy;
-typedef struct ExtensionReleaseData ExtensionReleaseData;
 
-struct DissectedPartition {
+typedef struct DissectedPartition {
         bool found:1;
         bool ignored:1;
         bool rw:1;
@@ -42,7 +29,7 @@ struct DissectedPartition {
         uint64_t offset;
         uint64_t gpt_flags;
         int fsmount_fd;
-};
+} DissectedPartition;
 
 #define DISSECTED_PARTITION_NULL                                        \
         ((DissectedPartition) {                                         \
@@ -96,7 +83,7 @@ typedef enum DissectImageFlags {
         DISSECT_IMAGE_IDENTITY_UID              = 1 << 29, /* Explicitly request an identity UID range mapping */
 } DissectImageFlags;
 
-struct DissectedImage {
+typedef struct DissectedImage {
         bool encrypted:1;
         bool has_verity:1;         /* verity available in image, but not necessarily used */
         bool has_verity_sig:1;     /* pkcs#7 signature embedded in image */
@@ -123,15 +110,15 @@ struct DissectedImage {
         char **confext_release;
         char **sysext_release;
         int has_init_system;
-};
+} DissectedImage;
 
-struct MountOptions {
+typedef struct MountOptions {
         PartitionDesignator partition_designator;
         char *options;
         LIST_FIELDS(MountOptions, mount_options);
-};
+} MountOptions;
 
-struct VeritySettings {
+typedef struct VeritySettings {
         /* Binary root hash for the Verity Merkle tree */
         void *root_hash;
         size_t root_hash_size;
@@ -145,24 +132,24 @@ struct VeritySettings {
 
         /* PARTITION_ROOT or PARTITION_USR, depending on what these Verity settings are for */
         PartitionDesignator designator;
-};
+} VeritySettings;
 
 #define VERITY_SETTINGS_DEFAULT (VeritySettings) {              \
                 .designator = _PARTITION_DESIGNATOR_INVALID     \
         }
 
-struct ImageFilter {
+typedef struct ImageFilter {
         /* A per designator glob matching against the partition label */
         char *pattern[_PARTITION_DESIGNATOR_MAX];
-};
+} ImageFilter;
 
-struct ExtensionReleaseData {
+typedef struct ExtensionReleaseData {
         char *os_release_id;
         char *os_release_version_id;
         char *os_release_sysext_level;
         char *os_release_confext_level;
         char *os_release_extension_scope;
-};
+} ExtensionReleaseData;
 
 MountOptions* mount_options_free_all(MountOptions *options);
 DEFINE_TRIVIAL_CLEANUP_FUNC(MountOptions*, mount_options_free_all);
@@ -200,13 +187,8 @@ static inline bool dissected_image_is_bootable_uefi(DissectedImage *m) {
         return m && m->partitions[PARTITION_ESP].found && dissected_image_is_bootable_os(m);
 }
 
-static inline bool dissected_image_is_portable(DissectedImage *m) {
-        return m && strv_env_pairs_get(m->os_release, "PORTABLE_PREFIXES");
-}
-
-static inline bool dissected_image_is_initrd(DissectedImage *m) {
-        return m && !strv_isempty(m->initrd_release);
-}
+bool dissected_image_is_portable(DissectedImage *m);
+bool dissected_image_is_initrd(DissectedImage *m);
 
 DecryptedImage* decrypted_image_ref(DecryptedImage *p);
 DecryptedImage* decrypted_image_unref(DecryptedImage *p);
index a310438b3ce8e788c4892e1b121ccb5ca6cf1430..c9788989d83bf337cf33e3c22100a76c3b5cfc9e 100644 (file)
@@ -6,16 +6,17 @@
 #include <sys/socket.h>
 
 #include "alloc-util.h"
+#include "dns-def.h"
 #include "dns-domain.h"
 #include "glyph-util.h"
-#include "hashmap.h"
+#include "hash-funcs.h"
 #include "hexdecoct.h"
 #include "hostname-util.h"
 #include "idn-util.h"
 #include "in-addr-util.h"
 #include "log.h"
-#include "macro.h"
 #include "parse-util.h"
+#include "siphash24.h"
 #include "string-util.h"
 #include "strv.h"
 #include "utf8.h"
@@ -291,6 +292,10 @@ int dns_label_escape_new(const char *p, size_t l, char **ret) {
         return r;
 }
 
+int dns_name_parent(const char **name) {
+        return dns_label_unescape(name, NULL, DNS_LABEL_MAX, 0);
+}
+
 #if HAVE_LIBIDN
 int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max) {
         _cleanup_free_ uint32_t *input = NULL;
index edfb2f00ca367b4cfc8a7aabb9633eeeb60a574d..6b8070d0ce95b245deea1e02168384a66f4c16a6 100644 (file)
@@ -1,14 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include "dns-def.h"
-#include "hashmap.h"
-#include "in-addr-util.h"
+#include "forward.h"
 
 typedef enum DNSLabelFlags {
         DNS_LABEL_LDH                = 1 << 0, /* Follow the "LDH" rule â€” only letters, digits, and internal hyphens. */
@@ -21,9 +14,7 @@ int dns_label_unescape_suffix(const char *name, const char **label_end, char *de
 int dns_label_escape(const char *p, size_t l, char *dest, size_t sz);
 int dns_label_escape_new(const char *p, size_t l, char **ret);
 
-static inline int dns_name_parent(const char **name) {
-        return dns_label_unescape(name, NULL, DNS_LABEL_MAX, 0);
-}
+int dns_name_parent(const char **name);
 
 #if HAVE_LIBIDN
 int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max);
index 2e285f8eb62e698b54967f21ba5915aff14f68e2..f540f489339eaa77fca4283edc009feda153e582 100644 (file)
@@ -1,26 +1,20 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdarg.h>
 #include <stdio.h>
-#include <stdlib.h>
 
 #include "alloc-util.h"
 #include "chase.h"
 #include "conf-files.h"
-#include "dirent-util.h"
 #include "dropin.h"
 #include "escape.h"
-#include "fd-util.h"
 #include "fileio.h"
-#include "hashmap.h"
 #include "log.h"
-#include "macro.h"
-#include "mkdir.h"
 #include "path-util.h"
 #include "set.h"
+#include "stdio-util.h"
 #include "string-util.h"
 #include "strv.h"
+#include "unit-def.h"
 #include "unit-name.h"
 
 int drop_in_file(
index 8107944de91ed0c0c4c1b507974c16529bafa9a4..ffd4757177728c4ee51e1c446fdf04fc6f3ba389 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "hashmap.h"
-#include "macro.h"
-#include "set.h"
-#include "unit-name.h"
+#include "forward.h"
 
 int drop_in_file(
                 const char *dir,
index becb9c54b76b1104dc282b92ff9607ae3373ae6d..c352994e4e000fe54c821057745f1e5c9e346ce7 100644 (file)
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
 
 #include "alloc-util.h"
 #include "copy.h"
index 89b30fe19908e0295b2ece58dfd3cf2877756027..5bcdaeba16e92c7e1b18724655160caffb8139e2 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
+#include "forward.h"
 
 #define DROPIN_MARKER_START "### Anything between here and the comment below will become the contents of the drop-in file"
 #define DROPIN_MARKER_END "### Edits below this comment will be discarded"
index 4454b444bb62bd1e5e92d72536b4518e31834787..11165cdb9ac16d0b79e45e042db0a8c0d95ccee7 100644 (file)
 #include "sort-util.h"
 #include "stat-util.h"
 #include "stdio-util.h"
+#include "string-util.h"
 #include "utf8.h"
 
-#if ENABLE_EFI
-
 #define LOAD_OPTION_ACTIVE            0x00000001
 #define MEDIA_DEVICE_PATH                   0x04
 #define MEDIA_HARDDRIVE_DP                  0x01
@@ -65,41 +64,7 @@ struct device_path device_path__contents;
 struct device_path__packed device_path__contents _packed_;
 assert_cc(sizeof(struct device_path) == sizeof(struct device_path__packed));
 
-int efi_reboot_to_firmware_supported(void) {
-        _cleanup_free_ void *v = NULL;
-        static int cache = -1;
-        uint64_t b;
-        size_t s;
-        int r;
-
-        if (cache > 0)
-                return 0;
-        if (cache == 0)
-                return -EOPNOTSUPP;
-
-        if (!is_efi_boot())
-                goto not_supported;
-
-        r = efi_get_variable(EFI_GLOBAL_VARIABLE_STR("OsIndicationsSupported"), NULL, &v, &s);
-        if (r == -ENOENT)
-                goto not_supported; /* variable doesn't exist? it's not supported then */
-        if (r < 0)
-                return r;
-        if (s != sizeof(uint64_t))
-                return -EINVAL;
-
-        b = *(uint64_t*) v;
-        if (!(b & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
-                goto not_supported; /* bit unset? it's not supported then */
-
-        cache = 1;
-        return 0;
-
-not_supported:
-        cache = 0;
-        return -EOPNOTSUPP;
-}
-
+#if ENABLE_EFI
 static int get_os_indications(uint64_t *ret) {
         static struct stat cache_stat = {};
         _cleanup_free_ void *v = NULL;
@@ -150,7 +115,94 @@ static int get_os_indications(uint64_t *ret) {
         return 0;
 }
 
+static ssize_t utf16_size(const uint16_t *s, size_t buf_len_bytes) {
+        size_t l = 0;
+
+        /* Returns the size of the string in bytes without the terminating two zero bytes */
+
+        while (l < buf_len_bytes / sizeof(uint16_t)) {
+                if (s[l] == 0)
+                        return (l + 1) * sizeof(uint16_t);
+                l++;
+        }
+
+        return -EINVAL; /* The terminator was not found */
+}
+
+static void to_utf16(uint16_t *dest, const char *src) {
+        int i;
+
+        for (i = 0; src[i] != '\0'; i++)
+                dest[i] = src[i];
+        dest[i] = '\0';
+}
+
+static uint16_t *tilt_slashes(uint16_t *s) {
+        for (uint16_t *p = s; *p; p++)
+                if (*p == '/')
+                        *p = '\\';
+
+        return s;
+}
+
+static int boot_id_hex(const char s[static 4]) {
+        int id = 0;
+
+        assert(s);
+
+        for (int i = 0; i < 4; i++)
+                if (s[i] >= '0' && s[i] <= '9')
+                        id |= (s[i] - '0') << (3 - i) * 4;
+                else if (s[i] >= 'A' && s[i] <= 'F')
+                        id |= (s[i] - 'A' + 10) << (3 - i) * 4;
+                else
+                        return -EINVAL;
+
+        return id;
+}
+#endif
+
+int efi_reboot_to_firmware_supported(void) {
+#if ENABLE_EFI
+        _cleanup_free_ void *v = NULL;
+        static int cache = -1;
+        uint64_t b;
+        size_t s;
+        int r;
+
+        if (cache > 0)
+                return 0;
+        if (cache == 0)
+                return -EOPNOTSUPP;
+
+        if (!is_efi_boot())
+                goto not_supported;
+
+        r = efi_get_variable(EFI_GLOBAL_VARIABLE_STR("OsIndicationsSupported"), NULL, &v, &s);
+        if (r == -ENOENT)
+                goto not_supported; /* variable doesn't exist? it's not supported then */
+        if (r < 0)
+                return r;
+        if (s != sizeof(uint64_t))
+                return -EINVAL;
+
+        b = *(uint64_t*) v;
+        if (!(b & EFI_OS_INDICATIONS_BOOT_TO_FW_UI))
+                goto not_supported; /* bit unset? it's not supported then */
+
+        cache = 1;
+        return 0;
+
+not_supported:
+        cache = 0;
+        return -EOPNOTSUPP;
+#else
+        return -EOPNOTSUPP;
+#endif
+}
+
 int efi_get_reboot_to_firmware(void) {
+#if ENABLE_EFI
         int r;
         uint64_t b;
 
@@ -159,9 +211,13 @@ int efi_get_reboot_to_firmware(void) {
                 return r;
 
         return !!(b & EFI_OS_INDICATIONS_BOOT_TO_FW_UI);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_set_reboot_to_firmware(bool value) {
+#if ENABLE_EFI
         int r;
         uint64_t b, b_new;
 
@@ -176,20 +232,9 @@ int efi_set_reboot_to_firmware(bool value) {
                 return efi_set_variable(EFI_GLOBAL_VARIABLE_STR("OsIndications"), &b_new, sizeof(uint64_t));
 
         return 0;
-}
-
-static ssize_t utf16_size(const uint16_t *s, size_t buf_len_bytes) {
-        size_t l = 0;
-
-        /* Returns the size of the string in bytes without the terminating two zero bytes */
-
-        while (l < buf_len_bytes / sizeof(uint16_t)) {
-                if (s[l] == 0)
-                        return (l + 1) * sizeof(uint16_t);
-                l++;
-        }
-
-        return -EINVAL; /* The terminator was not found */
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_get_boot_option(
@@ -198,7 +243,7 @@ int efi_get_boot_option(
                 sd_id128_t *ret_part_uuid,
                 char **ret_path,
                 bool *ret_active) {
-
+#if ENABLE_EFI
         char variable[STRLEN(EFI_GLOBAL_VARIABLE_STR("Boot")) + 4 + 1];
         _cleanup_free_ uint8_t *buf = NULL;
         size_t l;
@@ -293,22 +338,9 @@ int efi_get_boot_option(
                 *ret_active = header->attr & LOAD_OPTION_ACTIVE;
 
         return 0;
-}
-
-static void to_utf16(uint16_t *dest, const char *src) {
-        int i;
-
-        for (i = 0; src[i] != '\0'; i++)
-                dest[i] = src[i];
-        dest[i] = '\0';
-}
-
-static uint16_t *tilt_slashes(uint16_t *s) {
-        for (uint16_t *p = s; *p; p++)
-                if (*p == '/')
-                        *p = '\\';
-
-        return s;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_add_boot_option(
@@ -319,7 +351,7 @@ int efi_add_boot_option(
                 uint64_t psize,
                 sd_id128_t part_uuid,
                 const char *path) {
-
+#if ENABLE_EFI
         size_t size, title_len, path_len;
         _cleanup_free_ char *buf = NULL;
         struct boot_option *option;
@@ -378,9 +410,13 @@ int efi_add_boot_option(
 
         xsprintf(variable, EFI_GLOBAL_VARIABLE_STR("Boot%04X"), id);
         return efi_set_variable(variable, buf, size);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_remove_boot_option(uint16_t id) {
+#if ENABLE_EFI
         char variable[STRLEN(EFI_GLOBAL_VARIABLE_STR("Boot")) + 4 + 1];
 
         if (!is_efi_boot())
@@ -388,9 +424,13 @@ int efi_remove_boot_option(uint16_t id) {
 
         xsprintf(variable, EFI_GLOBAL_VARIABLE_STR("Boot%04X"), id);
         return efi_set_variable(variable, NULL, 0);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_get_boot_order(uint16_t **ret_order) {
+#if ENABLE_EFI
         _cleanup_free_ void *buf = NULL;
         size_t l;
         int r;
@@ -413,33 +453,24 @@ int efi_get_boot_order(uint16_t **ret_order) {
 
         *ret_order = TAKE_PTR(buf);
         return (int) (l / sizeof(uint16_t));
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_set_boot_order(const uint16_t *order, size_t n) {
-
+#if ENABLE_EFI
         if (!is_efi_boot())
                 return -EOPNOTSUPP;
 
         return efi_set_variable(EFI_GLOBAL_VARIABLE_STR("BootOrder"), order, n * sizeof(uint16_t));
-}
-
-static int boot_id_hex(const char s[static 4]) {
-        int id = 0;
-
-        assert(s);
-
-        for (int i = 0; i < 4; i++)
-                if (s[i] >= '0' && s[i] <= '9')
-                        id |= (s[i] - '0') << (3 - i) * 4;
-                else if (s[i] >= 'A' && s[i] <= 'F')
-                        id |= (s[i] - 'A' + 10) << (3 - i) * 4;
-                else
-                        return -EINVAL;
-
-        return id;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_get_boot_options(uint16_t **ret_options) {
+#if ENABLE_EFI
         _cleanup_closedir_ DIR *dir = NULL;
         _cleanup_free_ uint16_t *list = NULL;
         int count = 0;
@@ -480,9 +511,13 @@ int efi_get_boot_options(uint16_t **ret_options) {
         *ret_options = TAKE_PTR(list);
 
         return count;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 bool efi_has_tpm2(void) {
+#if ENABLE_EFI
         static int cache = -1;
         int r;
 
@@ -521,9 +556,10 @@ bool efi_has_tpm2(void) {
                   log_debug_errno(errno, "Unable to test whether /sys/kernel/security/tpm0/binary_bios_measurements exists, assuming it doesn't: %m");
 
         return (cache = false);
-}
-
+#else
+        return -EOPNOTSUPP;
 #endif
+}
 
 sd_id128_t efi_guid_to_id128(const void *guid) {
         const EFI_GUID *uuid = ASSERT_PTR(guid); /* cast is safe, because struct efi_guid is packed */
index bce5275ba07a634a78c1370f769b1aada7716948..206e6136de40b5a452f15711a9315d8145ce1de1 100644 (file)
@@ -1,13 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "efivars.h"
-#include "efivars-fundamental.h"
-#include "string-util.h"
+#include "sd-id128.h"
 
-/* Various calls for interfacing with EFI variables from the official UEFI specs. */
+#include "forward.h"
 
-#if ENABLE_EFI
+/* Various calls for interfacing with EFI variables from the official UEFI specs. */
 
 int efi_reboot_to_firmware_supported(void);
 int efi_get_reboot_to_firmware(void);
@@ -22,49 +20,5 @@ int efi_get_boot_options(uint16_t **ret_options);
 
 bool efi_has_tpm2(void);
 
-#else
-
-static inline int efi_reboot_to_firmware_supported(void) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_get_reboot_to_firmware(void) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_set_reboot_to_firmware(bool value) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_get_boot_option(uint16_t nr, char **ret_title, sd_id128_t *ret_part_uuid, char **ret_path, bool *ret_active) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_add_boot_option(uint16_t id, const char *title, uint32_t part, uint64_t pstart, uint64_t psize, sd_id128_t part_uuid, const char *path) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_remove_boot_option(uint16_t id) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_get_boot_order(uint16_t **ret_order) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_set_boot_order(const uint16_t *order, size_t n) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_get_boot_options(uint16_t **ret_options) {
-        return -EOPNOTSUPP;
-}
-
-static inline bool efi_has_tpm2(void) {
-        return false;
-}
-
-#endif
-
 sd_id128_t efi_guid_to_id128(const void *guid);
 void efi_id128_to_guid(sd_id128_t id, void *ret_guid);
index 75d935847ac4f91584987ebecb89618daa19dc22..1f4fc665c03b86f8fda351b14fdfabca4bc42a14 100644 (file)
@@ -3,17 +3,19 @@
 #include "alloc-util.h"
 #include "efi-api.h"
 #include "efi-loader.h"
+#include "efivars.h"
 #include "env-util.h"
 #include "log.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "stat-util.h"
+#include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 #include "tpm2-pcr.h"
 #include "utf8.h"
 
 #if ENABLE_EFI
-
 static int read_usec(const char *variable, usec_t *ret) {
         _cleanup_free_ char *j = NULL;
         uint64_t x = 0;
@@ -34,7 +36,16 @@ static int read_usec(const char *variable, usec_t *ret) {
         return 0;
 }
 
+static int get_device_part_uuid(const char *variable, sd_id128_t *ret) {
+        if (!is_efi_boot())
+                return -EOPNOTSUPP;
+
+        return efi_get_variable_id128(variable, ret);
+}
+#endif
+
 int efi_loader_get_boot_usec(usec_t *ret_firmware, usec_t *ret_loader) {
+#if ENABLE_EFI
         uint64_t x, y;
         int r;
 
@@ -60,24 +71,29 @@ int efi_loader_get_boot_usec(usec_t *ret_firmware, usec_t *ret_loader) {
         *ret_firmware = x;
         *ret_loader = y;
         return 0;
-}
-
-static int get_device_part_uuid(const char *variable, sd_id128_t *ret) {
-        if (!is_efi_boot())
-                return -EOPNOTSUPP;
-
-        return efi_get_variable_id128(variable, ret);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_loader_get_device_part_uuid(sd_id128_t *ret) {
+#if ENABLE_EFI
         return get_device_part_uuid(EFI_LOADER_VARIABLE_STR("LoaderDevicePartUUID"), ret);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_stub_get_device_part_uuid(sd_id128_t *ret) {
+#if ENABLE_EFI
         return get_device_part_uuid(EFI_LOADER_VARIABLE_STR("StubDevicePartUUID"), ret);
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_loader_get_entries(char ***ret) {
+#if ENABLE_EFI
         _cleanup_free_ char16_t *entries = NULL;
         _cleanup_strv_free_ char **l = NULL;
         size_t size;
@@ -135,9 +151,13 @@ int efi_loader_get_entries(char ***ret) {
 
         *ret = TAKE_PTR(l);
         return 0;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_loader_get_features(uint64_t *ret) {
+#if ENABLE_EFI
         _cleanup_free_ void *v = NULL;
         size_t s;
         int r;
@@ -186,9 +206,13 @@ int efi_loader_get_features(uint64_t *ret) {
 
         memcpy(ret, v, sizeof(uint64_t));
         return 0;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_stub_get_features(uint64_t *ret) {
+#if ENABLE_EFI
         _cleanup_free_ void *v = NULL;
         size_t s;
         int r;
@@ -234,9 +258,13 @@ int efi_stub_get_features(uint64_t *ret) {
 
         memcpy(ret, v, sizeof(uint64_t));
         return 0;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_measured_uki(int log_level) {
+#if ENABLE_EFI
         _cleanup_free_ char *pcr_string = NULL;
         static int cached = -1;
         unsigned pcr_nr;
@@ -279,9 +307,13 @@ int efi_measured_uki(int log_level) {
                                       pcr_nr, TPM2_PCR_KERNEL_BOOT);
 
         return (cached = 1);
+#else
+        return log_full_errno(log_level, SYNTHETIC_ERRNO(EOPNOTSUPP), "Compiled without support for EFI");
+#endif
 }
 
 int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
+#if ENABLE_EFI
         _cleanup_free_ char *v = NULL;
         static struct stat cache_stat = {};
         struct stat new_stat;
@@ -313,9 +345,13 @@ int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
         cache_stat = new_stat;
         *ret = cache = sec * USEC_PER_SEC; /* return in Î¼s */
         return 0;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat) {
+#if ENABLE_EFI
         _cleanup_free_ char *v = NULL;
         struct stat new_stat;
         int r;
@@ -341,9 +377,13 @@ int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat
         free_and_replace(*cache, v);
 
         return 0;
+#else
+        return -EOPNOTSUPP;
+#endif
 }
 
 int efi_get_variable_id128(const char *variable, sd_id128_t *ret) {
+#if ENABLE_EFI
         int r;
 
         assert(variable);
@@ -357,9 +397,10 @@ int efi_get_variable_id128(const char *variable, sd_id128_t *ret) {
                 return r;
 
         return sd_id128_from_string(p, ret);
-}
-
+#else
+        return -EOPNOTSUPP;
 #endif
+}
 
 bool efi_loader_entry_name_valid(const char *s) {
         if (!filename_is_valid(s)) /* Make sure entry names fit in filenames */
index 0d924e5dc3a35818ebfb791f628abca518f19f16..346f3b5d8b1aaa8f18e61806f67b3cf5f4451de4 100644 (file)
@@ -1,16 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/stat.h>
-
-#include "efivars.h"
-#include "efivars-fundamental.h"
-#include "log.h"
+#include "forward.h"
 
 /* Various calls that interface with EFI variables implementing https://systemd.io/BOOT_LOADER_INTERFACE */
 
-#if ENABLE_EFI
-
 int efi_loader_get_device_part_uuid(sd_id128_t *ret);
 int efi_stub_get_device_part_uuid(sd_id128_t *ret);
 int efi_loader_get_boot_usec(usec_t *ret_firmware, usec_t *ret_loader);
@@ -27,49 +21,4 @@ int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat
 
 int efi_get_variable_id128(const char *variable, sd_id128_t *ret);
 
-#else
-
-static inline int efi_loader_get_device_part_uuid(sd_id128_t *u) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_stub_get_device_part_uuid(sd_id128_t *ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_loader_get_boot_usec(usec_t *firmware, usec_t *loader) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_loader_get_entries(char ***ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_loader_get_features(uint64_t *ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_stub_get_features(uint64_t *ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_measured_uki(int log_level) {
-        return log_full_errno(log_level, SYNTHETIC_ERRNO(EOPNOTSUPP),
-                              "Compiled without support for EFI");
-}
-
-static inline int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat) {
-        return -EOPNOTSUPP;
-}
-
-static inline int efi_get_variable_id128(const char *variable, sd_id128_t *ret) {
-        return -EOPNOTSUPP;
-}
-
-#endif
-
 bool efi_loader_entry_name_valid(const char *s);
index edc2e82d362db3f3c124f03587909625cea10ed4..73a910575de7f38ff9690f6bab4bd7d14d113d9b 100644 (file)
@@ -1,16 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #if HAVE_ELFUTILS
-
 #include <dwarf.h>
 #include <elfutils/libdwelf.h>
 #include <elfutils/libdwfl.h>
 #include <libelf.h>
+#endif
 #include <sys/prctl.h>
-#include <sys/resource.h>
-#include <sys/types.h>
 #include <unistd.h>
 
+#include "sd-json.h"
+
 #include "alloc-util.h"
 #include "dlfcn-util.h"
 #include "elf-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "format-util.h"
-#include "hexdecoct.h"
 #include "io-util.h"
 #include "log.h"
-#include "macro.h"
 #include "memstream-util.h"
 #include "path-util.h"
 #include "process-util.h"
-#include "rlimit-util.h"
+#include "set.h"
 #include "string-util.h"
 
 #define FRAMES_MAX 64
@@ -36,6 +34,8 @@
 /* The amount of data we're willing to write to each of the output pipes. */
 #define COREDUMP_PIPE_MAX (1024*1024U)
 
+#if HAVE_ELFUTILS
+
 static void *dw_dl = NULL;
 static void *elf_dl = NULL;
 
@@ -761,7 +761,10 @@ static int parse_elf(int fd, const char *executable, const char *root, char **re
         return 0;
 }
 
+#endif
+
 int parse_elf_object(int fd, const char *executable, const char *root, bool fork_disable_dump, char **ret, sd_json_variant **ret_package_metadata) {
+#if HAVE_ELFUTILS
         _cleanup_close_pair_ int error_pipe[2] = EBADF_PAIR,
                                  return_pipe[2] = EBADF_PAIR,
                                  json_pipe[2] = EBADF_PAIR;
@@ -912,6 +915,7 @@ int parse_elf_object(int fd, const char *executable, const char *root, bool fork
                 *ret_package_metadata = TAKE_PTR(package_metadata);
 
         return 0;
-}
-
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "elfutils disabled, parsing ELF objects not supported");
 #endif
+}
index 426a05ac42b994ae19b0717138e80317df479b3d..2a3251c28b038a189c95e5b44f2486bf322bfa62 100644 (file)
@@ -1,20 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-json.h"
-
-#include "log.h"
+#include "forward.h"
 
 #if HAVE_ELFUTILS
 int dlopen_dw(void);
 int dlopen_elf(void);
+#endif
 
 /* Parse an ELF object in a forked process, so that errors while iterating over
  * untrusted and potentially malicious data do not propagate to the main caller's process.
  * If fork_disable_dump, the child process will not dump core if it crashes. */
 int parse_elf_object(int fd, const char *executable, const char *root, bool fork_disable_dump, char **ret, sd_json_variant **ret_package_metadata);
-#else
-static inline int parse_elf_object(int fd, const char *executable, const char *root, bool fork_disable_dump, char **ret, sd_json_variant **ret_package_metadata) {
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "elfutils disabled, parsing ELF objects not supported");
-}
-#endif
index fd582c0e78fcbf2a2a1496bf2726a26f87a85376..1529959922aad10389ab1daa8b2bd8cf0b52d903 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <stdbool.h>
-
 #include "env-util.h"
 #include "mempool.h"
 #include "process-util.h"
index 5ba45e400578c006a034395603fae9e4a7f29186..5309eabff4e4ee3b2c6eab6501de5f72d6653bb2 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 /* These functions are split out of fileio.h (and not for example just flags to the functions they wrap) in order to
  * optimize linking: This way, -lselinux is needed only for the callers of these functions that need selinux, but not
  * for all */
index 85fd2a09734bf02a2cffd32cdfb99c199c62d300..bf0095a5ff6cee9946e66c49dedcf432b9c1b81a 100644 (file)
@@ -1,13 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <linux/ethtool.h>
-#include <linux/netdevice.h>
 #include <linux/sockios.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 
 #include "alloc-util.h"
 #include "conf-parser.h"
+#include "errno-util.h"
+#include "ether-addr-util.h"
 #include "ethtool-util.h"
 #include "extract-word.h"
 #include "fd-util.h"
 #include "parse-util.h"
 #include "socket-util.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "strv.h"
 #include "strxcpyx.h"
+#include "time-util.h"
 
 static const char* const duplex_table[_DUP_MAX] = {
         [DUP_FULL] = "full",
index c363aed23f62be4cca92416fa2458d7d377c1e04..eea27fb381d2351b2a03c68efc42f6a4135dd81e 100644 (file)
@@ -2,12 +2,9 @@
 #pragma once
 
 #include <linux/ethtool.h>
-#include <macro.h>
-#include <net/ethernet.h>
 
-#include "conf-parser.h"
-#include "ether-addr-util.h"
-#include "time-util.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 #define N_ADVERTISE 4
 
index acd476c692e5e599af247bd2987924991dc03268..83dbc6cbab58704f976ac16d9504f5fbed67a80f 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <dirent.h>
-#include <errno.h>
 #include <stdio.h>
-#include <sys/prctl.h>
-#include <sys/types.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "hashmap.h"
-#include "macro.h"
-#include "missing_syscall.h"
+#include "log.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "serialize.h"
-#include "set.h"
-#include "signal-util.h"
 #include "stat-util.h"
 #include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
 #include "terminal-util.h"
+#include "time-util.h"
 
 #define EXIT_SKIP_REMAINING 77
 
index 52acf342c33e3ee2b74f79ee6aa963125676370a..fcc1ad065fd992faa90a361a9b8fb7ace2a1f22a 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "time-util.h"
+#include "forward.h"
 
 typedef int (*gather_stdout_callback_t) (int fd, void *arg);
 
index 0ac688b7635174f18dc671514a156d5a2b844b04..d7567dc026f897b8aef381f4f78b930f6b64cf57 100644 (file)
@@ -5,9 +5,7 @@
 #include <sysexits.h>
 
 #include "exit-status.h"
-#include "macro.h"
 #include "parse-util.h"
-#include "set.h"
 #include "string-util.h"
 
 const ExitStatusMapping exit_status_mappings[256] = {
index c22cba05b2ae0fc0a30eac920627f2f875213be4..920caf5175872619f26dc20898b09c4049f1b136 100644 (file)
@@ -1,11 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
 #include "bitmap.h"
-#include "hashmap.h"
-#include "macro.h"
+#include "forward.h"
 
 /* This defines pretty names for the LSB 'start' verb exit codes. Note that they shouldn't be confused with
  * the LSB 'status' verb exit codes which are defined very differently. For details see:
index d8b16b94e168f0276a800c9d0a0abc320ea923e4..afaea7e3ae94642f05f5f420882e227354f10cfb 100644 (file)
@@ -7,6 +7,7 @@
 #include "extension-util.h"
 #include "log.h"
 #include "os-util.h"
+#include "string-util.h"
 #include "strv.h"
 
 int extension_release_validate(
index 3cad219d51beb87f9a1d652e7ae59c9b01882b1e..8bc0359820a997afcefa3630105a02f534f6bf2e 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "os-util.h"
+#include "forward.h"
 
 /* Given an image name (for logging purposes), a set of os-release values from the host and a key-value pair
  * vector of extension-release variables, check that the distro and (system extension level or distro
index 82f22d696f8f42e1e67ac63d8cbcbd4954b83444..46a103eeebdaf636b140361765e22c83cfb2d01c 100644 (file)
@@ -1,11 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <unistd.h>
+
 #include "sd-json.h"
 
 #include "alloc-util.h"
 #include "efivars.h"
 #include "env-util.h"
 #include "factory-reset.h"
+#include "log.h"
 #include "os-util.h"
 #include "proc-cmdline.h"
 #include "string-table.h"
index 49ae7007b062971acdf574b7c3fb90965b9f0a04..06903fca182df9ab5bbbb2d04b136dcca2fa5510 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
-#include "errno-list.h"
-#include "macro.h"
+#include "forward.h"
 
 typedef enum FactoryResetMode {
         FACTORY_RESET_UNSUPPORTED,    /* feature not available on this OS */
index bca81b30a0f0111d4f17cf58d967b30f2364c255..2a0b7d765b36049b3ec848dbb8cf9fc52323382b 100644 (file)
@@ -8,6 +8,7 @@
 #include "fdisk-util.h"
 #include "log.h"
 #include "parse-util.h"
+#include "string-util.h"
 
 #if HAVE_LIBFDISK
 
index 316a763b0d392bf875a7610ebedad236d153db35..eb4b3231a04c8aec197b4791fa10c2d3c5bced76 100644 (file)
@@ -3,11 +3,9 @@
 
 #if HAVE_LIBFDISK
 
-#include <libfdisk.h>
+#include <libfdisk.h> /* IWYU pragma: export */
 
-#include "sd-id128.h"
-
-#include "memory-util.h"
+#include "forward.h"
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_context*, fdisk_unref_context, NULL);
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_partition*, fdisk_unref_partition, NULL);
index 7f4b15b1790f27c995f31021513c997519b68849..832e7fda6079355a0bfddcfefdfef20bf38a7837 100644 (file)
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stddef.h>
 #include <unistd.h>
 
 #include "sd-daemon.h"
 #include "fd-util.h"
 #include "fdset.h"
 #include "log.h"
-#include "macro.h"
 #include "parse-util.h"
-#include "path-util.h"
 #include "set.h"
 #include "stat-util.h"
+#include "string-util.h"
 
 #define MAKE_SET(s) ((Set*) s)
 #define MAKE_FDSET(s) ((FDSet*) s)
index 3e69d32146c868b33c273aa5906640cf58b4437e..96a17c78350a1df52eff635a87d9134963eac326 100644 (file)
@@ -1,13 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "hashmap.h"
-#include "macro.h"
-#include "set.h"
-
-typedef struct FDSet FDSet;
+#include "forward.h"
+#include "iterator.h"
 
 FDSet* fdset_new(void);
 FDSet* fdset_free(FDSet *s);
index b0ec7ec41007e4112d48f1cb8652b812f07f414d..06c74a4851a2cb0ffc48455284aa72268a1ca6d3 100644 (file)
@@ -1,8 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdio.h>
+
 #include "alloc-util.h"
 #include "fido2-util.h"
 #include "fileio.h"
+#include "iovec-util.h"
 #include "libfido2-util.h"
 #include "log.h"
 #include "random-util.h"
index 73f39b43caf706c72c9bcbeb30eef26e2917a3fb..8eccf2cc0db384ef0373450829970daba8579ca2 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdint.h>
-
-#include "iovec-util.h"
+#include "forward.h"
 
 int fido2_generate_salt(struct iovec *ret_salt);
 int fido2_read_salt_file(const char *filename, uint64_t offset, const char *client, const char *node, struct iovec *ret_salt);
index e0550a7a09c4dac4db912b378e3f1a90c155cd8c..639076384eadb00658b0e060cba5c45e57e76e31 100644 (file)
@@ -1,9 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <linux/magic.h>
+#include <stdlib.h>
 #include <sys/vfs.h>
+#include <unistd.h>
 
 #include "sd-device.h"
+#include "sd-gpt.h"
 #include "sd-id128.h"
 
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "find-esp.h"
-#include "gpt.h"
 #include "mount-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "stat-util.h"
 #include "string-util.h"
+#include "strv.h"
 #include "virt.h"
 
 typedef enum VerifyESPFlags {
index 2e132a74aa090c5ee6ed8c60e03dc622a7a25044..1dd0f486008d84f81340653df164678fb814c15f 100644 (file)
@@ -2,11 +2,7 @@
 
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "sd-id128.h"
+#include "forward.h"
 
 int find_esp_and_warn_at(int rfd, const char *path, int unprivileged_mode, char **ret_path, uint32_t *ret_part, uint64_t *ret_pstart, uint64_t *ret_psize, sd_id128_t *ret_uuid, dev_t *ret_devid);
 int find_esp_and_warn(const char *root, const char *path, int unprivileged_mode, char **ret_path, uint32_t *ret_part, uint64_t *ret_pstart, uint64_t *ret_psize, sd_id128_t *ret_uuid, dev_t *ret_devid);
index 35b4c24e2dea4371ff9bf11889cfeac61d618141..1e5b59f0ddb76d5b4700d35d17260034e7a87583 100644 (file)
@@ -1,23 +1,17 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <arpa/inet.h>
 #include <endian.h>
-#include <errno.h>
 #include <libiptc/libiptc.h>
-#include <linux/if.h>
 #include <linux/netfilter/nf_nat.h>
 #include <linux/netfilter/xt_addrtype.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
-#include <net/if.h>
-#include <stddef.h>
 #include <string.h>
 
 #include "alloc-util.h"
 #include "dlfcn-util.h"
-#include "firewall-util.h"
 #include "firewall-util-private.h"
 #include "in-addr-util.h"
-#include "macro.h"
+#include "log.h"
 #include "socket-util.h"
 
 static DLSYM_PROTOTYPE(iptc_check_entry) = NULL;
index f8273f340c98fa022ae23b1b76cb93d446b36d9b..66c0665d6662b337f2c65b144ce988012697aa99 100644 (file)
@@ -1,14 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <arpa/inet.h>
 #include <endian.h>
-#include <errno.h>
-#include <linux/netfilter/nf_nat.h>
 #include <linux/netfilter/nf_tables.h>
 #include <linux/netfilter_ipv4.h>
 #include <netinet/ip.h>
 #include <netinet/ip6.h>
-#include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "sd-netlink.h"
 #include "firewall-util.h"
 #include "firewall-util-private.h"
 #include "in-addr-util.h"
-#include "macro.h"
+#include "log.h"
 #include "netlink-internal.h"
-#include "netlink-util.h"
 #include "parse-util.h"
 #include "socket-util.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "time-util.h"
 
 #define NFT_SYSTEMD_DNAT_MAP_NAME "map_port_ipport"
index 2e9a23171109c44c0469d01141a22bed5c0fcd74..7e965494c8dbbcee988accda10db0b67ce9e7ec9 100644 (file)
@@ -1,13 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "sd-netlink.h"
-
 #include "firewall-util.h"
-#include "in-addr-util.h"
+#include "forward.h"
 
 typedef enum FirewallBackend {
         FW_BACKEND_NONE,
index e96b24a72d85d87d66aae85c987f43431277b0df..c8dfad5d3368b9061a66e41056d829ec7d86b979 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "alloc-util.h"
@@ -10,6 +9,7 @@
 #include "log.h"
 #include "netlink-util.h"
 #include "string-table.h"
+#include "string-util.h"
 
 static const char * const firewall_backend_table[_FW_BACKEND_MAX] = {
         [FW_BACKEND_NONE] = "none",
index 2c79ab4081747b79b0b019157817abac449db35a..d4acac55eed7f301a0e9d02ecab74d52a63eb5f1 100644 (file)
@@ -1,11 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "conf-parser.h"
-#include "in-addr-util.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 typedef struct FirewallContext FirewallContext;
 
index 883d9b5195dc098c8ccd4e5c72cee8dc56b94cf5..6e4a0300fff44916afd064f0c3f8f61c1dc9b65a 100644 (file)
@@ -1,20 +1,20 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <sys/types.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include "build-path.h"
 #include "escape.h"
 #include "event-util.h"
 #include "exit-status.h"
-#include "fd-util.h"
 #include "fork-journal.h"
 #include "log.h"
 #include "notify-recv.h"
 #include "parse-util.h"
+#include "pidref.h"
 #include "process-util.h"
+#include "runtime-scope.h"
 #include "signal-util.h"
-#include "socket-util.h"
 #include "strv.h"
 
 static int on_child_exit(sd_event_source *s, const siginfo_t *si, void *userdata) {
index 1825a7f5eb7637a53d8902087efca069abcb8c8f..a53a452b26a8d10a4684562e3fd1d9dbefc822e7 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "macro.h"
-#include "pidref.h"
-#include "runtime-scope.h"
-#include "set.h"
+#include "forward.h"
 
 int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref);
 
index 7c3539abaa58358f35ed36728ce82e51602c7738..c672be326d2a6954259259821a8679b8d24df7bb 100644 (file)
@@ -1,28 +1,22 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <ctype.h>
-#include <net/if.h>
 #include <unistd.h>
 
 #include "sd-id128.h"
 
 #include "alloc-util.h"
 #include "devnum-util.h"
-#include "fd-util.h"
 #include "fileio.h"
 #include "format-ifname.h"
 #include "format-table.h"
 #include "format-util.h"
-#include "fs-util.h"
 #include "glyph-util.h"
 #include "gunicode.h"
-#include "id128-util.h"
 #include "in-addr-util.h"
-#include "log.h"
 #include "memory-util.h"
 #include "memstream-util.h"
 #include "pager.h"
-#include "parse-util.h"
 #include "path-util.h"
 #include "pretty-print.h"
 #include "process-util.h"
index 1a4cd56f4d3ab48fd80c662c97d4245b9e73ed5b..beea0cbe1b458cd803edfe1e3b0d8694a90275c2 100644 (file)
@@ -1,14 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdio.h>
-#include <sys/types.h>
-
 #include "sd-json.h"
 
-#include "macro.h"
-#include "memory-util.h"
+#include "forward.h"
+#include "log.h"
 #include "pager.h"
 
 typedef enum TableDataType {
index 82458536c57991a13e3a7f2921627b4472c59e4d..57ab68deb67cdc9d1438bc433b6efb4082c6cb15 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -11,7 +10,7 @@
 #include "fstab-util.h"
 #include "initrd-util.h"
 #include "libmount-util.h"
-#include "macro.h"
+#include "log.h"
 #include "nulstr-util.h"
 #include "parse-util.h"
 #include "path-util.h"
@@ -393,6 +392,10 @@ char* fstab_node_to_udev_node(const char *p) {
         return strdup(p);
 }
 
+const char* fstab_path(void) {
+        return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab";
+}
+
 bool fstab_is_bind(const char *options, const char *fstype) {
 
         if (fstab_test_option(options, "bind\0" "rbind\0"))
index cf909c60f83b314d3af8400462fe8de30daa66c0..59d909d44f6112fab83813728c8a720815247cf4 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "assert-util.h"
-#include "macro.h"
+#include "forward.h"
 
 bool fstab_enabled_full(int enabled);
 static inline bool fstab_enabled(void) {
@@ -53,8 +48,6 @@ int fstab_find_pri(const char *opts, int *ret);
 
 char* fstab_node_to_udev_node(const char *p);
 
-static inline const char* fstab_path(void) {
-        return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab";
-}
+const char* fstab_path(void);
 
 bool fstab_is_bind(const char *options, const char *fstype);
index 86fcced09848453e42dc84aa48c980182a27d4ed..3a9d10ad69dec332ab96b42998d29aab89762665 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
+#include <stdlib.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "generator.h"
 #include "initrd-util.h"
 #include "log.h"
-#include "macro.h"
 #include "mkdir-label.h"
 #include "mountpoint-util.h"
 #include "parse-util.h"
 #include "path-util.h"
-#include "process-util.h"
 #include "special.h"
 #include "specifier.h"
 #include "string-util.h"
index 68ea9b376ff0d5fb7d59c556a1a4788a9198523c..8a1f55cc906fb489ae740fe455f8f416a23e0b97 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdio.h>
-
-#include "errno-list.h"
-#include "macro.h"
+#include "forward.h"
 #include "main-func.h"
 
 int generator_open_unit_file_full(const char *dest, const char *source, const char *name, FILE **ret_file, char **ret_final_path, char **ret_temp_path);
index 96a1eeaf6aac8cb5791282f913a5cef8041d4772..b40c4ced0e548d400d14260de1465bbf542d31fa 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <linux/if_link.h>
 
-#include "conf-parser.h"
+#include "forward.h"
 
 typedef enum GeneveDF {
         NETDEV_GENEVE_DF_UNSET    = GENEVE_DF_UNSET,
index a443cc5e993c204a85d0b66e7f99be6817fd90e8..9bb66b7c4038ff83aa7870203f461a2f876cebfe 100644 (file)
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "alloc-util.h"
 #include "gpt.h"
 #include "string-table.h"
 #include "string-util.h"
index 7a67eddebeea79b4078f64d5b7fd8adcaa523707..309bb32bc22a178f1677602e337819681fe60c4d 100644 (file)
@@ -1,13 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <uchar.h>
-
-#include "sd-gpt.h"
+#include "sd-gpt.h" /* IWYU pragma: export */
 #include "sd-id128.h"
 
 #include "architecture.h"
-#include "id128-util.h"
+#include "forward.h"
 #include "sparse-endian.h"
 
 /* maximum length of gpt label */
index f7dd3b73a40155fe5dfbc96ebb499c6ecd41f6a3..85433b15374ef1ecc8eef2c6c2f3ab40cbdff3ee 100644 (file)
@@ -5,6 +5,7 @@
 #include "group-record.h"
 #include "json-util.h"
 #include "log.h"
+#include "string-util.h"
 #include "strv.h"
 #include "uid-classification.h"
 #include "user-util.h"
index bc45166b65272aa3f5c3c2491dd7f4bd91ab34e5..c450fd1a2e52a2ff71413dea85837ebbedadad29 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-json.h"
-
+#include "forward.h"
 #include "user-record.h"
 
 typedef struct GroupRecord {
index 55ca4d5cf09f0bfea4d230eae56d8a375ac76855..de1fdfe9b5b11d8d525fe594a50145733d633ed3 100644 (file)
@@ -3,19 +3,16 @@
   Copyright Â© 2018 Dell Inc.
 ***/
 
+#include <linux/fiemap.h>
 #include <linux/magic.h>
-#include <stddef.h>
 #include <sys/ioctl.h>
-#include <unistd.h>
 
 #include "alloc-util.h"
 #include "blockdev-util.h"
 #include "btrfs-util.h"
-#include "device-util.h"
 #include "devnum-util.h"
 #include "efivars.h"
 #include "env-util.h"
-#include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "hibernate-util.h"
@@ -25,8 +22,6 @@
 #include "path-util.h"
 #include "proc-cmdline.h"
 #include "stat-util.h"
-#include "string-util.h"
-#include "strv.h"
 
 #define HIBERNATION_SWAP_THRESHOLD 0.98
 
index 966cc39f1ddf284b58e70b9964a47e7358ed8d00..719e2c0554c775fa4397ffba86dfdc9e707cb504 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <linux/fiemap.h>
-#include <stdint.h>
-#include <sys/types.h>
-
-#include "assert-util.h"
+#include "forward.h"
 
 /* represents values for /sys/power/resume & /sys/power/resume_offset and the corresponding path */
 typedef struct HibernationDevice {
index 33b6a05ad860aff3ac7847996ec14a0cc2dab15e..bb942838b7eacaed8117fca547fc72689926012b 100644 (file)
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/utsname.h>
 #include <unistd.h>
 
@@ -18,7 +16,6 @@
 #include "hostname-util.h"
 #include "initrd-util.h"
 #include "log.h"
-#include "macro.h"
 #include "proc-cmdline.h"
 #include "siphash24.h"
 #include "string-table.h"
index 526ea0b7ebde71cb21209207f3195fae7917344a..d3cb59b3fccf4bf6ccad9809ec154b5468d288e1 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum HostnameSource {
         HOSTNAME_STATIC,     /* from /etc/hostname */
index 72946b8cb0010da0d58ef23ddddc75360e649c1c..10d6e8ee48eeeaf9e85236be41d94400ec6feed7 100644 (file)
@@ -3,10 +3,10 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "alloc-util.h"
 #include "conf-files.h"
-#include "env-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
@@ -21,6 +21,7 @@
 #include "strbuf.h"
 #include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 #include "tmpfile-util.h"
 #include "verbs.h"
 
index 00610b18d49364158e4ed6574b20f6fa38bba6d7..6e41b8b588715cba00ed0a29a359779e54ae7abc 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "sd-hwdb.h" /* IWYU pragma: export */
 
-#include "sd-hwdb.h"
+#include "forward.h"
 
 bool hwdb_should_reload(sd_hwdb *hwdb);
 int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool compat);
index 788be8089ae38907fc37bb8166e3462071c81edc..3656da142a57afebba62cbd8444008ac0d0af117 100644 (file)
@@ -8,7 +8,6 @@
 #include "id128-print.h"
 #include "log.h"
 #include "pretty-print.h"
-#include "terminal-util.h"
 
 int id128_pretty_print_sample(const char *name, sd_id128_t id) {
         _cleanup_free_ char *man_link = NULL, *mod_link = NULL;
index 4e3b9ba4d1a472a00bd664b011a4f0f0a0d17a8e..0048e95729316fb9d04848785cd2a37cf63e2b08 100644 (file)
@@ -2,11 +2,10 @@
 
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-
 #include "sd-id128.h"
 
+#include "forward.h"
+
 typedef enum Id128PrettyPrintMode {
         ID128_PRINT_ID128,
         ID128_PRINT_UUID,
index ccb2db411f0d1b6b063c03f99829fc6b8b26efd8..6613023754fddedeccbc69eb63d36ccce6b82db5 100644 (file)
@@ -7,7 +7,6 @@
 #  include <stringprep.h>
 #endif
 
-#include "alloc-util.h"
 #include "dlfcn-util.h"
 #include "idn-util.h"
 #include "log.h"
index 986f2cfd9e34215178137380c1639955c809957c..734ec9d999ce6c97b7f230d526c00d79d406920f 100644 (file)
@@ -8,8 +8,7 @@
 #  include <stringprep.h>
 #endif
 
-#include <errno.h>
-#include <inttypes.h>
+#include "forward.h"
 
 #if HAVE_LIBIDN2 || HAVE_LIBIDN
 #include "dlfcn-util.h"
index 922db786e6820b17b766c6eda2573385309aedc2..fb864f6063fa01cb24597f475d35a79fe7812ad2 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 bool use_ima(void);
index e08fbba96648eac774527677b9b0413579e3db0d..16fc91e1fe9d79691d4a3b2134363ba2bf110e0d 100644 (file)
@@ -3,6 +3,7 @@
 #include "alloc-util.h"
 #include "extract-word.h"
 #include "image-policy.h"
+#include "log.h"
 #include "logarithm.h"
 #include "sort-util.h"
 #include "string-util.h"
@@ -774,6 +775,10 @@ int image_policy_intersect(const ImagePolicy *a, const ImagePolicy *b, ImagePoli
         return 0;
 }
 
+ImagePolicy* image_policy_free(ImagePolicy *p) {
+        return mfree(p);
+}
+
 int image_policy_ignore_designators(const ImagePolicy *p, const PartitionDesignator table[], size_t n_table, ImagePolicy **ret) {
         assert(p);
         assert(table || n_table == 0);
index afb0d4fe9e9e4de36096c470a98752102c2b90ab..6f5c1d23d6dbbe7affb9bec756516b90b8c54852 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "conf-parser.h"
-#include "dissect-image.h"
-#include "errno-list.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
+#include "gpt.h"
 
 typedef enum PartitionPolicyFlags {
         /* Not all policy flags really make sense on all partition types, see comments. But even if they
@@ -96,9 +96,7 @@ int image_policy_equivalent(const ImagePolicy *a, const ImagePolicy *b);   /* ch
 
 int image_policy_intersect(const ImagePolicy *a, const ImagePolicy *b, ImagePolicy **ret);
 
-static inline ImagePolicy* image_policy_free(ImagePolicy *p) {
-        return mfree(p);
-}
+ImagePolicy* image_policy_free(ImagePolicy *p);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(ImagePolicy*, image_policy_free);
 
index 0c61ea449f5a1f45c36404a027435ac2ed9a0e87..50794a86ba96df0cacd71e005ad558c160898b04 100644 (file)
@@ -1,16 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "alloc-util.h"
 #include "btrfs-util.h"
 #include "chattr-util.h"
 #include "errno-util.h"
 #include "import-util.h"
 #include "log.h"
-#include "macro.h"
 #include "nulstr-util.h"
-#include "path-util.h"
 #include "string-table.h"
 #include "string-util.h"
 
index 91bc3083e46a3510d091ed1d2f566d3f76159270..8779293cdfff131a18c0a97cc66634f97fc8f83a 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <stdbool.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum ImportType {
         IMPORT_RAW,
index edccca5a5b97c5e1d600b9d4d02f7b8972b9a69e..0f4dcfb36141ddc3557d6bcd7a3a1fe74b920eba 100644 (file)
@@ -2,8 +2,12 @@
 
 #include "alloc-util.h"
 #include "extract-word.h"
+#include "hash-funcs.h"
 #include "hostname-util.h"
 #include "in-addr-prefix-util.h"
+#include "log.h"
+#include "set.h"
+#include "siphash24.h"
 #include "string-util.h"
 
 /* 0.0.0.0/0 */
index 53aaad356cdbf05fdcbd47ba97357cb51a22c944..b18609a1212115da901d6671516ee5a413bc40b1 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "conf-parser.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 #include "in-addr-util.h"
-#include "set.h"
 
 struct in_addr_prefix {
         int family;
index 205a3be44a3f96c1f9313b85c5d2d81f1140caa6..8d2e08c6c9f4a1d618b57316b711a9445a450980 100644 (file)
@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <limits.h>
+#include "forward.h"
 
 #if defined(__FreeBSD_kernel__)
 #  define INIT_FIFO  "/etc/.initctl"
index ea8cbbf928e70b4ad47d65ac7cd8236ebc8f91c8..c3de84f5790ea007072c01806a99a1fe42e2a4c3 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "btrfs-util.h"
 #include "chattr-util.h"
@@ -9,7 +11,6 @@
 #include "fs-util.h"
 #include "install-file.h"
 #include "log.h"
-#include "missing_syscall.h"
 #include "rm-rf.h"
 #include "sync-util.h"
 
index af07ab29d226a41e5f7c0fa1e0596220817d040a..e72dac3e971e9dd1e9c6a25dc8c5260e33bf34b0 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 typedef enum InstallFileFlags {
         INSTALL_REPLACE    = 1 << 0, /* Replace an existing inode */
         INSTALL_READ_ONLY  = 1 << 1, /* Call fs_make_very_read_only() to make the inode comprehensively read-only */
index 501338f188adbcf0d5f20bd08b8346bac106fad2..81a5e4a73e6e355e81bff57f66fffd70b070ed26 100644 (file)
@@ -1,18 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-
 #include "alloc-util.h"
-#include "format-util.h"
 #include "install.h"
 #include "install-printf.h"
-#include "macro.h"
 #include "specifier.h"
 #include "string-util.h"
 #include "unit-name.h"
-#include "user-util.h"
 
 static int specifier_prefix_and_instance(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
         const InstallInfo *i = ASSERT_PTR(userdata);
index 8c7842ba2c050a200b14341aa7f05cf999b26100..f88449ffe1d4082e85d3408991a81aaf7cbe669d 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "install.h"
-#include "unit-name.h"
+#include "forward.h"
 
 int install_name_printf(
                 RuntimeScope scope,
index 30f2de388e0c341fe105cb76d9e99fc2c55bdd5f..8c6909ddf2e9e25545d4bf2cc28d1451190ffd19 100644 (file)
@@ -1,12 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <fnmatch.h>
-#include <limits.h>
-#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "conf-parser.h"
 #include "constants.h"
 #include "dirent-util.h"
-#include "errno-list.h"
+#include "errno-util.h"
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
+#include "glyph-util.h"
 #include "hashmap.h"
 #include "install.h"
 #include "install-printf.h"
-#include "locale-util.h"
 #include "log.h"
-#include "macro.h"
 #include "mkdir-label.h"
 #include "path-lookup.h"
 #include "path-util.h"
@@ -38,6 +33,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "unit-file.h"
+#include "unit-name.h"
 
 #define UNIT_FILE_FOLLOW_SYMLINK_MAX 64
 
index 56e4d0f742c8ed466bf6db38330fef7a822107a0..0f9b0798aa8d12efa5b6f9d54c2dfef569c6f473 100644 (file)
@@ -1,32 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-typedef enum UnitFilePresetMode UnitFilePresetMode;
-typedef enum InstallChangeType InstallChangeType;
-typedef enum UnitFileFlags UnitFileFlags;
-typedef enum InstallMode InstallMode;
-typedef struct InstallChange InstallChange;
-typedef struct UnitFileList UnitFileList;
-typedef struct InstallInfo InstallInfo;
-
-#include "hashmap.h"
-#include "macro.h"
-#include "path-lookup.h"
-#include "strv.h"
+#include "forward.h"
+#include "runtime-scope.h"
 #include "unit-file.h"
-#include "unit-name.h"
 
-enum UnitFilePresetMode {
+typedef enum UnitFilePresetMode {
         UNIT_FILE_PRESET_FULL,
         UNIT_FILE_PRESET_ENABLE_ONLY,
         UNIT_FILE_PRESET_DISABLE_ONLY,
         _UNIT_FILE_PRESET_MODE_MAX,
         _UNIT_FILE_PRESET_MODE_INVALID = -EINVAL,
-};
+} UnitFilePresetMode;
 
-enum InstallChangeType {
+typedef enum InstallChangeType {
         INSTALL_CHANGE_SYMLINK,
         INSTALL_CHANGE_UNLINK,
         INSTALL_CHANGE_IS_MASKED,
@@ -37,31 +24,31 @@ enum InstallChangeType {
         _INSTALL_CHANGE_TYPE_MAX,
         _INSTALL_CHANGE_INVALID = -EINVAL,
         _INSTALL_CHANGE_ERRNO_MAX = -ERRNO_MAX, /* Ensure this type covers the whole negative errno range */
-};
+} InstallChangeType;
 
 static inline bool INSTALL_CHANGE_TYPE_VALID(InstallChangeType t) {
         return t >= _INSTALL_CHANGE_ERRNO_MAX && t < _INSTALL_CHANGE_TYPE_MAX;
 }
 
-enum UnitFileFlags {
+typedef enum UnitFileFlags {
         UNIT_FILE_RUNTIME                  = 1 << 0, /* Public API via DBUS, do not change */
         UNIT_FILE_FORCE                    = 1 << 1, /* Public API via DBUS, do not change */
         UNIT_FILE_PORTABLE                 = 1 << 2, /* Public API via DBUS, do not change */
         UNIT_FILE_DRY_RUN                  = 1 << 3,
         UNIT_FILE_IGNORE_AUXILIARY_FAILURE = 1 << 4,
         _UNIT_FILE_FLAGS_MASK_PUBLIC = UNIT_FILE_RUNTIME|UNIT_FILE_PORTABLE|UNIT_FILE_FORCE,
-};
+} UnitFileFlags;
 
 /* type can be either one of the INSTALL_CHANGE_SYMLINK, INSTALL_CHANGE_UNLINK, â€¦ listed above, or a negative
  * errno value.
  *
  * If source is specified, it should be the contents of the path symlink. In case of an error, source should
  * be the existing symlink contents or NULL. */
-struct InstallChange {
+typedef struct InstallChange {
         int type; /* INSTALL_CHANGE_SYMLINK, â€¦ if positive, errno if negative */
         char *path;
         char *source;
-};
+} InstallChange;
 
 static inline bool install_changes_have_modification(const InstallChange *changes, size_t n_changes) {
         FOREACH_ARRAY(i, changes, n_changes)
@@ -70,21 +57,21 @@ static inline bool install_changes_have_modification(const InstallChange *change
         return false;
 }
 
-struct UnitFileList {
+typedef struct UnitFileList {
         char *path;
         UnitFileState state;
-};
+} UnitFileList;
 
-enum InstallMode {
+typedef enum InstallMode {
         INSTALL_MODE_REGULAR,
         INSTALL_MODE_LINKED,
         INSTALL_MODE_ALIAS,
         INSTALL_MODE_MASKED,
         _INSTALL_MODE_MAX,
         _INSTALL_MODE_INVALID = -EINVAL,
-};
+} InstallMode;
 
-struct InstallInfo {
+typedef struct InstallInfo {
         char *name;
         char *path;
         char *root;
@@ -100,7 +87,7 @@ struct InstallInfo {
 
         InstallMode install_mode;
         bool auxiliary;
-};
+} InstallInfo;
 
 int unit_file_enable(
                 RuntimeScope scope,
index 606d2b2dbeeb4b55fb049e70dd8412eed26d1621..676ef3bf5a6ba138536600892540075e73f872de 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <netinet/in.h>
-
 #include "alloc-util.h"
 #include "ip-protocol-list.h"
-#include "macro.h"
 #include "parse-util.h"
 #include "string-util.h"
 
index b87157013204070a1068654287889bd967609b08..cb8599787bf03380734c518ec844795584216d44 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 const char* ip_protocol_to_name(int id);
 int ip_protocol_from_name(const char *name);
index 1f2e2ffe7b50603cb58d5e94f8b4ba5ade671fd1..1906c8026f47053cfac0f2a877b51dd22ea9a49d 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <net/if.h>
-
 #include "ipvlan-util.h"
 #include "string-table.h"
 
index bc286d9d8815fba8a7c3daa8c09962b46097d7de..c96201742b57aa27307eaeffc35b4a9251ccd286 100644 (file)
@@ -1,11 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
 #include <linux/if_link.h>
-#include <netinet/in.h>
 
-#include "macro.h"
+#include "forward.h"
 
 typedef enum IPVlanMode {
         NETDEV_IPVLAN_MODE_L2 = IPVLAN_MODE_L2,
index 74f85fadced77f8711bb998ce53eabdc9c0fdca3..ce799e9256e1a0825f938db399e5ce0b75181130 100644 (file)
@@ -3,20 +3,17 @@
 #include <pthread.h>
 #include <unistd.h>
 
+#include "sd-event.h"
+
 #include "alloc-util.h"
 #include "chattr-util.h"
 #include "copy.h"
 #include "errno-util.h"
-#include "fd-util.h"
-#include "format-util.h"
 #include "journal-authenticate.h"
 #include "journal-file-util.h"
 #include "log.h"
-#include "path-util.h"
-#include "random-util.h"
 #include "set.h"
-#include "stat-util.h"
-#include "sync-util.h"
+#include "string-util.h"
 
 #define PAYLOAD_BUFFER_SIZE (16U * 1024U)
 #define MINIMUM_HOLE_SIZE (1U * 1024U * 1024U / 2U)
index 780fe5368eaba9ab50b88d7dd193a47a171ead5a..978ff1c1605e73eae184d3c02f79e11f380c2999 100644 (file)
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "journal-file.h"
+#include "journal-file.h" /* IWYU pragma: export */
+#include "forward.h"
 
 int journal_file_set_offline(JournalFile *f, bool wait);
 bool journal_file_is_offlining(JournalFile *f);
index a7b491f024ebdcf5845bd2813ddfd0e4bd7c5dce..43681f5d227c3904537e624cb741ced6a0da8eaa 100644 (file)
@@ -1,17 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <malloc.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "escape.h"
 #include "fd-util.h"
-#include "io-util.h"
 #include "journal-file.h"
 #include "journal-importer.h"
-#include "journal-util.h"
 #include "log.h"
 #include "parse-util.h"
 #include "string-util.h"
index 50d378f76757c9471064b419135aef455446646c..13f699ae4d3da7ba11261236f1dda1619be65ff9 100644 (file)
@@ -2,13 +2,9 @@
 
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
-#include <sys/uio.h>
-
 #include "sd-id128.h"
 
-#include "io-util.h"
+#include "forward.h"
 #include "iovec-wrapper.h"
 #include "time-util.h"
 
index 73c582475e32dc7274188eb440d430578e99c7aa..e30bd522bbe52fb61bcdd15c995dc01431a27136 100644 (file)
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+#include "sd-journal.h"
+
 #include "acl-util.h"
 #include "alloc-util.h"
 #include "bus-error.h"
@@ -112,7 +115,7 @@ int journal_access_check_and_warn(sd_journal *j, bool quiet, bool want_other_use
         HASHMAP_FOREACH_KEY(path, code, j->errors) {
                 int err;
 
-                err = abs(PTR_TO_INT(code));
+                err = ABS(PTR_TO_INT(code));
 
                 switch (err) {
                 case EACCES:
index 5bd8e340b2efe754e815c66cef332be914a2560e..2805ae197636f2d5cad69b7962319157ddec615b 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <sys/types.h>
+#include "sd-journal.h" /* IWYU pragma: export */
 
-#include "sd-journal.h"
+#include "forward.h"
 
 int journal_access_blocked(sd_journal *j);
 int journal_access_check_and_warn(sd_journal *j, bool quiet, bool want_other_users);
index a8e365e3ca43abaa4d20a00dc5535515506d4482..35ae976baaf6d3c69f426f3f5aec22d616b86c7f 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 int keymap_directories(char ***ret);
 int get_keymaps(char ***ret);
index c1a0a952f5341e343bc419179a709cd0623edfd9..9bc984e91903bc04c8664d4679e14105f3bd44c1 100644 (file)
@@ -1,13 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "alloc-util.h"
 #include "conf-parser.h"
 #include "kernel-config.h"
-#include "macro.h"
 #include "path-util.h"
-#include "strv.h"
 
 int load_kernel_install_conf(
                 const char *root,
index 568187061cf8834b302e377c05c88370688b9a76..2c149ba3bd1f136bcfbab7c81ffedc5ba6dc080a 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "forward.h"
+
 int load_kernel_install_conf(
                 const char *root,
                 const char *conf_root,
index 3e31ec92ef2e39e7b1a62c0aae105264d7097f49..73a78a920ce406f94dd5c8114e0503bdeaff3eaa 100644 (file)
@@ -3,13 +3,11 @@
 #include "alloc-util.h"
 #include "env-file.h"
 #include "fd-util.h"
-#include "fileio.h"
 #include "kernel-image.h"
 #include "log.h"
-#include "os-util.h"
-#include "parse-util.h"
 #include "pe-binary.h"
 #include "string-table.h"
+#include "string-util.h"
 
 #define PE_SECTION_READ_MAX (16U*1024U)
 
index e9526e87eba850a2e2195e5c1ff924b60cf34d3c..0474728050c16ce9c87c99f82e4409ee87002d7c 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum KernelImageType {
         KERNEL_IMAGE_TYPE_UNKNOWN,
index 9d853fd566bfdddf4d189e98a572cbdabb577e85..5db307560f1ceec1b9710b3b4d9bffdb64a98e65 100644 (file)
@@ -3,26 +3,22 @@
   Copyright Â© 2010 ProFUSION embedded systems
 ***/
 
-#include <errno.h>
 #include <signal.h>
 #include <sys/wait.h>
-#include <unistd.h>
 
 #include "alloc-util.h"
-#include "constants.h"
-#include "dirent-util.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "format-util.h"
 #include "initrd-util.h"
 #include "killall.h"
 #include "log.h"
-#include "parse-util.h"
+#include "pidref.h"
 #include "process-util.h"
 #include "set.h"
-#include "stdio-util.h"
 #include "string-util.h"
 #include "terminal-util.h"
+#include "time-util.h"
 
 static int argv_has_at(const PidRef *pid) {
         int r;
index d8ef96f7d1c186eb718ba24db94922d0b8024723..1eb198acec490d180db71c62a5e8a93c6127c54e 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "time-util.h"
+#include "forward.h"
 
 int broadcast_signal(int sig, bool wait_for_exit, bool send_sighup, usec_t timeout);
index a7723438662e8f39aa23f7d44ed6dba817399364..b4d5d4505a82cb03b549eeddfe8a2796d5c092c9 100644 (file)
@@ -1,15 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
 #include "btrfs-util.h"
 #include "errno-util.h"
 #include "fs-util.h"
-#include "label.h"
 #include "label-util.h"
-#include "macro.h"
 #include "selinux-util.h"
 #include "smack-util.h"
 
index 5a19a4cd433047856d43a6268140b98f805461d6..b135c0f1ab77e835e797def361d66b1a095905b8 100644 (file)
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <stdbool.h>
-#include <sys/types.h>
+#include "forward.h"
+#include "label.h"      /* IWYU pragma: export */
 
 typedef enum LabelFixFlags {
         LABEL_IGNORE_ENOENT = 1 << 0,
index 9c3415047723c026c207c7a646cc008921978dec..dcc9efa810dd6b14c64204bf250a3b3daf4cf9ac 100644 (file)
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <syslog.h>
+
 #include "libarchive-util.h"
-#include "log.h"
 
 #if HAVE_LIBARCHIVE
 static void *libarchive_dl = NULL;
index 2695b18a7fb0386d3406bd9a268b7de0f6b4d9f5..aeda1ecb4cbb0c0860009dd630098992ae03e6b1 100644 (file)
@@ -1,15 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
-#include "dlfcn-util.h"
+#include "forward.h"
 
 #if HAVE_LIBARCHIVE
-#include <archive.h>
-#include <archive_entry.h>
+#include <archive.h>            /* IWYU pragma: export */
+#include <archive_entry.h>      /* IWYU pragma: export */
 
-#include "memory-util.h"
+#include "dlfcn-util.h"
 
 extern DLSYM_PROTOTYPE(archive_entry_free);
 extern DLSYM_PROTOTYPE(archive_entry_new);
index da85c84d203a617783f93a14ebfca72039016c7e..eb738d227483fa236a6444bf1b77e5946086aae7 100644 (file)
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <linux/audit.h>
 #include <linux/netlink.h>
 #include <stdio.h>
 #include <sys/socket.h>
 
+#include "errno-util.h"
 #include "fd-util.h"
 #include "iovec-util.h"
 #include "libaudit-util.h"
index 1887e180c227da9b4c0d991c6a7d084938ebd6a6..bd91a1cb93807a0f78074e2c48fa3b0db80fa423 100644 (file)
@@ -2,10 +2,10 @@
 #pragma once
 
 #if HAVE_AUDIT
-#  include <libaudit.h>
+#  include <libaudit.h>         /* IWYU pragma: export */
 #endif
 
-#include <stdbool.h>
+#include "forward.h"
 
 bool use_audit(void);
 
index c04c0eeea86b43e7f75fe5d6ed04d4a00794a1d9..7c48b5e0d30d2b9b0e1acbddca3d02560fcd33d7 100644 (file)
 #  include <unistd.h>
 #endif
 
-#include <errno.h>
 #include <stdlib.h>
 
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "libcrypt-util.h"
 #include "log.h"
-#include "macro.h"
-#include "memory-util.h"
-#include "random-util.h"
 #include "string-util.h"
 #include "strv.h"
 
index 8abaec2112cc6030b3114c5f2d1ab435ed56eea0..25790f9ad3fc92e3ce9811af92be85939ceb3ec6 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
+#include "forward.h"
 
 int make_salt(char **ret);
 int hash_password_full(const char *password, void **cd_data, int *cd_size, char **ret);
index f01b0016d48d77c2decc0888480e401556d4c943..0cc64c8674eb9a6a73f921718137957ed4e54c12 100644 (file)
@@ -10,7 +10,7 @@
 #include "dlfcn-util.h"
 #include "format-table.h"
 #include "glyph-util.h"
-#include "memory-util.h"
+#include "iovec-util.h"
 #include "plymouth-util.h"
 #include "string-util.h"
 #include "strv.h"
index 18aec372a7fcea790e8826d789b4e094486901af..dbb4f1fc922e148bb3a83b671c1901535fc7aabe 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
-#include "iovec-util.h"
-#include "macro.h"
+#include "forward.h"
 
 #define FIDO2_SALT_SIZE 32U
 
index 2e7b28caa52f340accb9004c575b1dce79701ad7..aada5a7eb538472e1acdc5e7b6dcfd1a6b725ce6 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 
+#include "fstab-util.h"
 #include "libmount-util.h"
 #include "log.h"
 
@@ -40,6 +41,13 @@ int libmount_parse_full(
         return 0;
 }
 
+int libmount_parse_fstab(
+        struct libmnt_table **ret_table,
+        struct libmnt_iter **ret_iter) {
+
+        return libmount_parse_full(fstab_path(), NULL, ret_table, ret_iter);
+}
+
 int libmount_is_leaf(
                 struct libmnt_table *table,
                 struct libmnt_fs *fs) {
index b559fa59758f0953e8407d1d6eb1fefd397ae52d..b6bd7f1d592cb005b7225e78e74abf6c8a697cc3 100644 (file)
@@ -2,11 +2,9 @@
 #pragma once
 
 /* This needs to be after sys/mount.h */
-#include <libmount.h>
+#include <libmount.h> /* IWYU pragma: export */
 
-#include "fstab-util.h"
-#include "macro.h"
-#include "memory-util.h"
+#include "forward.h"
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_table*, mnt_free_table, NULL);
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_iter*, mnt_free_iter, NULL);
@@ -32,12 +30,7 @@ static inline int libmount_parse_with_utab(
         return libmount_parse_full(NULL, NULL, ret_table, ret_iter);
 }
 
-static inline int libmount_parse_fstab(
-                struct libmnt_table **ret_table,
-                struct libmnt_iter **ret_iter) {
-
-        return libmount_parse_full(fstab_path(), NULL, ret_table, ret_iter);
-}
+int libmount_parse_fstab(struct libmnt_table **ret_table, struct libmnt_iter **ret_iter);
 
 int libmount_is_leaf(
                 struct libmnt_table *table,
index 85269d4d709318361b298a4ec2c647ff07eaa7f1..35b99c2aa0300f331a4709b571540e790f58c6a6 100644 (file)
@@ -1,15 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <net/if_arp.h>
-
 #include "sd-netlink.h"
 
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "local-addresses.h"
 #include "log.h"
-#include "macro.h"
 #include "netlink-util.h"
+#include "socket-util.h"
 #include "sort-util.h"
 
 static int address_compare(const struct local_address *a, const struct local_address *b) {
index 9e8374fa6f3acfb5c9df775f8090594cc9304f03..ed8aa055ce68317e18086578ea751bbb1e2ecac6 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-netlink.h"
-
+#include "forward.h"
 #include "in-addr-util.h"
 
 struct local_address {
index 3f23741bd777f88ab888cf156f6815aadb9abf29..4a2f21e4e18ef030c135038f086664ee2f26459e 100644 (file)
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
+#include <stdlib.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "alloc-util.h"
 #include "env-file.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "locale-setup.h"
+#include "log.h"
 #include "proc-cmdline.h"
 #include "stat-util.h"
+#include "string-util.h"
 #include "strv.h"
 
 void locale_context_clear(LocaleContext *c) {
index 537acc72df83c344acac7c5fb5af4e297cf49e05..ae32219aa4baceebd4652fc6618f8fd73e9eb37a 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <sys/stat.h>
 
+#include "forward.h"
 #include "locale-util.h"
 
 typedef struct LocaleContext {
index 270fe2bc345ff260cf21e250cf5c780c861d2712..cf2fba29854b53349b4b69d6719dfc082d01848e 100644 (file)
@@ -1,10 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <fcntl.h>
 #include <signal.h>
-#include <stdint.h>
-#include <stdlib.h>
 #include <syslog.h>
 #include <unistd.h>
 
 #include "sd-messages.h"
 
 #include "alloc-util.h"
-#include "fd-util.h"
 #include "format-util.h"
 #include "glyph-util.h"
 #include "hashmap.h"
-#include "hostname-util.h"
 #include "id128-util.h"
-#include "io-util.h"
 #include "journal-internal.h"
 #include "journal-util.h"
 #include "locale-util.h"
 #include "log.h"
 #include "logs-show.h"
-#include "macro.h"
 #include "output-mode.h"
 #include "parse-util.h"
 #include "pretty-print.h"
+#include "rlimit-util.h"
+#include "set.h"
+#include "sigbus.h"
 #include "sparse-endian.h"
 #include "stdio-util.h"
 #include "string-table.h"
@@ -434,7 +429,7 @@ static int output_timestamp_realtime(
 
                 if (IN_SET(mode, OUTPUT_SHORT_ISO, OUTPUT_SHORT_ISO_PRECISE)) {
                         int h = tm.tm_gmtoff / 60 / 60,
-                                m = abs((int) ((tm.tm_gmtoff / 60) % 60));
+                                m = ABS((int) ((tm.tm_gmtoff / 60) % 60));
 
                         assert_se(snprintf_ok(buf + tail, sizeof(buf) - tail, "%+03d:%02d", h, m));
                 }
@@ -2316,3 +2311,11 @@ int journal_get_log_ids(
         *ret_n_ids = n_ids;
         return n_ids > 0;
 }
+
+void journal_browse_prepare(void) {
+        /* Increase max number of open files if we can, we might needs this when browsing journal files,
+         * which might be split up into many files. */
+        (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
+
+        sigbus_install();
+}
index 4156c9c28308b2de32e3ce53e1c56eefa151e9fd..7d1fe67f889b732a0c573b929cc106749873084b 100644 (file)
@@ -1,20 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
-#include "sd-journal.h"
 
-#include "macro.h"
-#include "output-mode.h"
-#include "rlimit-util.h"
-#include "set.h"
-#include "sigbus.h"
-#include "time-util.h"
+#include "forward.h"
 
 typedef struct LogId {
         sd_id128_t id; /* boot ID or invocation ID */
@@ -135,10 +124,4 @@ static inline int journal_get_boots(
                                    ret_ids, ret_n_ids);
 }
 
-static inline void journal_browse_prepare(void) {
-        /* Increase max number of open files if we can, we might needs this when browsing journal files,
-         * which might be split up into many files. */
-        (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
-
-        sigbus_install();
-}
+void journal_browse_prepare(void);
index 71bc6e725cf1cd4100e73d323b97aa2403a81ecc..78180631a53f375b0b4e4d8e7386572e3b8845c3 100644 (file)
@@ -4,9 +4,7 @@
 #include <valgrind/memcheck.h>
 #endif
 
-#include <errno.h>
 #include <fcntl.h>
-#include <linux/blkpg.h>
 #include <linux/loop.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include "fileio.h"
 #include "fs-util.h"
 #include "loop-util.h"
-#include "missing_fs.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "random-util.h"
 #include "stat-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
+#include "time-util.h"
 
 static void cleanup_clear_loop_close(int *fd) {
         if (*fd < 0)
index 0f9b76e91e3e2614a69ccb432287cc3ad5f0e114..fe9b3f1053413e7a644dde848741f6a45098ea09 100644 (file)
@@ -1,18 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-
-#include "sd-device.h"
-
-#include "memory-util.h"
-#include "time-util.h"
-
-typedef struct LoopDevice LoopDevice;
+#include "forward.h"
 
 /* Some helpers for setting up loopback block devices */
 
-struct LoopDevice {
+typedef struct LoopDevice {
         unsigned n_ref;
         int fd;
         int lock_fd;
@@ -28,7 +21,7 @@ struct LoopDevice {
         uint64_t diskseq; /* Block device sequence number, monothonically incremented by the kernel on create/attach, or 0 if we don't know */
         uint32_t sector_size;
         uint64_t device_size;
-};
+} LoopDevice;
 
 /* Returns true if LoopDevice object is not actually a loopback device but some other block device we just wrap */
 #define LOOP_DEVICE_IS_FOREIGN(d) ((d)->nr < 0)
index f1eb0fb11387481e5ac4fdc6368499eb08e01c3b..a2fd14d50704268cdaaa3149413df5ac97bf9732 100644 (file)
@@ -1,14 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <net/if.h>
-#include <stdlib.h>
 
 #include "sd-netlink.h"
 
+#include "errno-util.h"
 #include "log.h"
 #include "loopback-setup.h"
 #include "missing_network.h"
-#include "netlink-util.h"
 #include "time-util.h"
 
 #define LOOPBACK_SETUP_TIMEOUT_USEC (5 * USEC_PER_SEC)
index 6f02babe14496c3e49a631e468b8f99676ce2736..ae7db4b01cdba43cb71a1fb9a15b9c94054154c2 100644 (file)
@@ -7,7 +7,6 @@
 #include "fileio.h"
 #include "log.h"
 #include "machine-credential.h"
-#include "macro.h"
 #include "memory-util.h"
 #include "path-util.h"
 #include "string-util-fundamental.h"
index f22358645016cd9d9d8f3d76536b8160d7786884..9734e5287813f939c9f5dfa93786a71b409b5423 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <sys/types.h>
+#include "forward.h"
 
 typedef struct MachineCredential {
         char *id;
index 979799f8252a60d0fe736bdcb6177f8813506345..b6c67510892d92b1c134778d9c6afec56a5a5858 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <fcntl.h>
-#include <sched.h>
 #include <sys/mount.h>
 #include <unistd.h>
 
 #include "chase.h"
 #include "creds-util.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "id128-util.h"
 #include "initrd-util.h"
 #include "io-util.h"
 #include "log.h"
 #include "machine-id-setup.h"
-#include "macro.h"
-#include "mkdir.h"
 #include "mount-util.h"
 #include "mountpoint-util.h"
 #include "namespace-util.h"
@@ -26,6 +24,7 @@
 #include "process-util.h"
 #include "stat-util.h"
 #include "string-util.h"
+#include "strv.h"
 #include "sync-util.h"
 #include "umask-util.h"
 #include "virt.h"
index 595b1d157022a8b5ab675016d5a6a8339cca8674..a5100766a44c9b97bc9f51a84148bf65761557b4 100644 (file)
@@ -1,10 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
 #include "sd-id128.h"
 
+#include "forward.h"
+
 typedef enum MachineIdSetupFlags {
         MACHINE_ID_SETUP_FORCE_TRANSIENT = 1 << 0,
         MACHINE_ID_SETUP_FORCE_FIRMWARE  = 1 << 1,
index 8fa17540eb5777630c3b74a39482da28e421592f..8744ec3d5da504b523a46028365bfa8972fedec2 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
+#include "sd-bus.h"
 
 #include "btrfs-util.h"
 #include "label-util.h"
index dfc553f8b6bd6c734353aa6a4990d20afb5e3682..0719ba011fea431a202954417d091102dd221a8d 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "sd-bus.h"
+#include "forward.h"
 
 int setup_machine_directory(sd_bus_error *error, bool use_btrfs_subvol, bool use_btrfs_quota);
index 11dffe99b2a2b6919a6b13dc352c92c6ee6d50b6..2fb3d0c5bf763e40a212d73123a293b43ccc4db4 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "conf-parser.h"
 #include "macvlan-util.h"
 #include "string-table.h"
 
index c8d7c77cc43e8d8fa42293b8808e4303dc4cad25..f2e5e458c3698a51b90197e0a3c1ec0b057b8ad8 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
 #include <linux/if_link.h>
 
-#include "macro.h"
+#include "forward.h"
 
 typedef enum MacVlanMode {
         NETDEV_MACVLAN_MODE_PRIVATE = MACVLAN_MODE_PRIVATE,
index c86121836344d69f64635825384f585198a3daed..d16b6f1b9d8b69a58ac9d095904f6e7323a59518 100644 (file)
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
 #if HAVE_VALGRIND_VALGRIND_H
 #  include <valgrind/valgrind.h>
 #endif
@@ -14,6 +15,7 @@
 #include "polkit-agent.h"
 #include "selinux-util.h"
 #include "signal-util.h"
+#include "string-util.h"
 
 void main_prepare(int argc, char *argv[]) {
         assert_se(argc > 0 && !isempty(argv[0]));
@@ -48,3 +50,11 @@ int raise_or_exit_status(int ret) {
         /* exit with failure if raise() does not immediately abort the program. */
         return EXIT_FAILURE;
 }
+
+int exit_failure_if_negative(int result) {
+        return result < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+int exit_failure_if_nonzero(int result) {
+        return result < 0 ? EXIT_FAILURE : result;
+}
index 0faaba60883c37f8d5c6933b647376fb2f7cb7b4..eca4c765a05e8a6981747a4f3533c31cafd0f3ed 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdlib.h>
-
+#include "forward.h"
 #include "static-destruct.h"
 
 void main_prepare(int argc, char *argv[]);
@@ -20,18 +19,14 @@ void main_finalize(int r, int exit_status);
                 return result_to_return_value(r);                       \
         }
 
-static inline int exit_failure_if_negative(int result) {
-        return result < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-}
+int exit_failure_if_negative(int result);
 
 /* Negative return values from impl are mapped to EXIT_FAILURE, and
  * everything else means success! */
 #define DEFINE_MAIN_FUNCTION(impl)                                      \
         _DEFINE_MAIN_FUNCTION(,impl(argc, argv), exit_failure_if_negative, exit_failure_if_negative)
 
-static inline int exit_failure_if_nonzero(int result) {
-        return result < 0 ? EXIT_FAILURE : result;
-}
+int exit_failure_if_nonzero(int result);
 
 /* Zero is mapped to EXIT_SUCCESS, negative values are mapped to EXIT_FAILURE,
  * and positive values are propagated.
index 3039e5e29e4698f4f504a42f93395a33ebd36d6f..79789e5b5366a9e58f372f8daab578508782074f 100644 (file)
@@ -51,6 +51,8 @@ shared_sources = files(
         'coredump-util.c',
         'cpu-set-util.c',
         'creds-util.c',
+        'cryptsetup-fido2.c',
+        'cryptsetup-tpm2.c',
         'cryptsetup-util.c',
         'daemon-util.c',
         'data-fd-util.c',
@@ -160,6 +162,7 @@ shared_sources = files(
         'resize-fs.c',
         'resolve-util.c',
         'rm-rf.c',
+        'seccomp-util.c',
         'securebits-util.c',
         'selinux-util.c',
         'serialize.c',
@@ -237,16 +240,12 @@ syscall_list_inc = custom_target(
         capture : true)
 
 generated_sources += syscall_list_inc
+shared_sources += syscall_list_inc
 
 if conf.get('ENABLE_UTMP') == 1
         shared_sources += files('utmp-wtmp.c')
 endif
 
-if conf.get('HAVE_SECCOMP') == 1
-        shared_sources += files('seccomp-util.c')
-        shared_sources += syscall_list_inc
-endif
-
 if conf.get('HAVE_LIBIPTC') == 1
         shared_sources += files('firewall-util-iptables.c')
 endif
@@ -259,14 +258,6 @@ if conf.get('HAVE_PAM') == 1
         shared_sources += files('pam-util.c')
 endif
 
-if conf.get('HAVE_LIBFIDO2') == 1 and conf.get('HAVE_LIBCRYPTSETUP') == 1
-        shared_sources += files('cryptsetup-fido2.c')
-endif
-
-if conf.get('HAVE_TPM2') == 1 and conf.get('HAVE_LIBCRYPTSETUP') == 1
-        shared_sources += files('cryptsetup-tpm2.c')
-endif
-
 generate_ip_protocol_list = find_program('generate-ip-protocol-list.sh')
 ip_protocol_list_txt = custom_target(
         'ip-protocol-list.txt',
index e3afc2b666c017c19cf9d15b4e635761bc5efe77..71ecdffaa28fcbf9d2f5534bf9e5f842680e13b1 100644 (file)
@@ -3,10 +3,10 @@
 #include <sys/stat.h>
 
 #include "errno-util.h"
+#include "label-util.h"
 #include "mkdir-label.h"
 #include "selinux-util.h"
 #include "smack-util.h"
-#include "user-util.h"
 
 int mkdirat_label(int dirfd, const char *path, mode_t mode) {
         int r;
index a9a8ce3a59e63b48220ac47064d757d00b37e643..ef5722d035ffed8c9b029ccff60a162d7b9ec2c4 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <sys/types.h>
-
+#include "forward.h"
 #include "mkdir.h"
 
 int mkdirat_label(int dirfd, const char *path, mode_t mode);
index c7385dac9af3596fbce37744bb2a445f9459921a..d0ecb391d602045363b72dd0240dadc5f16074cd 100644 (file)
@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
 #include <sys/mount.h>
 #include <unistd.h>
 
-#include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "format-util.h"
 #include "fs-util.h"
-#include "id128-util.h"
 #include "log.h"
 #include "mkfs-util.h"
 #include "mount-util.h"
@@ -19,6 +19,7 @@
 #include "stat-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
+#include "strv.h"
 #include "tmpfile-util.h"
 #include "utf8.h"
 
index 165862e7e1ddc32caa3a03bd1ddb798f24e30aab..e20d9dc63e1166566bf60e0ac07eb0bf5fc94d2c 100644 (file)
@@ -1,11 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
 #include "sd-id128.h"
 
-#include "strv.h"
+#include "forward.h"
 
 int mkfs_exists(const char *fstype);
 
index 56e93e87323b0395038cf233c665fa7d50a251ee..dcdc122ffbbe8bc903b3d1722115956ec5e77c03 100644 (file)
@@ -1,7 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
+#include <syslog.h>
 
+#include "log.h"
 #include "module-util.h"
 #include "proc-cmdline.h"
 #include "strv.h"
index 8fd6a7f8e6bc2cca2464565928906f323bb138de..e98e0049b6e9a79768673faea7d35a01943a55f2 100644 (file)
@@ -1,14 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "dlfcn-util.h"
+#include "forward.h"
 
 #if HAVE_KMOD
 
-#include <libkmod.h>
+#include <libkmod.h> /* IWYU pragma: export */
 
-#include "macro.h"
-#include "memory-util.h"
+#include "dlfcn-util.h"
 
 extern DLSYM_PROTOTYPE(kmod_list_next);
 extern DLSYM_PROTOTYPE(kmod_load_resources);
index 02f77cbf1c093efa6b0be420862859376486b48b..564ab038ec17ab87b366c1561afe81287b96278e 100644 (file)
@@ -1,36 +1,27 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdlib.h>
 #include <sys/mount.h>
-#include <sys/statvfs.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "bus-util.h"
-#include "cgroup-setup.h"
-#include "cgroup-util.h"
 #include "conf-files.h"
 #include "dev-setup.h"
-#include "dirent-util.h"
-#include "efi-loader.h"
+#include "efivars.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
-#include "fs-util.h"
 #include "label-util.h"
 #include "log.h"
-#include "macro.h"
 #include "mkdir-label.h"
 #include "mount-setup.h"
 #include "mount-util.h"
 #include "mountpoint-util.h"
-#include "nulstr-util.h"
 #include "path-util.h"
 #include "recurse-dir.h"
-#include "set.h"
 #include "smack-util.h"
+#include "string-util.h"
 #include "strv.h"
-#include "user-util.h"
+#include "time-util.h"
 #include "virt.h"
 
 typedef enum MountMode {
index 58a1b7619c86bac8bd2bae8aee6bd355f5cdd1b2..5d505c17dc97b06dc99acd07c2b6fdb5fa556290 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 bool mount_point_is_api(const char *path);
 bool mount_point_ignore(const char *path);
index 10868be08ebba81f63dfec1b706c6650da6f1673..9a1cc31fac6c66a04680bf6667d2e4a70bd08fb2 100644 (file)
@@ -1,26 +1,22 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <linux/loop.h>
 #include <stdlib.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
-#include <sys/statvfs.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "chase.h"
 #include "dissect-image.h"
-#include "exec-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 "fstab-util.h"
 #include "glyph-util.h"
 #include "hashmap.h"
-#include "initrd-util.h"
-#include "label-util.h"
 #include "libmount-util.h"
 #include "log.h"
 #include "missing_syscall.h"
 #include "mount-util.h"
 #include "mountpoint-util.h"
 #include "namespace-util.h"
-#include "parse-util.h"
+#include "os-util.h"
 #include "path-util.h"
+#include "pidref.h"
 #include "process-util.h"
 #include "set.h"
 #include "sort-util.h"
 #include "stat-util.h"
-#include "stdio-util.h"
-#include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
 #include "tmpfile-util.h"
@@ -1873,6 +1868,25 @@ int make_fsmount(
         return TAKE_FD(mnt_fd);
 }
 
+char* umount_and_rmdir_and_free(char *p) {
+        if (!p)
+                return NULL;
+
+        PROTECT_ERRNO;
+        (void) umount_recursive(p, 0);
+        (void) rmdir(p);
+        return mfree(p);
+}
+
+char* umount_and_free(char *p) {
+        if (!p)
+                return NULL;
+
+        PROTECT_ERRNO;
+        (void) umount_recursive(p, 0);
+        return mfree(p);
+}
+
 char* umount_and_unlink_and_free(char *p) {
         if (!p)
                 return NULL;
index 005ea93ec9ff6659c82e7da76613b8781b6ad9ed..92ce4c5816ce1db717875f41f7cdecfd62447c58 100644 (file)
@@ -2,15 +2,8 @@
 #pragma once
 
 #include <mntent.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <unistd.h>
 
-#include "alloc-util.h"
-#include "dissect-image.h"
-#include "errno-util.h"
-#include "macro.h"
-#include "pidref.h"
+#include "forward.h"
 
 typedef struct SubMount {
         char *path;
@@ -94,25 +87,10 @@ int mode_to_inaccessible_node(const char *runtime_dir, mode_t mode, char **dest)
 int mount_flags_to_string(unsigned long flags, char **ret);
 
 /* Useful for usage with _cleanup_(), unmounts, removes a directory and frees the pointer */
-static inline char* umount_and_rmdir_and_free(char *p) {
-        if (!p)
-                return NULL;
-
-        PROTECT_ERRNO;
-        (void) umount_recursive(p, 0);
-        (void) rmdir(p);
-        return mfree(p);
-}
+char* umount_and_rmdir_and_free(char *p);
 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_rmdir_and_free);
 
-static inline char* umount_and_free(char *p) {
-        if (!p)
-                return NULL;
-
-        PROTECT_ERRNO;
-        (void) umount_recursive(p, 0);
-        return mfree(p);
-}
+char* umount_and_free(char *p);
 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_free);
 
 char* umount_and_unlink_and_free(char *p);
index 67a088f7c8dc155543d2ed9377855bb3df0ce1c8..52b9374ff09007ebd106437275dfe4f071be7096 100644 (file)
@@ -1,17 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <fnmatch.h>
-#include <netinet/ether.h>
+
+#include "sd-device.h"
 
 #include "alloc-util.h"
 #include "condition.h"
 #include "env-util.h"
+#include "extract-word.h"
 #include "log.h"
 #include "net-condition.h"
 #include "netif-util.h"
-#include "network-util.h"
+#include "set.h"
 #include "socket-util.h"
-#include "string-table.h"
+#include "string-util.h"
 #include "strv.h"
 #include "wifi-util.h"
 
index 0884d43f4604f5c98b9e397c64a81df94f94eb54..ff3f2a36b5a45ff95e3ce223e35a7fb3f7fb853c 100644 (file)
@@ -2,13 +2,9 @@
 #pragma once
 
 #include <linux/nl80211.h>
-#include <stdbool.h>
 
-#include "sd-device.h"
-
-#include "conf-parser.h"
-#include "ether-addr-util.h"
-#include "set.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 typedef struct NetMatch {
         Set *hw_addr;
index c51e5a01ddd7a976ff5eb9d4a0848468c6c6128b..afa5b9d842f0a1a87f20700432dd41301f50e717 100644 (file)
@@ -1,9 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
+
 #include "sd-device.h"
 
 #include "alloc-util.h"
 #include "device-private.h"
+#include "log.h"
 #include "netif-naming-scheme.h"
 #include "proc-cmdline.h"
 #include "string-table.h"
index 5ead1f85d780783ce93d8b7c8659429559464d8c..18696726c3d326b54e5cc506d34be2b229f2e561 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "sd-device.h"
-
-#include "macro.h"
+#include "forward.h"
 
 /* So here's the deal: net_id is supposed to be an exercise in providing stable names for network devices. However, we
  * also want to keep updating the naming scheme used in future versions of net_id. These two goals of course are
index a4ec8666d02ce6771690b25387134153d17e3442..f621a9dde7e4f108d3bb43a1fb3da66a71b3e0f4 100644 (file)
@@ -1,11 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-device.h"
+#include "sd-netlink.h"
+
 #include "alloc-util.h"
+#include "conf-parser.h"
 #include "device-util.h"
+#include "ether-addr-util.h"
 #include "netif-sriov.h"
-#include "netlink-util.h"
 #include "parse-util.h"
 #include "set.h"
+#include "siphash24.h"
 #include "stdio-util.h"
 #include "string-table.h"
 #include "string-util.h"
index 49e05fa28585b2b6a28d4a43364454b5237b27f3..7fc7393bd3056a4af3653f39212f34319cd8ee77 100644 (file)
@@ -2,13 +2,10 @@
 #pragma once
 
 #include <linux/if_link.h>
+#include <net/ethernet.h>
 
-#include "sd-device.h"
-#include "sd-netlink.h"
-
-#include "conf-parser.h"
-#include "ether-addr-util.h"
-#include "hashmap.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 typedef enum SRIOVAttribute {
         SR_IOV_VF_MAC,
index 47cf4df98dedb2d7caa80bc123da5890fd86ed77..74daf1facc83e854219208feca440abe40881fe6 100644 (file)
@@ -3,9 +3,13 @@
 #include <linux/if.h>
 #include <linux/if_arp.h>
 
+#include "sd-device.h"
+#include "sd-id128.h"
+
 #include "alloc-util.h"
 #include "arphrd-util.h"
 #include "device-util.h"
+#include "ether-addr-util.h"
 #include "hexdecoct.h"
 #include "log-link.h"
 #include "memory-util.h"
@@ -13,6 +17,7 @@
 #include "netif-util.h"
 #include "siphash24.h"
 #include "sparse-endian.h"
+#include "string-util.h"
 #include "strv.h"
 
 #define SHORTEN_IFNAME_HASH_KEY SD_ID128_MAKE(e1,90,a4,04,a8,ef,4b,51,8c,cc,c3,3a,9f,11,fc,a2)
index 1fe0de9c30f02a78cebee6a6c2055d0eca8945ed..5b2ba1d11d84ad0c5acec0932e1a2bcac62bb552 100644 (file)
@@ -1,13 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-
-#include "sd-device.h"
-#include "sd-id128.h"
-
-#include "ether-addr-util.h"
+#include "forward.h"
 
 bool netif_has_carrier(uint8_t operstate, unsigned flags);
 int net_get_type_string(sd_device *device, uint16_t iftype, char **ret);
index 0169a6220c8db42726ef3e9e1cc1f15d45e085d7..1bc320af41b0d0e2756694443f47bb10f42b577d 100644 (file)
@@ -1,13 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-event.h"
+
+#include "alloc-util.h"
 #include "async.h"
+#include "constants.h"
+#include "errno-util.h"
 #include "fd-util.h"
+#include "fdset.h"
 #include "log.h"
 #include "notify-recv.h"
+#include "pidref.h"
 #include "process-util.h"
 #include "socket-util.h"
 #include "strv.h"
-#include "user-util.h"
 
 int notify_socket_prepare(
                 sd_event *event,
index 9035ad4872ce1dd7aa6601af3f61a80b4680315e..4306439b6f752aa80372a93f64954e8c16cfcdca 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/socket.h>
-
-#include "sd-event.h"
-
-#include "fdset.h"
-#include "pidref.h"
+#include "forward.h"
 
 int notify_socket_prepare(
                 sd_event *event,
index 17ffb979fe7dbefa44c4b727fe25d8b02b9e3f52..e14aa0981025530ea55eb462d7dba707fc2bd971 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "alloc-util.h"
 #include "extract-word.h"
-#include "log.h"
 #include "namespace-util.h"
 #include "nsflags.h"
 #include "string-util.h"
index 7c6214a3bb4b75b594409ff2ab097d717e3ff8e7..9839d47dc77772dfb4822ad2e9f298f93d948406 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
 #include "missing_sched.h"
 
 /* The combination of all namespace flags defined by the kernel. The right type for this isn't clear. setns() and
index e76f5ab47e5396ef6546ce992fc4ab04fb9ad1c3..e74e5fcc700ed4c9a7c4b399607ecd62a8b07897 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "sd-varlink.h"
 
+#include "alloc-util.h"
 #include "fd-util.h"
 #include "format-util.h"
 #include "json-util.h"
@@ -12,6 +13,7 @@
 #include "namespace-util.h"
 #include "nsresource.h"
 #include "process-util.h"
+#include "string-util.h"
 
 static int make_pid_name(char **ret) {
         char comm[TASK_COMM_LEN];
index 48274fd1a53ca19ed4ceba168c990287c1f7ebb2..55937fd48308eb903e7044e7c1cbea6c366e9c7c 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
+#include "forward.h"
 
 int nsresource_allocate_userns(const char *name, uint64_t size);
 int nsresource_register_userns(const char *name, int userns_fd);
index 8cc315061dea64a67b3ce31ef4703f0258d17607..88f02bc5595be6d09488175d753cc40bc15508df 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <sched.h>
 
 #include "alloc-util.h"
@@ -9,7 +8,6 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "log.h"
-#include "macro.h"
 #include "missing_syscall.h"
 #include "numa-util.h"
 #include "parse-util.h"
index 2f736c9c350fd8a283b638c4d2ca0b4f5cf1ec37..065df9b9a40af193aea21d4fb5fce95231dfdb9a 100644 (file)
@@ -2,6 +2,7 @@
 #pragma once
 
 #include "cpu-set-util.h"
+#include "forward.h"
 #include "missing_syscall.h"
 
 static inline bool mpol_is_valid(int t) {
index a06a78a4a7b1a0728dfcfa54485243a2fa1ae225..7dfce2d97712f000a11a935944f1441323cb826a 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <fcntl.h>
-
 #include "alloc-util.h"
 #include "escape.h"
 #include "extract-word.h"
index d6cab523591ac6959e815638ab021f73d48dad7b..7c1621e6298308467aab2f1c8d07ce6cc401b9f6 100644 (file)
@@ -1,11 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-
+#include "forward.h"
 #include "list.h"
-#include "macro.h"
-#include "memory-util.h"
 
 typedef enum OpenFileFlag {
         OPENFILE_READ_ONLY = 1 << 0,
index 4bbe708757bb3ca94ff18e2534efb2ed8ce4e1a4..656278b52b243029ae21bc5db5b468d90b6016c8 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <endian.h>
-
 #include "alloc-util.h"
 #include "ask-password-api.h"
 #include "fd-util.h"
index a32e19d37d7a3f8bfd31103c95e4be90ca418b5b..8b051435e654f5905d7a54ebff58372713d35ea4 100644 (file)
@@ -2,8 +2,8 @@
 #pragma once
 
 #include "ask-password-api.h"
+#include "forward.h"
 #include "iovec-util.h"
-#include "memory-util.h"
 #include "sha256.h"
 
 typedef enum CertificateSourceType {
@@ -30,26 +30,26 @@ int parse_openssl_key_source_argument(const char *argument, char **private_key_s
 #define X509_FINGERPRINT_SIZE SHA256_DIGEST_SIZE
 
 #if HAVE_OPENSSL
-#  include <openssl/bio.h>
-#  include <openssl/bn.h>
-#  include <openssl/crypto.h>
-#  include <openssl/err.h>
-#  include <openssl/evp.h>
-#  include <openssl/opensslv.h>
-#  include <openssl/pkcs7.h>
-#  include <openssl/ssl.h>
-#  include <openssl/ui.h>
-#  include <openssl/x509v3.h>
+#  include <openssl/bio.h>              /* IWYU pragma: export */
+#  include <openssl/bn.h>               /* IWYU pragma: export */
+#  include <openssl/crypto.h>           /* IWYU pragma: export */
+#  include <openssl/err.h>              /* IWYU pragma: export */
+#  include <openssl/evp.h>              /* IWYU pragma: export */
+#  include <openssl/opensslv.h>         /* IWYU pragma: export */
+#  include <openssl/pkcs7.h>            /* IWYU pragma: export */
+#  include <openssl/ssl.h>              /* IWYU pragma: export */
+#  include <openssl/ui.h>               /* IWYU pragma: export */
+#  include <openssl/x509v3.h>           /* IWYU pragma: export */
 #  ifndef OPENSSL_VERSION_MAJOR
 /* OPENSSL_VERSION_MAJOR macro was added in OpenSSL 3. Thus, if it doesn't exist,  we must be before OpenSSL 3. */
 #    define OPENSSL_VERSION_MAJOR 1
 #  endif
 #  if OPENSSL_VERSION_MAJOR >= 3
-#    include <openssl/core_names.h>
-#    include <openssl/kdf.h>
-#    include <openssl/param_build.h>
-#    include <openssl/provider.h>
-#    include <openssl/store.h>
+#    include <openssl/core_names.h>     /* IWYU pragma: export */
+#    include <openssl/kdf.h>            /* IWYU pragma: export */
+#    include <openssl/param_build.h>    /* IWYU pragma: export */
+#    include <openssl/provider.h>       /* IWYU pragma: export */
+#    include <openssl/store.h>          /* IWYU pragma: export */
 #  endif
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_MACRO(void*, OPENSSL_free, NULL);
index 9d5e875fc3d64a15a28611e446e7e515187d479e..00cdd609e497ed688d8777cb621bee5c64de411b 100644 (file)
@@ -3,6 +3,7 @@
 #include <sys/auxv.h>
 
 #include "escape.h"
+#include "format-util.h"
 #include "hostname-setup.h"
 #include "id128-util.h"
 #include "osc-context.h"
index 6c9882c8944919314ae8319d806c68f94292c977..8f80b2932b5a61c73ec9c6d09b344e4bc2a85812 100644 (file)
@@ -3,8 +3,7 @@
 
 #include "sd-id128.h"
 
-#include "assert-util.h"
-#include "macro.h"
+#include "forward.h"
 
 int osc_context_open_boot(char **ret_seq);
 int osc_context_open_container(const char *name, char **ret_seq, sd_id128_t *ret_context_id);
index c8c6a27a59b6ed9c1cd969893e7b8d808a07dcc8..2aa588d34eb0ed51ed0bafff0fbee6799b8653b5 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-json.h"
+
 #include "output-mode.h"
 #include "string-table.h"
 
index 36dc85c175afb3171059cf911f74d282e9e5a394..ffd2e4fe8098128195d908e1d08c574b92b40bff 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-json.h"
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum OutputMode {
         OUTPUT_SHORT,
index f1043ec13261cd707b45a397d41b67128205b0e0..3797adbb7cc3e17088647cb3509b97ce57ee2ffc 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/prctl.h>
 #include <unistd.h>
 
 #include "sd-login.h"
 #include "io-util.h"
 #include "locale-util.h"
 #include "log.h"
-#include "macro.h"
 #include "pager.h"
 #include "process-util.h"
-#include "rlimit-util.h"
 #include "signal-util.h"
 #include "string-util.h"
 #include "strv.h"
index 9a9d4c53c38b15424bcd8a9e326ae33f3a405870..bbd92a2bbaa728363a511825d73b86ff56681b6b 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "macro.h"
+#include "forward.h"
 
 typedef enum PagerFlags {
         PAGER_DISABLE     = 1 << 0,
index 8cb4b9b1eb113975f56dd820d531e265c9da6d82..a2f2126cbc63c186382cb9f60714ea7845632f94 100644 (file)
@@ -1,16 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <security/pam_ext.h>
-#include <stdlib.h>
 #include <syslog.h>
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-internal.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "format-util.h"
 #include "log.h"
-#include "macro.h"
 #include "pam-util.h"
 #include "process-util.h"
 #include "stdio-util.h"
index 699648d43bdd5f23dd42f8261ba5d6208b65d3d5..f48a170c483758e1a45a3d31a9216287effb6308 100644 (file)
@@ -1,12 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <security/pam_modules.h>
+#include <security/pam_modules.h> /* IWYU pragma: export */
 #include <syslog.h>
 
-#include "sd-bus.h"
-
-#include "macro.h"
+#include "forward.h"
 
 void pam_log_setup(void);
 
index 701802ec0ca6171117dac9abf7a876a01325d5f6..1575962d44afda0b34b73702cd0af8aee2c73580 100644 (file)
@@ -7,7 +7,6 @@
 #include "parse-util.h"
 #include "path-util.h"
 #include "signal-util.h"
-#include "stdio-util.h"
 #include "string-table.h"
 #include "string-util.h"
 
index bd577033b8f3fd1defe559f2c03e999a58308bd0..06c47d904426553e87508c11ca57b9db83607f90 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "sd-json.h"
+#include "forward.h"
 
 int parse_boolean_argument(const char *optname, const char *s, bool *ret);
 int parse_tristate_argument(const char *optname, const char *s, int *ret);
index 29ab60fe9f0346ffc72179f0bd91d4d03b3ced02..c686b9cebbff2a876c7cdcb1e95147487d2f7e67 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdint.h>
+#include "forward.h"
 
 typedef enum PathSimplifyWarnFlags {
         PATH_CHECK_FATAL              = 1 << 0,  /* If not set, then error message is appended with 'ignoring'. */
index 21ffb2c5191ac860eb973d0cc4a1638b6d358723..004203d17e345f3df40ef0bc83c223c2d8530284 100644 (file)
@@ -3,7 +3,6 @@
 #include "dlfcn-util.h"
 #include "errno-util.h"
 #include "log.h"
-#include "macro.h"
 #include "memory-util.h"
 #include "password-quality-util.h"
 #include "strv.h"
index 90a6b3fe895a2ce2b61ef07314e2c7aa2bc2b771..121b75c501953f1669f020142eebf77a37823a2c 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "macro.h"
+#include "forward.h"
 
 #if HAVE_PASSWDQC
 #include <passwdqc.h>
index f4aabd3510b390a6b68f6e4808df13b90b13285d..ac46ac8430e587076781e12fb15562b7270475a6 100644 (file)
@@ -1,13 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdio.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "dlfcn-util.h"
 #include "errno-util.h"
 #include "log.h"
-#include "macro.h"
-#include "memory-util.h"
 #include "password-quality-util.h"
 #include "string-util.h"
 #include "strv.h"
index 68aa8db4824d66160b5fdff36e86312806d50dcf..dbea6d24cad38d7b5edb261a578cb94b1ca05edb 100644 (file)
@@ -1,15 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "macro.h"
+#include "forward.h"
 
 #if HAVE_PWQUALITY
-/* pwquality.h uses size_t but doesn't include sys/types.h on its own */
 #include <pwquality.h>
-#include <sys/types.h>
 
 #include "dlfcn-util.h"
-#include "memory-util.h"
 
 extern DLSYM_PROTOTYPE(pwquality_check);
 extern DLSYM_PROTOTYPE(pwquality_default_settings);
index f838ba73efe56d462b9905a9feb253524db114a8..1f0c2686dc0e73792a407c8d01d416e3114ccb92 100644 (file)
@@ -5,11 +5,11 @@
 
 #if HAVE_PASSWDQC
 
-#include "password-quality-util-passwdqc.h"
+#include "password-quality-util-passwdqc.h" /* IWYU pragma: export */
 
 #elif HAVE_PWQUALITY
 
-#include "password-quality-util-pwquality.h"
+#include "password-quality-util-pwquality.h" /* IWYU pragma: export */
 
 #else
 
index 1c7834b2906130e2de9eacda2ef1f3a548ff9455..7a80ddd9fae3e14ef159986c325c6bfba2189c2e 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "dlfcn-util.h"
+#include "hash-funcs.h"
 #include "log.h"
 #include "pcre2-util.h"
 
index e9ce0b21d8e6967ae91a2178b119532e41a87163..b1c9f24f1420192bcb0ee0fd46cb8f8310348534 100644 (file)
@@ -1,15 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "hash-funcs.h"
-#include "macro.h"
+#include "forward.h"
 
 #if HAVE_PCRE2
 
 #include "dlfcn-util.h"
 
 #define PCRE2_CODE_UNIT_WIDTH 8
-#include <pcre2.h>
+#include <pcre2.h> /* IWYU pragma: export */
 
 extern DLSYM_PROTOTYPE(pcre2_match_data_create);
 extern DLSYM_PROTOTYPE(pcre2_match_data_free);
index dcd9b4ce914b45c6eb3d01634b88894ddb50bdf5..0b8f17174ed87d5bcf7ce9e223300dd960e0baa2 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "sd-device.h"
+#include "sd-id128.h"
 
 #include "alloc-util.h"
 #include "blkid-util.h"
@@ -12,6 +13,7 @@
 #include "log.h"
 #include "mountpoint-util.h"
 #include "pcrextend-util.h"
+#include "string-util.h"
 #include "strv.h"
 
 static int device_get_file_system_word(
index 14200189b23261f45db71353d85dc065066a5952..2daaf7eea9f787f1a353bb6c3b24651da50e95c3 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
-
-#include "macro-fundamental.h"
 #include "openssl-util.h"
 #include "sparse-endian.h"
 #include "uki.h"
index 1104e1e33a2695c16af6365eb531046a5dbb3af4..2c32f6bb20cbb31287e77ac6547c8bb7c4c0be2d 100644 (file)
@@ -1,20 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <fcntl.h>
-
 #include "alloc-util.h"
 #include "ask-password-api.h"
 #include "dlfcn-util.h"
 #include "env-util.h"
 #include "escape.h"
-#include "fd-util.h"
 #include "format-table.h"
-#include "io-util.h"
 #include "log.h"
 #include "memory-util.h"
-#if HAVE_OPENSSL
 #include "openssl-util.h"
-#endif
 #include "pkcs11-util.h"
 #include "random-util.h"
 #include "string-util.h"
@@ -62,33 +56,6 @@ DLSYM_PROTOTYPE(p11_kit_uri_message) = NULL;
 DLSYM_PROTOTYPE(p11_kit_uri_new) = NULL;
 DLSYM_PROTOTYPE(p11_kit_uri_parse) = NULL;
 
-int dlopen_p11kit(void) {
-        ELF_NOTE_DLOPEN("p11-kit",
-                        "Support for PKCS11 hardware tokens",
-                        ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
-                        "libp11-kit.so.0");
-
-        return dlopen_many_sym_or_warn(
-                        &p11kit_dl,
-                        "libp11-kit.so.0", LOG_DEBUG,
-                        DLSYM_ARG(p11_kit_module_get_name),
-                        DLSYM_ARG(p11_kit_modules_finalize_and_release),
-                        DLSYM_ARG(p11_kit_modules_load_and_initialize),
-                        DLSYM_ARG(p11_kit_strerror),
-                        DLSYM_ARG(p11_kit_uri_format),
-                        DLSYM_ARG(p11_kit_uri_free),
-                        DLSYM_ARG(p11_kit_uri_get_attributes),
-                        DLSYM_ARG(p11_kit_uri_get_attribute),
-                        DLSYM_ARG(p11_kit_uri_set_attribute),
-                        DLSYM_ARG(p11_kit_uri_get_module_info),
-                        DLSYM_ARG(p11_kit_uri_get_slot_info),
-                        DLSYM_ARG(p11_kit_uri_get_token_info),
-                        DLSYM_ARG(p11_kit_uri_match_token_info),
-                        DLSYM_ARG(p11_kit_uri_message),
-                        DLSYM_ARG(p11_kit_uri_new),
-                        DLSYM_ARG(p11_kit_uri_parse));
-}
-
 int uri_from_string(const char *p, P11KitUri **ret) {
         _cleanup_(sym_p11_kit_uri_freep) P11KitUri *uri = NULL;
         int r;
@@ -1823,6 +1790,37 @@ static int list_callback(
 }
 #endif
 
+int dlopen_p11kit(void) {
+#if HAVE_P11KIT
+        ELF_NOTE_DLOPEN("p11-kit",
+                        "Support for PKCS11 hardware tokens",
+                        ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
+                        "libp11-kit.so.0");
+
+        return dlopen_many_sym_or_warn(
+                        &p11kit_dl,
+                        "libp11-kit.so.0", LOG_DEBUG,
+                        DLSYM_ARG(p11_kit_module_get_name),
+                        DLSYM_ARG(p11_kit_modules_finalize_and_release),
+                        DLSYM_ARG(p11_kit_modules_load_and_initialize),
+                        DLSYM_ARG(p11_kit_strerror),
+                        DLSYM_ARG(p11_kit_uri_format),
+                        DLSYM_ARG(p11_kit_uri_free),
+                        DLSYM_ARG(p11_kit_uri_get_attributes),
+                        DLSYM_ARG(p11_kit_uri_get_attribute),
+                        DLSYM_ARG(p11_kit_uri_set_attribute),
+                        DLSYM_ARG(p11_kit_uri_get_module_info),
+                        DLSYM_ARG(p11_kit_uri_get_slot_info),
+                        DLSYM_ARG(p11_kit_uri_get_token_info),
+                        DLSYM_ARG(p11_kit_uri_match_token_info),
+                        DLSYM_ARG(p11_kit_uri_message),
+                        DLSYM_ARG(p11_kit_uri_new),
+                        DLSYM_ARG(p11_kit_uri_parse));
+#else
+        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "p11kit support is not compiled in.");
+#endif
+}
+
 int pkcs11_list_tokens(void) {
 #if HAVE_P11KIT
         _cleanup_(table_unrefp) Table *t = NULL;
index c9ba1a507d1b4a65b33727add9454c40870cec26..43203ce6bb20f235f9cd2e8de1cbc8e78c7ec841 100644 (file)
@@ -3,20 +3,16 @@
 
 #if HAVE_OPENSSL
 #  include <openssl/evp.h>
-#  include <openssl/x509.h>
 #endif
-#include <stdbool.h>
 
 #if HAVE_P11KIT
-#  include <p11-kit/p11-kit.h>
-#  include <p11-kit/uri.h>
+#  include <p11-kit/p11-kit.h>  /* IWYU pragma: export */
+#  include <p11-kit/uri.h>      /* IWYU pragma: export */
 #endif
 
 #include "ask-password-api.h"
 #include "dlfcn-util.h"
-#include "log.h"
-#include "memory-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 bool pkcs11_uri_valid(const char *uri);
 
@@ -97,16 +93,10 @@ int pkcs11_crypt_device_callback(
                 P11KitUri *uri,
                 void *userdata);
 
-int dlopen_p11kit(void);
-
-#else
-
-static inline int dlopen_p11kit(void) {
-        return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "p11kit support is not compiled in.");
-}
-
 #endif
 
+int dlopen_p11kit(void);
+
 typedef struct {
         const char *friendly_name;
         usec_t until;
index 72f282f9bd7a996b76b6c77c201d4b8f369ee04a..aaf604afd54e9edadd4e3b2649ac847170461edc 100644 (file)
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "alloc-util.h"
 #include "fd-util.h"
 #include "io-util.h"
 #include "log.h"
index 9949e5dc83e04daac6b0687b275f58f46e1e0f1b..86c9ec6cb851e71e6e2fd6eadf8db06c8f598ca2 100644 (file)
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
-
 #include "errno-util.h"
+#include "forward.h"
 
 int plymouth_connect(int flags);
 int plymouth_send_raw(const void *raw, size_t size, int flags);
index a652b465b9ffa3edaf11e734d11f60ebb4d7e61f..491b494b1e7581b09df20debd5b7c9384e1b21ae 100644 (file)
@@ -1,20 +1,17 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <poll.h>
 #include <signal.h>
-#include <stdlib.h>
 #include <unistd.h>
 
+#include "bus-util.h"
 #include "exec-util.h"
 #include "fd-util.h"
 #include "io-util.h"
 #include "log.h"
-#include "macro.h"
 #include "polkit-agent.h"
 #include "process-util.h"
 #include "stdio-util.h"
-#include "time-util.h"
 
 #if ENABLE_POLKIT
 static pid_t agent_pid = 0;
index 325dfdde466ec6de5470a594f0e10f3bc5414167..3ed13f9ba5fba00d1425c0e79104a92f4a160329 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "bus-util.h"
+#include "forward.h"
 
 int polkit_agent_open(void);
 void polkit_agent_close(void);
index c472c2fea6e5a0990cb703081034f019c757ad87..8ec6e8880b17807a5ec9c8f7c9097b0fdce5dc46 100644 (file)
@@ -2,7 +2,6 @@
 
 #include "alloc-util.h"
 #include "fs-util.h"
-#include "log.h"
 #include "nulstr-util.h"
 #include "portable-util.h"
 #include "string-util.h"
index 2c89fe3eb8cdc9fa525186feca9f8c1ad58f88bc..b19e470452c6a85a97a08cca3a7c385818b9c74b 100644 (file)
@@ -2,7 +2,7 @@
 #pragma once
 
 #include "constants.h"
-#include "macro.h"
+#include "forward.h"
 
 #define PORTABLE_PROFILE_DIRS CONF_PATHS_NULSTR("systemd/portable/profile")
 
index cb13a244ab40ff64309470281651f88e6db1050e..8be99a8d3f4cf6ab5cb19002d952491c18d51f94 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <math.h>
 #include <stdio.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "alloc-util.h"
 #include "color-util.h"
@@ -13,7 +13,6 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "log.h"
-#include "pager.h"
 #include "path-util.h"
 #include "pretty-print.h"
 #include "string-util.h"
index e64eed5a9f12ec689d709ae826b06c4b7531331e..fc0ba5355f801558ffd36e45676b7b6273243668 100644 (file)
@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include <stdio.h>
 #include <string.h>
 
 #include "ansi-color.h"
-#include "assert-util.h"
 #include "fileio.h"
+#include "forward.h"
 #include "glyph-util.h"
-#include "terminal-util.h"
 
 #define CYLON_BUFFER_EXTRA (2*STRLEN(ANSI_RED) + STRLEN(ANSI_HIGHLIGHT_RED) + 2*STRLEN(ANSI_NORMAL))
 
index affa3ba37ca7ced1ee06d698e4ea813af34e58a5..53d3d31131afbf08411c70d356ca95e391ba2bcd 100644 (file)
@@ -1,16 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <limits.h>
 #include <signal.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/epoll.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
 #include <termios.h>
 #include <unistd.h>
 
@@ -24,9 +17,9 @@
 #include "fd-util.h"
 #include "io-util.h"
 #include "log.h"
-#include "macro.h"
 #include "ptyfwd.h"
 #include "stat-util.h"
+#include "string-util.h"
 #include "strv.h"
 #include "terminal-util.h"
 #include "time-util.h"
index 1f1b771a399671abf58fe2a2e1615487403f7a14..e7b5210cc7a7e6ccf43f90e74724495d5cbddba8 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "sd-event.h"
-
-#include "memory-util.h"
+#include "forward.h"
 
 typedef struct PTYForward PTYForward;
 
index ff93a25a97e43552c03413bf81934488a8abe384..5e61e84a9e2b3f3debda12520c7c6503cfd83e8d 100644 (file)
@@ -4,6 +4,7 @@
 
 #if HAVE_QRENCODE
 #include <qrencode.h>
+#include <stdio.h>
 
 #include "ansi-color.h"
 #include "dlfcn-util.h"
index ff73b01ef8187f1e658eba703681588605ffa6e7..7c9bb498931cacb52862cdec9a7d2b10775eaac2 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdio.h>
+#include "forward.h"
 
 #if HAVE_QRENCODE
 int dlopen_qrencode(void);
index a698129adfe8b02c1e556de9048b0f298747845d..a592b2fb0011cdacd583d8a4c5e05a379afd291e 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <stdint.h>
 #include <sys/quota.h>
 #include <sys/stat.h>
 
index ad97eede0172af39ff396cb902270741c8fc601f..5e878a5d398a7913582bfb68595d0bbef148cb6e 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <sys/quota.h>
-#include <sys/types.h>
+#include <sys/quota.h> /* IWYU pragma: export */
+
+#include "forward.h"
 
 /* Wrapper around the QCMD() macro of linux/quota.h that removes some undefined behaviour. A typical quota
  * command such as QCMD(Q_GETQUOTA, USRQUOTA) cannot be resolved on platforms where "int" is 32-bit, as it is
index 20fbff7b5b06e2291ae16a26ba04ca27245f557d..f82c0654dc5f82a4e662e7c6af56010f6a68fc32 100644 (file)
@@ -1,9 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
+#include <linux/reboot.h>
 #include <stdint.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#include <sys/reboot.h>
 #include <unistd.h>
 
 #if HAVE_XENCTRL
index 92189bee881b142af546543e9b0cd6243bfd257a..55419dfb14914ae6b362b81fc4ce526144d89ed9 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 bool reboot_parameter_is_valid(const char *parameter);
 int update_reboot_parameter_and_warn(const char *parameter, bool keep);
index 6c733700765795070e2ebe96520b1a6de3429562..df8c7e8b23ac08f695681df744d52649cb268ce0 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "alloc-util.h"
-#include "memory-util.h"
 #include "random-util.h"
 #include "recovery-key.h"
 
index 68e8051a936b4d2c13b724d56fc96b06a2ae4ddb..ec7090a1c223a027bc493128bc344d4e99aa9e11 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 /* 256 bit keys = 32 bytes */
 #define RECOVERY_KEY_MODHEX_RAW_LENGTH 32
 
index 0f28869ea06acae4b77741e06529b09f3dda4fe7..481c2de1e5d9fc9fcf63aba4eb950e7fec25e68d 100644 (file)
@@ -5,14 +5,13 @@
 #include <sys/ioctl.h>
 #include <sys/vfs.h>
 
-#include "blockdev-util.h"
-#include "fs-util.h"
-#include "log.h"
 #include "missing_fs.h"
 #include "missing_magic.h"
 #include "missing_xfs.h"
 #include "resize-fs.h"
 #include "stat-util.h"
+#include "stdio-util.h"
+#include "string-util-fundamental.h"
 
 int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
         struct statfs sfs;
index bacaec748d105ddf0623b1d2ba17279ca8d75baa..8cfda5669635646bfa08dfcdfb55e3b79733b742 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-
+#include "forward.h"
 #include "stat-util.h"
 
 int resize_fs(int fd, uint64_t sz, uint64_t *ret_size);
index e01578fbcb030813810ef7705d9f89ea3c78899e..26df7ba7dfb81a21d6b4e879737caebdf0dd916a 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "conf-parser.h"
+#include "in-addr-util.h"
 #include "resolve-util.h"
 #include "string-table.h"
 
index 2d210f9af755c27b94a0d420dd02181c147b015c..a8f7fd41efd148227a2c7b965d9fb1719d9e72a8 100644 (file)
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "conf-parser.h"
-#include "in-addr-util.h"
-#include "macro.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 /* 127.0.0.53 in native endian (The IP address we listen on with the full DNS stub, i.e. that does LLMNR/mDNS, and stuff) */
 #define INADDR_DNS_STUB ((in_addr_t) 0x7f000035U)
 /* 127.0.0.2 is an address we always map to the local hostname. This is different from 127.0.0.1 which maps to "localhost" */
 #define INADDR_LOCALADDRESS ((in_addr_t) 0x7f000002U)
 
-typedef enum DnsCacheMode DnsCacheMode;
-
-enum DnsCacheMode {
+typedef enum DnsCacheMode {
         DNS_CACHE_MODE_NO,
         DNS_CACHE_MODE_YES,
         DNS_CACHE_MODE_NO_NEGATIVE,
         _DNS_CACHE_MODE_MAX,
         _DNS_CACHE_MODE_INVALID = -EINVAL,
-};
-
-typedef enum ResolveSupport ResolveSupport;
-typedef enum DnssecMode DnssecMode;
-typedef enum DnsOverTlsMode DnsOverTlsMode;
+} DnsCacheMode;
 
 /* Do not change the order, see link_get_llmnr_support() or link_get_mdns_support(). */
-enum ResolveSupport {
+typedef enum ResolveSupport {
         RESOLVE_SUPPORT_NO,
         RESOLVE_SUPPORT_RESOLVE,
         RESOLVE_SUPPORT_YES,
         _RESOLVE_SUPPORT_MAX,
         _RESOLVE_SUPPORT_INVALID = -EINVAL,
-};
+} ResolveSupport;
 
-enum DnssecMode {
+typedef enum DnssecMode {
         /* No DNSSEC validation is done */
         DNSSEC_NO,
 
@@ -53,9 +46,9 @@ enum DnssecMode {
 
         _DNSSEC_MODE_MAX,
         _DNSSEC_MODE_INVALID = -EINVAL,
-};
+} DnssecMode;
 
-enum DnsOverTlsMode {
+typedef enum DnsOverTlsMode {
         /* No connection is made for DNS-over-TLS */
         DNS_OVER_TLS_NO,
 
@@ -68,7 +61,7 @@ enum DnsOverTlsMode {
 
         _DNS_OVER_TLS_MODE_MAX,
         _DNS_OVER_TLS_MODE_INVALID = -EINVAL,
-};
+} DnsOverTlsMode;
 
 CONFIG_PARSER_PROTOTYPE(config_parse_resolve_support);
 CONFIG_PARSER_PROTOTYPE(config_parse_dnssec_mode);
index 08c76a384ea40445508201f3a6c680199e01b176..71466c8574e57355960b79bcfe3fc24be8e7d5b3 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stdbool.h>
-#include <stddef.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
@@ -13,7 +10,6 @@
 #include "fd-util.h"
 #include "fs-util.h"
 #include "log.h"
-#include "macro.h"
 #include "missing_magic.h"
 #include "mountpoint-util.h"
 #include "path-util.h"
index a965df5f8e3e2254afc82a9b31f5c61ddfb0da78..abad164e21c5fb4352637186563dd23c1538fd24 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include "memory-util.h"
+#include "forward.h"
 
 typedef enum RemoveFlags {
         REMOVE_ONLY_DIRECTORIES = 1 << 0, /* Only remove empty directories, no files */
index 07a59830545beb50011bca16de6d843f077bf3c3..571a91bbfa40da607806b2bb9a27fcc17f73f20e 100644 (file)
@@ -1,35 +1,30 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <linux/seccomp.h>
-#include <stddef.h>
+#include <sched.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
 #include <sys/shm.h>
 #include <sys/stat.h>
 
-/* clang-format off */
-/* include missing_syscall_def.h earlier to make __SNR_foo mapped to __NR_foo. */
-#include "missing_syscall_def.h"
-#include <seccomp.h>
-/* clang-format on */
-
 #include "af-list.h"
 #include "alloc-util.h"
 #include "env-util.h"
 #include "errno-list.h"
 #include "log.h"
-#include "macro.h"
 #include "namespace-util.h"
 #include "nsflags.h"
 #include "nulstr-util.h"
+#include "parse-util.h"
 #include "process-util.h"
 #include "seccomp-util.h"
 #include "set.h"
 #include "string-util.h"
 #include "strv.h"
 
+#if HAVE_SECCOMP
+
 /* This array will be modified at runtime as seccomp_restrict_archs is called. */
 uint32_t seccomp_local_archs[] = {
 
@@ -2525,3 +2520,21 @@ int seccomp_suppress_sync(void) {
 
         return 0;
 }
+
+#endif
+
+bool seccomp_errno_or_action_is_valid(int n) {
+        return n == SECCOMP_ERROR_NUMBER_KILL || errno_is_valid(n);
+}
+
+int seccomp_parse_errno_or_action(const char *p) {
+        if (streq_ptr(p, "kill"))
+                return SECCOMP_ERROR_NUMBER_KILL;
+        return parse_errno(p);
+}
+
+const char* seccomp_errno_or_action_to_string(int num) {
+        if (num == SECCOMP_ERROR_NUMBER_KILL)
+                return "kill";
+        return errno_to_name(num);
+}
index 64deb5fd5dd12fec9e0deb32cbe7eb63ad1185da..bd8f1a18770c1ade740aa31ab97703e22e491cd3 100644 (file)
@@ -2,16 +2,11 @@
 #pragma once
 
 #if HAVE_SECCOMP
-#include <seccomp.h>
+#include <seccomp.h> /* IWYU pragma: export */
 #endif
-#include <stdbool.h>
-#include <stdint.h>
 
-#include "errno-list.h"
 #include "errno-util.h"
-#include "parse-util.h"
-#include "set.h"
-#include "string-util.h"
+#include "forward.h"
 
 #if HAVE_SECCOMP
 
@@ -164,18 +159,8 @@ enum {
         SECCOMP_ERROR_NUMBER_KILL = INT_MAX - 1,
 };
 
-static inline bool seccomp_errno_or_action_is_valid(int n) {
-        return n == SECCOMP_ERROR_NUMBER_KILL || errno_is_valid(n);
-}
+bool seccomp_errno_or_action_is_valid(int n);
 
-static inline int seccomp_parse_errno_or_action(const char *p) {
-        if (streq_ptr(p, "kill"))
-                return SECCOMP_ERROR_NUMBER_KILL;
-        return parse_errno(p);
-}
+int seccomp_parse_errno_or_action(const char *p);
 
-static inline const char* seccomp_errno_or_action_to_string(int num) {
-        if (num == SECCOMP_ERROR_NUMBER_KILL)
-                return "kill";
-        return errno_to_name(num);
-}
+const char* seccomp_errno_or_action_to_string(int num);
index c867807bec7cb85d94d3270443bc54889b48b9f0..92c7415337e8a023055601d27f9a752a68038fb7 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <stdio.h>
 
 #include "alloc-util.h"
index ee25c9330cb911b1246d0c12fb2fffd81e73b62a..19b836b4e7b5a8f97785c83f21fd192f886758f0 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
 #include <linux/securebits.h>
-#include <stdbool.h>
+
+#include "forward.h"
 
 int secure_bits_to_string_alloc(int i, char **s);
 int secure_bits_from_string(const char *s);
index c0c0e332e25a7c3c0b49cc60460c8dc970af33ed..6a4f502fc21a6d6bc0010788985c38219b40f8c8 100644 (file)
@@ -1,12 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <stddef.h>
 #include <string.h>
+#include <sys/socket.h>
 #include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
 #include <sys/un.h>
 #include <syslog.h>
 
 #include "errno-util.h"
 #include "fd-util.h"
 #include "label.h"
+#include "label-util.h"
 #include "log.h"
-#include "macro.h"
 #include "mallinfo-util.h"
 #include "path-util.h"
 #include "selinux-util.h"
-#include "stdio-util.h"
 #include "string-util.h"
 #include "time-util.h"
 
index 979c3f5be9a4ea602a31a197c075a21316a0fd89..9c5707f9fad07d4fcd4b58e04bc716b151d0754b 100644 (file)
@@ -1,19 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <stdbool.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include "assert-util.h"
-#include "label-util.h"
-#include "macro.h"
+#include "forward.h"
 
 #if HAVE_SELINUX
-#include <selinux/selinux.h>
-
-#include "memory-util.h"
+#include <selinux/selinux.h> /* IWYU pragma: export */
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon, NULL);
 #else
index 2f5802ee668903419b49b3c059ca0673021c3131..4d0be059bd1fad58af47ae1daa2b44ac6fabc9b6 100644 (file)
@@ -2,19 +2,29 @@
 
 #include <fcntl.h>
 
+#include "sd-id128.h"
+
 #include "alloc-util.h"
 #include "env-util.h"
 #include "escape.h"
+#include "extract-word.h"
 #include "fd-util.h"
+#include "fdset.h"
 #include "fileio.h"
+#include "format-util.h"
 #include "hexdecoct.h"
+#include "image-policy.h"
+#include "log.h"
 #include "memfd-util.h"
 #include "missing_mman.h"
-#include "missing_syscall.h"
 #include "parse-util.h"
-#include "process-util.h"
+#include "pidref.h"
+#include "ratelimit.h"
 #include "serialize.h"
+#include "set.h"
+#include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 
 int serialize_item(FILE *f, const char *key, const char *value) {
         assert(f);
index e9fe3c276c0e947b65e086b755e8660e5d8f4466..45bd710d7319582290c9f6806e141ae55a46c8dd 100644 (file)
@@ -1,18 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdio.h>
-
-#include "sd-id128.h"
-
-#include "fdset.h"
-#include "image-policy.h"
-#include "macro.h"
-#include "pidref.h"
-#include "ratelimit.h"
-#include "set.h"
-#include "string-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 int serialize_item(FILE *f, const char *key, const char *value);
 int serialize_item_escaped(FILE *f, const char *key, const char *value);
index 81d004d00300b36c0fda332c1226b0657d43baa0..2645fe2c40bc487114d94d988e5a44096cf25622 100644 (file)
@@ -5,10 +5,10 @@
 
 #include "alloc-util.h"
 #include "build.h"
+#include "bus-object.h"
 #include "log.h"
 #include "pretty-print.h"
 #include "service-util.h"
-#include "terminal-util.h"
 
 static int help(const char *program_path, const char *service, const char *description, bool bus_introspect) {
         _cleanup_free_ char *link = NULL;
index 360341fb2f4e535a5d09741e28bf8995d72f30a1..af36354e80e22bce7177d44125a0b8033316e3e1 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "bus-object.h"
+#include "forward.h"
 
 int service_parse_argv(
                 const char *service,
index 96f22cdf50249cb89d266f7c82b81647771b8823..1b1af554844d61dc00c30c2ddb9cb11f0df8a6a0 100644 (file)
@@ -1,16 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <sys/statvfs.h>
+#include <unistd.h>
 
 #include "acl-util.h"
 #include "alloc-util.h"
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "fs-util.h"
 #include "log.h"
 #include "missing_magic.h"
 #include "shift-uid.h"
 #include "stat-util.h"
+#include "string-util.h"
 #include "user-util.h"
 
 /* While we are chmod()ing a directory tree, we set the top-level UID base to this "busy" base, so that we can always
index 5c7349bc733c4db31380b75246cb2f8c4a8310f4..59435c748d20bd0198e429644872bccf7a83178e 100644 (file)
@@ -2,6 +2,6 @@
 
 #pragma once
 
-#include <sys/types.h>
+#include "forward.h"
 
 int path_patch_uid(const char *path, uid_t shift, uid_t range);
index 53f90aae273aac9b8f7d9c2063375a9b79557452..9a6e258bd8b739a729957448947102171f3bc34b 100644 (file)
@@ -4,20 +4,11 @@
 
 #include "alloc-util.h"
 #include "conf-parser.h"
-#include "constants.h"
-#include "device-util.h"
-#include "devnum-util.h"
-#include "errno-util.h"
 #include "extract-word.h"
-#include "fd-util.h"
 #include "fileio.h"
 #include "hibernate-util.h"
 #include "log.h"
-#include "macro.h"
-#include "path-util.h"
 #include "sleep-config.h"
-#include "stat-util.h"
-#include "stdio-util.h"
 #include "string-table.h"
 #include "string-util.h"
 #include "strv.h"
@@ -190,6 +181,18 @@ int parse_sleep_config(SleepConfig **ret) {
         return 0;
 }
 
+bool SLEEP_NEEDS_MEM_SLEEP(const SleepConfig *sc, SleepOperation operation) {
+        assert(sc);
+        assert(operation >= 0 && operation < _SLEEP_OPERATION_CONFIG_MAX);
+
+        /* As per https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation,
+        * /sys/power/mem_sleep is honored if /sys/power/state is set to "mem" (common for suspend)
+        * or /sys/power/disk is set to "suspend" (hybrid-sleep). */
+
+        return strv_contains(sc->states[operation], "mem") ||
+               strv_contains(sc->modes[operation], "suspend");
+}
+
 int sleep_state_supported(char * const *states) {
         _cleanup_free_ char *supported_sysfs = NULL;
         const char *found;
index b05efaea95ee2ba8851f6272150b3aa2f4f32294..07d9848db2c5d8e8417bbd1651dbebb7ea44872e 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "strv.h"
-#include "time-util.h"
+#include "forward.h"
 
 typedef enum SleepOperation {
         SLEEP_SUSPEND,
@@ -42,17 +41,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, sleep_config_free);
 
 int parse_sleep_config(SleepConfig **sleep_config);
 
-static inline bool SLEEP_NEEDS_MEM_SLEEP(const SleepConfig *sc, SleepOperation operation) {
-        assert(sc);
-        assert(operation >= 0 && operation < _SLEEP_OPERATION_CONFIG_MAX);
-
-        /* As per https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation,
-         * /sys/power/mem_sleep is honored if /sys/power/state is set to "mem" (common for suspend)
-         * or /sys/power/disk is set to "suspend" (hybrid-sleep). */
-
-        return strv_contains(sc->states[operation], "mem") ||
-               strv_contains(sc->modes[operation], "suspend");
-}
+bool SLEEP_NEEDS_MEM_SLEEP(const SleepConfig *sc, SleepOperation operation);
 
 typedef enum SleepSupport {
         SLEEP_SUPPORTED,
index 961bc1e0d62d50b587b1dcdf95dfe063d3f1139c..653e73fb94f266908e24e591c3c158e155ed36e7 100644 (file)
@@ -5,10 +5,8 @@
   Author: Auke Kok <auke-jan.h.kok@intel.com>
 ***/
 
-#include <errno.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/xattr.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "label.h"
+#include "label-util.h"
 #include "log.h"
-#include "macro.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "smack-util.h"
-#include "stdio-util.h"
 #include "string-table.h"
 #include "xattr-util.h"
 
-#if ENABLE_SMACK
-
 #define SMACK_FLOOR_LABEL "_"
 #define SMACK_STAR_LABEL  "*"
 
 bool mac_smack_use(void) {
+#if ENABLE_SMACK
         static int cached_use = -1;
 
         if (cached_use < 0)
                 cached_use = access("/sys/fs/smackfs/", F_OK) >= 0;
 
         return cached_use;
+#else
+        return false;
+#endif
 }
 
+#if ENABLE_SMACK
+
 static const char* const smack_attr_table[_SMACK_ATTR_MAX] = {
         [SMACK_ATTR_ACCESS]     = "security.SMACK64",
         [SMACK_ATTR_EXEC]       = "security.SMACK64EXEC",
@@ -50,7 +51,10 @@ static const char* const smack_attr_table[_SMACK_ATTR_MAX] = {
 
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(smack_attr, SmackAttr);
 
+#endif
+
 int mac_smack_read_at(int fd, const char *path, SmackAttr attr, char **ret) {
+#if ENABLE_SMACK
         assert(fd >= 0 || fd == AT_FDCWD);
         assert(attr >= 0 && attr < _SMACK_ATTR_MAX);
         assert(ret);
@@ -61,9 +65,13 @@ int mac_smack_read_at(int fd, const char *path, SmackAttr attr, char **ret) {
         }
 
         return getxattr_at_malloc(fd, path, smack_attr_to_string(attr), /* at_flags = */ 0, ret, /* ret_size= */ NULL);
+#else
+return -EOPNOTSUPP;
+#endif
 }
 
 int mac_smack_apply_at(int fd, const char *path, SmackAttr attr, const char *label) {
+#if ENABLE_SMACK
         assert(fd >= 0 || fd == AT_FDCWD);
         assert(attr >= 0 && attr < _SMACK_ATTR_MAX);
 
@@ -74,9 +82,13 @@ int mac_smack_apply_at(int fd, const char *path, SmackAttr attr, const char *lab
                 return xremovexattr(fd, path, /* at_flags = */ 0, smack_attr_to_string(attr));
 
         return xsetxattr(fd, path, /* at_flags = */ 0, smack_attr_to_string(attr), label);
+#else
+        return 0;
+#endif
 }
 
 int mac_smack_apply_pid(pid_t pid, const char *label) {
+#if ENABLE_SMACK
         const char *p;
 
         assert(pid >= 0);
@@ -87,8 +99,13 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
 
         p = procfs_file_alloca(pid, "attr/current");
         return write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
+#else
+        return 0;
+#endif
 }
 
+#if ENABLE_SMACK
+
 static int smack_fix_fd(
                 int fd,
                 const char *label_path,
@@ -146,12 +163,15 @@ static int smack_fix_fd(
         return 0;
 }
 
+#endif
+
 int mac_smack_fix_full(
                 int atfd,
                 const char *inode_path,
                 const char *label_path,
                 LabelFixFlags flags) {
 
+#if ENABLE_SMACK
         _cleanup_close_ int opened_fd = -EBADF;
         _cleanup_free_ char *p = NULL;
         int r, inode_fd;
@@ -186,8 +206,14 @@ int mac_smack_fix_full(
         }
 
         return smack_fix_fd(inode_fd, label_path, flags);
-}
+#else
+        return 0;
 #endif
+}
+
+int mac_smack_fix(const char *path, LabelFixFlags flags) {
+        return mac_smack_fix_full(AT_FDCWD, path, path, flags);
+}
 
 int renameat_and_apply_smack_floor_label(int fdf, const char *from, int fdt, const char *to) {
 
index 5bd2cea38bc52ebec6e4e6cac508eb9ae5f3ebca..b778889842656eb255d55bc373df65d8efa157af 100644 (file)
@@ -7,12 +7,7 @@
   Author: Auke Kok <auke-jan.h.kok@intel.com>
 ***/
 
-#include <errno.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "label-util.h"
-#include "macro.h"
+#include "forward.h"
 
 typedef enum SmackAttr {
         SMACK_ATTR_ACCESS,
@@ -25,7 +20,6 @@ typedef enum SmackAttr {
         _SMACK_ATTR_INVALID = -EINVAL,
 } SmackAttr;
 
-#if ENABLE_SMACK
 bool mac_smack_use(void);
 
 int mac_smack_read_at(int fd, const char *path, SmackAttr attr, char **ret);
@@ -34,27 +28,6 @@ int mac_smack_apply_at(int fd, const char *path, SmackAttr attr, const char *lab
 int mac_smack_apply_pid(pid_t pid, const char *label);
 
 int mac_smack_fix_full(int atfd, const char *inode_path, const char *label_path, LabelFixFlags flags);
-#else
-static inline bool mac_smack_use(void) {
-        return false;
-}
-
-static inline int mac_smack_read_at(int fd, const char *path, SmackAttr attr, char **ret) {
-        return -EOPNOTSUPP;
-}
-
-static inline int mac_smack_apply_at(int fd, const char *path, SmackAttr attr, const char *label) {
-        return 0;
-}
-
-static inline int mac_smack_apply_pid(pid_t pid, const char *label) {
-        return 0;
-}
-
-static inline int mac_smack_fix_full(int atfd, const char *inode_path, const char *label_path, LabelFixFlags flags) {
-        return 0;
-}
-#endif
 
 int mac_smack_init(void);
 
@@ -72,9 +45,7 @@ static inline int mac_smack_apply_fd(int fd, SmackAttr attr, const char *label)
         return mac_smack_apply_at(fd, NULL, attr, label);
 }
 
-static inline int mac_smack_fix(const char *path, LabelFixFlags flags) {
-        return mac_smack_fix_full(AT_FDCWD, path, path, flags);
-}
+int mac_smack_fix(const char *path, LabelFixFlags flags);
 
 int renameat_and_apply_smack_floor_label(int fdf, const char *from, int fdt, const char *to);
 static inline int rename_and_apply_smack_floor_label(const char *from, const char *to) {
index bd095992e9b0cd2ad30b8230e71d6021a066dd17..1c6968d21fcbf32fb0c72106c32bdbf8c9d33082 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdio.h>
+
 #include "alloc-util.h"
-#include "assert-util.h"
 #include "fileio.h"
-#include "macro.h"
 #include "smbios11.h"
 #include "virt.h"
 
index ca8fe452605f87b38ec68e2fc6f62c24065c61a0..1d097c0af43f8ef197c79bf8fa8f2f243db64435 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/types.h>
+#include "forward.h"
 
 int read_smbios11_field(unsigned i, size_t max_size, char **ret_data, size_t *ret_size);
index b86a6adbb96ed1881ac250ea82c0c8209eddeef6..0e41f2674e10b06b3119f272340bb76742a6230d 100644 (file)
@@ -1,19 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <netinet/in.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <string.h>
-#include <sys/un.h>
 #include <unistd.h>
 
-#include "alloc-util.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
 #include "log.h"
-#include "macro.h"
-#include "missing_socket.h"
 #include "mkdir-label.h"
 #include "selinux-util.h"
 #include "socket-util.h"
index a810e1c1f3dd1fa6354cbecd37f9619854e57018..79184bba3dd633f370c4efe5edff61015d67b1f3 100644 (file)
@@ -1,21 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <arpa/inet.h>
-#include <errno.h>
 #include <linux/net_namespace.h>
 #include <linux/unix_diag.h>
-#include <net/if.h>
 #include <string.h>
 #include <sys/stat.h>
 
 #include "sd-netlink.h"
 
 #include "alloc-util.h"
-#include "errno-util.h"
 #include "extract-word.h"
 #include "fd-util.h"
 #include "log.h"
-#include "memory-util.h"
 #include "namespace-util.h"
 #include "netlink-sock-diag.h"
 #include "netlink-util.h"
index 88b9c7688bfa4b2c98eeef7ad64d3b91c9d2344e..c9b71d5100ba939158a3be5d8028073463323039 100644 (file)
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
 #include "in-addr-util.h"
-#include "macro.h"
-#include "socket-util.h"
 
 int make_socket_fd(int log_level, const char* address, int type, int flags);
 
index 950b848d40c0c3d5405ef5e3bf2b54cf7ca5d943..62b036a74ef6c5b9763980748592f62ceed51777 100644 (file)
@@ -1,26 +1,21 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 #include "sd-id128.h"
 
 #include "alloc-util.h"
 #include "architecture.h"
 #include "chase.h"
-#include "fd-util.h"
 #include "format-util.h"
 #include "fs-util.h"
 #include "hostname-setup.h"
 #include "hostname-util.h"
 #include "id128-util.h"
-#include "macro.h"
 #include "os-util.h"
-#include "path-lookup.h"
 #include "path-util.h"
+#include "runtime-scope.h"
 #include "specifier.h"
 #include "string-util.h"
 #include "strv.h"
@@ -428,6 +423,10 @@ int specifier_var_tmp_dir(char specifier, const void *data, const char *root, co
         return strdup_to(ret, p);
 }
 
+char* specifier_escape(const char *string) {
+        return strreplace(string, "%", "%%");
+}
+
 int specifier_escape_strv(char **l, char ***ret) {
         _cleanup_strv_free_ char **z = NULL;
         char **p, **q;
index df72bdc39b120fff0e13716fbba156051ac8f521..3b9d43cd85dd0e7615ed0517851519e62babd844 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "string-util.h"
+#include "forward.h"
 
 typedef int (*SpecifierCallback)(char specifier, const void *data, const char *root, const void *userdata, char **ret);
 
@@ -98,9 +98,7 @@ int specifier_var_tmp_dir(char specifier, const void *data, const char *root, co
         { 'T', specifier_tmp_dir,          NULL }, \
         { 'V', specifier_var_tmp_dir,      NULL }
 
-static inline char* specifier_escape(const char *string) {
-        return strreplace(string, "%", "%%");
-}
+char* specifier_escape(const char *string);
 
 int specifier_escape_strv(char **l, char ***ret);
 
index 9e55141eedccde12675310a8a62abc8230b2d7b7..288280c3d19cdb08f8b3b18cb74eb8c9deb47c91 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
-#include <limits.h>
-#include <stdbool.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include "alloc-util.h"
 #include "base-filesystem.h"
 #include "chase.h"
-#include "creds-util.h"
+#include "errno-util.h"
 #include "fd-util.h"
-#include "initrd-util.h"
 #include "log.h"
 #include "missing_syscall.h"
 #include "mkdir-label.h"
 #include "mount-util.h"
 #include "mountpoint-util.h"
-#include "path-util.h"
 #include "rm-rf.h"
-#include "stdio-util.h"
-#include "string-util.h"
-#include "strv.h"
+#include "stat-util.h"
 #include "switch-root.h"
-#include "user-util.h"
 
 int switch_root(const char *new_root,
                 const char *old_root_after,   /* path below the new root, where to place the old root after the transition; may be NULL to unmount it */
index ba0d280eba4ec9f28e926a7e04f0038ba5d29e37..2b8e143251d705065ac55dfb1c69b6554dd82103 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 typedef enum SwitchRootFlags {
         SWITCH_ROOT_DESTROY_OLD_ROOT      = 1 << 0, /* rm -rf old root when switching â€“ under the condition
index bf8c91343784a7810e9840f276a49e45c17e2fd5..41b719ccce5aa4f8000319dc9f5b4d723e1a060a 100644 (file)
@@ -1,12 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "forward.h"
 #include "string-util.h"
 
 #define _test_table(type, name, lookup, reverse, size, sparse)          \
index 66e1ae88cd64b4d222b1ad9ba65cf33f7b262ebd..bc80d153ac752fead09dba12304f2a84c3f0981b 100644 (file)
@@ -1,15 +1,16 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <sched.h>
-#include <signal.h>
 #include <stdlib.h>
 #include <sys/mman.h>
-#include <sys/mount.h>
+#include <sys/prctl.h>
 #include <sys/wait.h>
 
 #include "sd-bus.h"
+#include "sd-daemon.h"
 
 #include "alloc-util.h"
+#include "argv-util.h"
 #include "bus-error.h"
 #include "bus-locator.h"
 #include "bus-util.h"
 #include "cgroup-util.h"
 #include "env-file.h"
 #include "env-util.h"
+#include "errno-util.h"
+#include "extract-word.h"
 #include "fd-util.h"
 #include "fs-util.h"
 #include "hexdecoct.h"
 #include "log.h"
-#include "mountpoint-util.h"
 #include "namespace-util.h"
 #include "path-util.h"
 #include "process-util.h"
 #include "random-util.h"
+#include "rlimit-util.h"
 #include "strv.h"
 #include "tests.h"
 #include "tmpfile-util.h"
index f339e25aef04d45123fa64af39b49b99644a82d7..33acbb7cdf1ce91a900c25b2de9efcd9e8f42977 100644 (file)
@@ -1,24 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-
-#include "sd-daemon.h"
-
-#include "argv-util.h"
 #include "errno-util.h"
-#include "extract-word.h"
 #include "forward.h"
 #include "log.h"
-#include "macro.h"
-#include "process-util.h"
-#include "rlimit-util.h"
-#include "signal-util.h"
 #include "static-destruct.h"
+#include "signal-util.h"
 #include "stdio-util.h"
-#include "strv.h"
+#include "string-util.h"
 
 static inline void log_set_assert_return_is_criticalp(bool *p) {
         log_set_assert_return_is_critical(*p);
index 68ab0755a97a89a6f09a78b9f1c74351ac61dfa3..4189b2868152f3f94f181cf7efc1fed494bee994 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <fcntl.h>
-#include <stdio.h>
+#include "forward.h"
 
 /* These functions are split out of tmpfile-util.h (and not for example just flags to the functions they
  * wrap) in order to optimize linking: this way, -lselinux is needed only for the callers of these functions
index a6ee7d4b26b8a1193439d680f4c9fcb6f69303ce..d5c0fe8e66a15172a501fa01bf8a10275a44c14f 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 bool mac_tomoyo_use(void);
index a33448fb85871f6871c06afe6241f2d6a7b831a6..76890fe1585e4da87a598f249447da68724fdc9f 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <uchar.h>
-
+#include "forward.h"
 #include "tpm2-util.h"
 
 /* Definitions as per "TCG PC Client Specific Platform Firmware Profile Specification"
index d400d562eb491e3acd882d849c7aa8000e2cae28..18d280151570c25fcf22ac5a3b29485e60136483 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <sys/file.h>
+#include <unistd.h>
 
 #include "alloc-util.h"
 #include "ansi-color.h"
 #include "initrd-util.h"
 #include "io-util.h"
 #include "json-util.h"
-#include "lock-util.h"
 #include "log.h"
 #include "logarithm.h"
 #include "memory-util.h"
 #include "mkdir.h"
-#include "nulstr-util.h"
-#include "parse-util.h"
+#include "ordered-set.h"
 #include "random-util.h"
 #include "recurse-dir.h"
-#include "sha256.h"
+#include "siphash24.h"
 #include "sort-util.h"
 #include "sparse-endian.h"
 #include "stat-util.h"
 #include "string-table.h"
+#include "string-util.h"
+#include "strv.h"
 #include "sync-util.h"
 #include "time-util.h"
+#include "tpm2-pcr.h"
 #include "tpm2-util.h"
-#include "user-util.h"
 #include "virt.h"
 
 #if HAVE_OPENSSL
index c9b0c43ae5a9dd0debc0831456b62598fb2f3ad8..a428ee04a0abe5bf7e4505328ce24634f3d717d0 100644 (file)
@@ -1,17 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "sd-json.h"
-
 #include "bitfield.h"
-#include "io-util.h"
-#include "macro.h"
+#include "forward.h"
 #include "openssl-util.h"
-#include "ordered-set.h"
-#include "sha256.h"
-#include "tpm2-pcr.h"
 
 typedef enum TPM2Flags {
         TPM2_FLAGS_USE_PIN     = 1 << 0,
@@ -49,9 +41,9 @@ static inline bool TPM2_PCR_MASK_VALID(uint32_t pcr_mask) {
 
 #if HAVE_TPM2
 
-#include <tss2/tss2_esys.h>
-#include <tss2/tss2_mu.h>
-#include <tss2/tss2_rc.h>
+#include <tss2/tss2_esys.h>     /* IWYU pragma: export */
+#include <tss2/tss2_mu.h>       /* IWYU pragma: export */
+#include <tss2/tss2_rc.h>       /* IWYU pragma: export */
 
 int dlopen_tpm2(void);
 
index 6b931a60d8302a79ae935846a75b812850e7c287..c63b956deaf3445cfe448e1714e40a9705f2d6ba 100644 (file)
@@ -1,22 +1,20 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <ctype.h>
-#include <errno.h>
+#include <time.h>
 #include <unistd.h>
 
+#include "sd-event.h"
+#include "sd-id128.h"
+
 #include "alloc-util.h"
 #include "device-nodes.h"
 #include "device-private.h"
 #include "device-util.h"
-#include "env-file.h"
 #include "errno-util.h"
-#include "fd-util.h"
-#include "id128-util.h"
+#include "hashmap.h"
 #include "log.h"
-#include "macro.h"
-#include "parse-util.h"
 #include "path-util.h"
-#include "signal-util.h"
 #include "stat-util.h"
 #include "string-util.h"
 #include "strv.h"
index c21c4c158caa7c3d08dea13ce0bab0a1c1517a3a..95992f6345c6a1cd4f7d964ddbf3ee49150c55a8 100644 (file)
@@ -1,11 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "sd-device.h"
-
 #include "conf-parser.h"
-#include "hashmap.h"
-#include "time-util.h"
+#include "forward.h"
 
 int udev_parse_config_full(const ConfigTableItem config_table[]);
 int udev_parse_config(void);
index c0f695b9bb4fd50c8e84a159d49b1eaa6d8391cb..2833b5be68c45b0e7f0c0e0a2d5ec67e0e1490b0 100644 (file)
@@ -7,16 +7,19 @@
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "fs-util.h"
+#include "glyph-util.h"
 #include "initrd-util.h"
 #include "log.h"
-#include "macro.h"
 #include "path-lookup.h"
 #include "set.h"
+#include "siphash24.h"
 #include "special.h"
 #include "stat-util.h"
 #include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 #include "unit-file.h"
+#include "unit-name.h"
 
 int unit_symlink_name_compatible(const char *symlink, const char *target, bool instance_propagation) {
         _cleanup_free_ char *template = NULL;
index dd7dc57d15e0a4419ade55e6e4d5a150d78ddac6..bfb6b740cc93786375ddc312ab33196352158b54 100644 (file)
@@ -1,16 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
+#include "unit-def.h"
 
-#include "hashmap.h"
-#include "path-lookup.h"
-#include "time-util.h"
-#include "unit-name.h"
-
-typedef enum UnitFileState UnitFileState;
-
-enum UnitFileState {
+typedef enum UnitFileState {
         UNIT_FILE_ENABLED,
         UNIT_FILE_ENABLED_RUNTIME,
         UNIT_FILE_LINKED,
@@ -26,7 +20,7 @@ enum UnitFileState {
         UNIT_FILE_BAD,
         _UNIT_FILE_STATE_MAX,
         _UNIT_FILE_STATE_INVALID = -EINVAL,
-};
+} UnitFileState;
 
 static inline bool unit_type_may_alias(UnitType type) {
         return IN_SET(type,
index c2ad11a0c2024b1038464f427dbf0e0c7e8d7bb4..10a5a75e9fe52c52459add47abb1617c19bcb4de 100644 (file)
@@ -1,11 +1,19 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <gshadow.h>
+
+#include "sd-json.h"
+
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "format-util.h"
+#include "group-record.h"
 #include "libcrypt-util.h"
 #include "log.h"
+#include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
+#include "user-record.h"
 #include "user-record-nss.h"
 #include "user-util.h"
 #include "utf8.h"
index 22ab04d6eec3d150ec572dddc85c82e08713137a..c2f2faf16c87e3b96c658f0ca887ba733a7b5efd 100644 (file)
@@ -1,13 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <grp.h>
-#include <gshadow.h>
-#include <pwd.h>
-#include <shadow.h>
-
-#include "group-record.h"
-#include "user-record.h"
+#include "forward.h"
 
 /* Synthesize UserRecord and GroupRecord objects from NSS data */
 
index 11af68a72ef021487a737b829ad442bdfe5b6d83..0dea12d4ca2cc1a9fda8d030d3a8f7c0b1e0f042 100644 (file)
@@ -1,20 +1,22 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "alloc-util.h"
 #include "cap-list.h"
 #include "format-util.h"
-#include "fs-util.h"
 #include "glyph-util.h"
 #include "hashmap.h"
 #include "hexdecoct.h"
-#include "log.h"
 #include "path-util.h"
 #include "percent-util.h"
 #include "pretty-print.h"
 #include "process-util.h"
 #include "rlimit-util.h"
 #include "sha256.h"
+#include "string-util.h"
 #include "strv.h"
-#include "terminal-util.h"
+#include "time-util.h"
+#include "user-record.h"
+#include "group-record.h"
 #include "user-record-show.h"
 #include "user-util.h"
 #include "userdb.h"
index 7b65b14e9d2a26e7818185dbceaa2b280afc3ab0..3612fa3624d57bb2fa154647d47004d0dffd2420 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "group-record.h"
-#include "user-record.h"
+#include "forward.h"
 
 const char* user_record_state_color(const char *state);
 
index 2dd590110e34d3f06125cfad651a27a320a2d296..e0ff097bf30d26e99eee3befa56edc28d78df183 100644 (file)
@@ -7,12 +7,9 @@
 #include "cap-list.h"
 #include "cgroup-util.h"
 #include "dns-domain.h"
-#include "env-util.h"
-#include "fs-util.h"
 #include "glyph-util.h"
-#include "hexdecoct.h"
+#include "hashmap.h"
 #include "hostname-setup.h"
-#include "hostname-util.h"
 #include "json-util.h"
 #include "locale-util.h"
 #include "log.h"
 #include "rlimit-util.h"
 #include "sha256.h"
 #include "string-table.h"
+#include "string-util.h"
 #include "strv.h"
+#include "time-util.h"
 #include "uid-classification.h"
 #include "user-record.h"
 #include "user-util.h"
-#include "utf8.h"
 
 #define DEFAULT_RATELIMIT_BURST 30
 #define DEFAULT_RATELIMIT_INTERVAL_USEC (1*USEC_PER_MINUTE)
@@ -106,6 +104,11 @@ UserRecord* user_record_new(void) {
         return h;
 }
 
+sd_json_dispatch_flags_t USER_RECORD_LOAD_FLAGS_TO_JSON_DISPATCH_FLAGS(UserRecordLoadFlags flags) {
+        return (FLAGS_SET(flags, USER_RECORD_LOG) ? SD_JSON_LOG : 0) |
+                (FLAGS_SET(flags, USER_RECORD_PERMISSIVE) ? SD_JSON_PERMISSIVE : 0);
+}
+
 static void pkcs11_encrypted_key_done(Pkcs11EncryptedKey *k) {
         if (!k)
                 return;
@@ -2761,6 +2764,21 @@ int suitable_blob_filename(const char *name) {
                name[0] != '.';
 }
 
+bool userdb_match_is_set(const UserDBMatch *match) {
+        if (!match)
+                return false;
+
+        return !strv_isempty(match->fuzzy_names) ||
+                !FLAGS_SET(match->disposition_mask, USER_DISPOSITION_MASK_ALL) ||
+                match->uid_min > 0 ||
+                match->uid_max < UID_INVALID-1;
+}
+
+void userdb_match_done(UserDBMatch *match) {
+        assert(match);
+        strv_free(match->fuzzy_names);
+}
+
 bool user_name_fuzzy_match(const char *names[], size_t n_names, char **matches) {
         assert(names || n_names == 0);
 
index fde03e55958f5e8149d46529f789fdc19faaaadb..870c30b7a82ea181de3c7c956dbcbf5f64d0f0b9 100644 (file)
@@ -1,18 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
-#include "sd-json.h"
 
 #include "bitfield.h"
-#include "hashmap.h"
 #include "rlimit-util.h"
-#include "strv.h"
-#include "time-util.h"
-#include "user-util.h"
+#include "forward.h"
 
 typedef enum UserDisposition {
         USER_INTRINSIC,   /* root and nobody */
@@ -184,10 +177,7 @@ static inline UserRecordMask USER_RECORD_STRIP_MASK(UserRecordLoadFlags f) {
         return (f >> 21) & _USER_RECORD_MASK_MAX;
 }
 
-static inline sd_json_dispatch_flags_t USER_RECORD_LOAD_FLAGS_TO_JSON_DISPATCH_FLAGS(UserRecordLoadFlags flags) {
-        return (FLAGS_SET(flags, USER_RECORD_LOG) ? SD_JSON_LOG : 0) |
-                (FLAGS_SET(flags, USER_RECORD_PERMISSIVE) ? SD_JSON_PERMISSIVE : 0);
-}
+sd_json_dispatch_flags_t USER_RECORD_LOAD_FLAGS_TO_JSON_DISPATCH_FLAGS(UserRecordLoadFlags flags);
 
 typedef struct Pkcs11EncryptedKey {
         /* The encrypted passphrase, which can be decrypted with the private key indicated below */
@@ -541,22 +531,11 @@ typedef struct UserDBMatch {
                         INDEXES_TO_MASK(uint64_t, USER_INTRINSIC, USER_SYSTEM), \
                 .uid_min = 0,                                   \
                 .uid_max = UID_NOBODY - 1,                      \
-       }
+        }
 
-static inline bool userdb_match_is_set(const UserDBMatch *match) {
-        if (!match)
-                return false;
+bool userdb_match_is_set(const UserDBMatch *match);
 
-        return !strv_isempty(match->fuzzy_names) ||
-                !FLAGS_SET(match->disposition_mask, USER_DISPOSITION_MASK_ALL) ||
-                match->uid_min > 0 ||
-                match->uid_max < UID_INVALID-1;
-}
-
-static inline void userdb_match_done(UserDBMatch *match) {
-        assert(match);
-        strv_free(match->fuzzy_names);
-}
+void userdb_match_done(UserDBMatch *match);
 
 bool user_name_fuzzy_match(const char *names[], size_t n_names, char **matches);
 bool user_record_match(UserRecord *u, const UserDBMatch *match);
index 176cdddaafd53944ad0f5af07cfba7102710e19f..08dbccf0b2f9b7e29fa307efb578c45cbc383852 100644 (file)
@@ -1,15 +1,18 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-json.h"
+
 #include "alloc-util.h"
 #include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "format-util.h"
 #include "group-record.h"
-#include "log.h"
 #include "path-util.h"
 #include "stdio-util.h"
+#include "string-util.h"
 #include "user-util.h"
+#include "userdb.h"
 #include "userdb-dropin.h"
 
 static int load_user(
index 3bd1b9c8451fed8800561f222216487a9d8207d0..170232f99d431815b647226c3f6a12cdcd03afcd 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "constants.h"
-#include "group-record.h"
-#include "user-record.h"
-#include "userdb.h"
+#include "forward.h"
 
 /* This could be put together with CONF_PATHS_NULSTR, with the exception of the /run/host/ part in the
  * middle, which we use here, but not otherwise. */
index 2972def56a3d18340c8e50a84f541319a1be99f5..5274f87da17b03f71e02b2db5a02111ad72bc850 100644 (file)
@@ -1,7 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <sys/auxv.h>
+#include <gshadow.h>
+#include <stdlib.h>
 
+#include "sd-event.h"
 #include "sd-varlink.h"
 
 #include "alloc-util.h"
 #include "format-util.h"
 #include "json-util.h"
 #include "log.h"
-#include "missing_syscall.h"
 #include "parse-util.h"
 #include "set.h"
-#include "socket-util.h"
+#include "string-util.h"
 #include "strv.h"
 #include "uid-classification.h"
 #include "user-record-nss.h"
index 683b94a6df44db65ba89186fec2e879ceff2cb8e..4004d80d232e1ce48a18e1daefc2e4e82247311c 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <sys/socket.h>
-#include <sys/un.h>
-
+#include "forward.h"
 #include "group-record.h"
 #include "user-record.h"
 
index 853ef29a7c739a492bdcb6c0673f47537af25d23..b0581162ab784bedfa5f2fe83c50fd74a33557d1 100644 (file)
@@ -1,24 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/time.h>
 #include <sys/utsname.h>
-#include <unistd.h>
 #include <utmpx.h>
 
-#include "alloc-util.h"
-#include "errno-util.h"
-#include "hostname-util.h"
 #include "log.h"
-#include "macro.h"
 #include "memory-util.h"
-#include "path-util.h"
 #include "string-util.h"
 #include "time-util.h"
-#include "user-util.h"
 #include "utmp-wtmp.h"
 
 int utmp_get_runlevel(int *runlevel, int *previous) {
index 8577d9b013d3e06642d365737e2824388bd715b5..f4b543e6c08cd4735aaa11f206f86b2c6fb467cd 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "assert-util.h"
-#include "time-util.h"
+#include "forward.h"
 
 #if ENABLE_UTMP
 #include <utmpx.h>
index e76a9d268f4f733a1bf13d006cd9e552e3e90a9e..92cb2dfd75cf8289fe946c0b721c5cc863027675 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "bus-polkit.h"
 #include "varlink-idl-common.h"
 #include "varlink-io.systemd.Login.h"
 
index 8ab65cf3c4bcead6425e1af2eb19433be3ec9472..2b26ef1dcfed17287ef5c5332dc708c956ffbed2 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "build.h"
 #include "varlink-idl-common.h"
 #include "varlink-io.systemd.Manager.h"
 
index d56f613eff55f0b410a6871b9b40f570f7ccf19b..cb4a97a91c990ea52c1117880c3b90091a828471 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 #pragma once
 
-#include "sd-varlink.h"
 #include "sd-varlink-idl.h"
 
 extern const sd_varlink_interface vl_interface_io_systemd_Udev;
index 21c44a96b74163a327e0aa1783a4107aebbb2191..d130f0df51a5e441c0d69882a00d25c792d54b27 100644 (file)
@@ -5,7 +5,6 @@
 #include "env-util.h"
 #include "json-util.h"
 #include "log.h"
-#include "string-util.h"
 #include "strv.h"
 #include "utf8.h"
 #include "varlink-io.systemd.service.h"
index 075cb6cc5e1ba0a3eeec9b4cab7176b7e1f8d0b0..c7e6c5c4030f5f6d1c74847607d1dc18cf87bcc9 100644 (file)
@@ -1,8 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-event.h"
+
+#include "alloc-util.h"
+#include "fdset.h"
 #include "log.h"
 #include "parse-util.h"
 #include "socket-util.h"
+#include "string-util.h"
 #include "varlink-internal.h"
 #include "varlink-serialize.h"
 
index 4cc47aa05365f6c5220004d9ad43088be04c4f3b..9bb47b9570d6efc32dc3dce52847178575f38c3b 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdio.h>
-
-#include "sd-varlink.h"
-
-#include "fdset.h"
+#include "forward.h"
 
 int varlink_server_serialize(sd_varlink_server *s, FILE *f, FDSet *fds);
 int varlink_server_deserialize_one(sd_varlink_server *s, const char *value, FDSet *fds);
index 4b722faeab1e99aed2e53276d33e157d843879ac..cd623bebdbbb6282db0af75407353b351c654a98 100644 (file)
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
+#include <unistd.h>
+
 #include "alloc-util.h"
 #include "env-util.h"
 #include "extract-word.h"
index c9acc97b2984eeb3af24a149af400094dc825ad5..00ccd3bbf727ac82e40e3eb0dc97e8fc88e0ba3f 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 typedef struct X11Context {
         char *layout;
index d6748f749227c36172e81afb03764538dbdc1d1a..304dd5431b2b5d84eb92b5e8c349910136ae70b1 100644 (file)
@@ -1,10 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-bus.h"
+
 #include "alloc-util.h"
 #include "bus-error.h"
+#include "bus-locator.h"
 #include "log.h"
 #include "string-util.h"
-#include "strv.h"
 #include "syslog-util.h"
 #include "verb-log-control.h"
 
index b9e7cdd10b4e0a9130b63665e8b4b18942cd8e56..71c5f6c58dbf577f3b1893a37577673970d477a5 100644 (file)
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "bus-locator.h"
+#include "forward.h"
 
 int verb_log_control_common(sd_bus *bus, const char *destination, const char *verb, const char *value);
index 5b4b0705ac5337c46060dc297216eb3adfe94708..b7b78619fdedeb9ae3348e32a966a02256561d75 100644 (file)
@@ -1,14 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <getopt.h>
-#include <stdbool.h>
-#include <stddef.h>
 
 #include "env-util.h"
 #include "log.h"
-#include "macro.h"
-#include "process-util.h"
 #include "string-util.h"
 #include "strv.h"
 #include "verbs.h"
index 3c0ae79d5a7adb3e4f0f7afdb68beffa13aabbbb..abf1a35641c75f6d405980b19ad8224a425de5da 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 #define VERB_ANY (UINT_MAX)
 
index 17f2d3990b7f86ad861dc98330110258bea239b1..2343acb346c77b9c1ac0bb18cd2dacd26f565905 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "conf-parser.h"
+#include "log.h"
 #include "parse-util.h"
 #include "string-util.h"
 #include "vlan-util.h"
index f245b72aab653e87914519441b203ae745007f86..835e0f6cc24ff9fae8b8dd80741c2d83b694611e 100644 (file)
@@ -1,10 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-
-#include "conf-parser.h"
+#include "conf-parser-forward.h"
+#include "forward.h"
 
 #define VLANID_MAX 4094
 #define VLANID_INVALID UINT16_MAX
index 5138edbd1015130ae9949627f8a330922407238d..eaf53ac4ad18aeae2ad834df996a0894fd37306f 100644 (file)
@@ -1,13 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-
 #include "alloc-util.h"
-#include "macro.h"
-#include "parse-util.h"
 #include "proc-cmdline.h"
 #include "string-table.h"
-#include "string-util.h"
 #include "volatile-util.h"
 
 int query_volatile_mode(VolatileMode *ret) {
index ba3073b91318922c28ba0f3c303a383ab8f9675f..b9cd6c283a5b6a54ffec4d564621bc5e33d0f8fd 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
+#include "forward.h"
 
 typedef enum VolatileMode {
         VOLATILE_NO,
index abad029094365d36a78a60b49b906a1d9368a00d..b1b2d930543976e16c7aace616ced6718365d3ac 100644 (file)
@@ -7,11 +7,11 @@
 #include "bitfield.h"
 #include "chase.h"
 #include "fd-util.h"
-#include "fs-util.h"
 #include "log.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "recurse-dir.h"
+#include "stat-util.h"
 #include "string-util.h"
 #include "strv.h"
 #include "vpick.h"
index ce7dac57214c0474ac1c26eff2201b54d8cb2747..3075a4b047696539da5a2f6dfd13e3e20bbfa549 100644 (file)
@@ -2,9 +2,9 @@
 #pragma once
 
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "architecture.h"
+#include "forward.h"
 
 typedef enum PickFlags {
         PICK_ARCHITECTURE = 1 << 0,   /* Look for an architecture suffix */
index f936ba97d9dc7441aae9c1367ab0cbcdeb9819c3..184c7c63eab8a4dcc1fbd16404d536fe798ddd92 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <string.h>
 #include <unistd.h>
 
 #include "sd-login.h"
@@ -15,6 +13,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "terminal-util.h"
+#include "time-util.h"
 #include "user-util.h"
 #include "utmp-wtmp.h"
 #include "wall.h"
index 29642778c7e09d3c6dc9099d215afd6fb03cc0ba..c622b6f652d56944d8853c74d2fa5c8f61162f20 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
+#include "forward.h"
 
 #if ENABLE_UTMP || ENABLE_LOGIND
 
index 28cae1c260874f7cf80aa0e1d19e9e5460a455d5..5b113013950f794e6b23fc6512dacdd236c3eac6 100644 (file)
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
 #include <fcntl.h>
 #include <linux/watchdog.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <syslog.h>
 #include <unistd.h>
 
index 7880b041282e35a2e32f8dc74614f79b925b5f94..f613689ca581dfa07aeae45d543dc4d9cd89c0f4 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "time-util.h"
+#include "forward.h"
 
 const char* watchdog_get_device(void);
 usec_t watchdog_get_last_ping(clockid_t clock);
index 39a300f5c96b1cf73ad76daf6b2638311c0fef7a..628f0805bd3f830ad5fc572f747c20d7498e7b48 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <stdbool.h>
-
 #include "string-util.h"
 #include "strv.h"
 #include "utf8.h"
index 88b4897be0599afb7100a1966e59d1aae6cb7c9f..1bb8509da077c3abd2cc3411f61d5678b65d5235 100644 (file)
@@ -1,9 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "macro.h"
+#include "forward.h"
 
 bool http_url_is_valid(const char *url) _pure_;
 bool file_url_is_valid(const char *url) _pure_;
index 052f5606e5368a74e8e98903862524afe6d13b98..81b6cda5dd0ecf5af5eaa200a3a6dea74b066a67 100644 (file)
@@ -1,5 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "sd-netlink.h"
+
+#include "alloc-util.h"
+#include "ether-addr-util.h"
 #include "log.h"
 #include "string-table.h"
 #include "string-util.h"
index b71df933b777e4f928a6cebe0b59d1b697de54bc..973a49155ad931d9af34838eb8b50be289390b2d 100644 (file)
@@ -4,9 +4,7 @@
 
 #include <linux/nl80211.h>
 
-#include "sd-netlink.h"
-
-#include "ether-addr-util.h"
+#include "forward.h"
 
 int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *ret_iftype, char **ret_ssid);
 int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *ret_bssid);
index d5ec3b25fe5f9cbe30a31bd803ecccdd14bbb9bb..a8a99ac348045c4bbfcae674ac3b2427d4d9b787 100644 (file)
@@ -1,10 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <errno.h>
-#include <stddef.h>
-
-#include "log.h"
-#include "macro.h"
 #include "string-util.h"
 #include "xml.h"
 
index 217b3b0e40e8ee2d11ea88971945d562acfb2a45..1ef9de147d2efd8e528d0145349e409e220760de 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 enum {
         XML_END,
         XML_TEXT,