]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Clean up includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 08:00:39 +0000 (10:00 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 09:10:20 +0000 (11:10 +0200)
Instead of introducing efi-forward.h, we use efi.h for the same purpose
in the boot/ folder.

40 files changed:
src/boot/bcd.c
src/boot/boot.c
src/boot/chid.c
src/boot/chid.h
src/boot/console.c
src/boot/cpio.c
src/boot/cpio.h
src/boot/device-path-util.c
src/boot/device-path-util.h
src/boot/drivers.c
src/boot/edid.c
src/boot/edid.h
src/boot/efi-efivars.h
src/boot/efi-firmware.c
src/boot/efi-log.h
src/boot/efi-string.c
src/boot/efi-string.h
src/boot/efi.h
src/boot/fuzz-efi-printf.c
src/boot/fuzz-efi-string.c
src/boot/graphics.c
src/boot/initrd.c
src/boot/line-edit.c
src/boot/linux.c
src/boot/linux_x86.c
src/boot/measure.c
src/boot/pe.c
src/boot/random-seed.c
src/boot/secure-boot.c
src/boot/smbios.c
src/boot/stub.c
src/boot/sysfail.h
src/boot/test-bcd.c
src/boot/test-chid-match.c
src/boot/test-efi-string.c
src/boot/ticks.c
src/boot/ticks.h
src/boot/util.c
src/boot/util.h
src/boot/vmm.c

index 9b5596b23aa2a51c4253737c243abf2119e57a8a..4533d479c1470bffbdaeb4a0a986b93c5b322f34 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <stdalign.h>
 
-#include "assert-fundamental.h"
 #include "bcd.h"
 #include "efi-string.h"
 
index 967b9db1dc6cca620c0876bb8b933925032f34d2..bf8f5a1a34d3f4b358d58e89ce4ab3aa92a56c90 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <limits.h>
-
 #include "bcd.h"
 #include "bootspec-fundamental.h"
 #include "console.h"
@@ -9,19 +7,18 @@
 #include "devicetree.h"
 #include "drivers.h"
 #include "efi-efivars.h"
+#include "efi-log.h"
 #include "efi-string-table.h"
 #include "efivars-fundamental.h"
 #include "export-vars.h"
 #include "graphics.h"
 #include "initrd.h"
 #include "line-edit.h"
-#include "linux.h"
 #include "measure.h"
 #include "memory-util-fundamental.h"
 #include "part-discovery.h"
 #include "pe.h"
 #include "proto/block-io.h"
-#include "proto/device-path.h"
 #include "proto/load-file.h"
 #include "proto/simple-text-io.h"
 #include "random-seed.h"
index 24739e956cc9d2fb112e9c4239cd932d36913b4a..a5a90a3b63e4e2f0e1faeff1c80d392a736fc6d1 100644 (file)
@@ -17,8 +17,8 @@
 #include "chid.h"
 #include "chid-fundamental.h"
 #include "edid.h"
-#include "efi.h"
-#include "sha1-fundamental.h"
+#include "efi-log.h"
+#include "efi-string.h"
 #include "smbios.h"
 #include "util.h"
 
index ba594a291d6d27057bc64ddd0a085c1a41498ac9..fcc4464539fe82b42e80a770152b4fd2ae2f2016 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 #pragma once
 
-#include "chid-fundamental.h"
+#include "chid-fundamental.h" /* IWYU pragma: export */
 #include "efi.h"
 
 /* A .hwids PE section consists of a series of 'Device' structures. A 'Device' structure binds a CHID to some
index 5e11ba54249f40fc7c1819719bf7ba3d13584693..9ed5ccef09a1458daef73a151c3f190f21517c41 100644 (file)
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "console.h"
+#include "efi-log.h"
 #include "proto/graphics-output.h"
-#include "util.h"
 
 #define SYSTEM_FONT_WIDTH 8
 #define SYSTEM_FONT_HEIGHT 19
index fc5e303d7e6e58a747c7c32f0b6fe40a9b0e9255..8a15253dedad16b5d723ca3965b48c172c6c6750 100644 (file)
@@ -1,9 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "cpio.h"
-#include "device-path-util.h"
+#include "efi-log.h"
+#include "iovec-util-fundamental.h"
 #include "measure.h"
-#include "proto/device-path.h"
+#include "string-util-fundamental.h"
 #include "util.h"
 
 static char *write_cpio_word(char *p, uint32_t v) {
index 660372c0b71bd861a773bd92e07af38f402957c1..bb741278fdc24363c0b70622cf16c02cfc0d054f 100644 (file)
@@ -2,7 +2,6 @@
 #pragma once
 
 #include "efi.h"
-#include "iovec-util-fundamental.h"
 #include "proto/loaded-image.h"
 
 EFI_STATUS pack_cpio(
index 0e991f941f591b1091560f6abe753c595e0d9196..2764373d94acc52d23d1fea426e2326fc059d44b 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "device-path-util.h"
 #include "efi-string.h"
+#include "string-util-fundamental.h"
 #include "util.h"
 
 EFI_STATUS make_file_device_path(EFI_HANDLE device, const char16_t *file, EFI_DEVICE_PATH **ret_dp) {
@@ -178,3 +179,7 @@ size_t device_path_size(const EFI_DEVICE_PATH *dp) {
 
         return (const uint8_t*) i - (const uint8_t*) dp + sizeof(EFI_DEVICE_PATH);
 }
+
+EFI_DEVICE_PATH *device_path_dup(const EFI_DEVICE_PATH *dp) {
+        return xmemdup(ASSERT_PTR(dp), device_path_size(dp));
+}
index c33669a866b59673fcfbccbb7748b840f023583d..b02cf3146a9ecaca6b7b3f255b03d8097b1e9b79 100644 (file)
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "efi.h"
 #include "proto/device-path.h"
-#include "util.h"
 
 EFI_STATUS make_file_device_path(EFI_HANDLE device, const char16_t *file, EFI_DEVICE_PATH **ret_dp);
 EFI_STATUS make_url_device_path(const char16_t *url, EFI_DEVICE_PATH **ret);
@@ -30,6 +30,4 @@ static inline bool device_path_is_end(const EFI_DEVICE_PATH *dp) {
 
 size_t device_path_size(const EFI_DEVICE_PATH *dp);
 
-static inline EFI_DEVICE_PATH *device_path_dup(const EFI_DEVICE_PATH *dp) {
-        return xmemdup(ASSERT_PTR(dp), device_path_size(dp));
-}
+EFI_DEVICE_PATH *device_path_dup(const EFI_DEVICE_PATH *dp);
index 414e27a0f401dca9e4d284865338f5b33fc64cb3..a44957b4e44d2c8954fb4875d130e7d47f78e718 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "device-path-util.h"
 #include "drivers.h"
+#include "efi-log.h"
+#include "string-util-fundamental.h"
 #include "util.h"
 
 static EFI_STATUS load_one_driver(
index a1a41cc28919340c3e6ce992ab4432e268738b16..f740d8671f9a1c9bf686ec9d733cc7b146cbfe3d 100644 (file)
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "edid.h"
-#include "edid-fundamental.h"
-#include "efi-log.h"
 #include "proto/edid-discovered.h"
 #include "util.h"
 
index 9832dadaab47867b3e5751f92f3eb1ab1b622f69..74649658d93ff27eddb797388676171adf70727c 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "edid-fundamental.h" /* IWYU pragma: export */
 #include "efi.h"
 
 EFI_STATUS edid_get_discovered_panel_id(char16_t **ret_panel);
index 61e27d6b33b7082949a6a763db730aed9d7bfe0a..1e74d6483cf4c22ed7b412d1ba9bb3048ea07a55 100644 (file)
@@ -2,6 +2,7 @@
 #pragma once
 
 #include "efi.h"
+#include "efivars-fundamental.h" /* IWYU pragma: export */
 
 /*
  * Allocated random UUID, intended to be shared across tools that implement
index 01bb2c2c7154c0f121e1c21181a7a0add0f19d6b..1296c5069ac1c370f2c1905ad2da2699943648cc 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "efi-firmware.h"
-#include "util.h"
+#include "efi-string.h"
 
 static bool efifw_validate_header(
                 const void *blob,
index 64664f77c3daaa1cf5b053a14fdea44570e883a4..06954b06f0a61a1b54233552c7ca7658a362ef2c 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "efi.h"
 #include "efi-string.h"
 #include "proto/simple-text-io.h"
 
index 59cb0fa9f5498a477eeb9714ac27c79a13b173e1..8e2c73d84d68882fcbd115ca9cc135af6e623edf 100644 (file)
@@ -1,7 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <limits.h>
-
 #include "efi-string.h"
 
 #if SD_BOOT
index fa1f63324aa1c8f4660ab6f42d802a49ea152557..b1554727387991588f3338670553816b37d3e78b 100644 (file)
@@ -2,7 +2,6 @@
 #pragma once
 
 #include "efi.h"
-#include "macro-fundamental.h"
 
 size_t strnlen8(const char *s, size_t n);
 size_t strnlen16(const char16_t *s, size_t n);
index f35d0692bf8a3f1f16ccd66972b481b4c753b001..1832df980c3eb4a53d2d27b56764d391f9e01667 100644 (file)
@@ -1,13 +1,18 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
+/* IWYU pragma: always_keep */
 
-#include "efi-fundamental.h"
-#include "macro-fundamental.h"
+#include <limits.h>                     /* IWYU pragma: export */
+#include <stdarg.h>                     /* IWYU pragma: export */
+#include <stdbool.h>                    /* IWYU pragma: export */
+#include <stddef.h>                     /* IWYU pragma: export */
+#include <stdint.h>                     /* IWYU pragma: export */
+
+#include "assert-fundamental.h"         /* IWYU pragma: export */
+#include "cleanup-fundamental.h"        /* IWYU pragma: export */
+#include "efi-fundamental.h"            /* IWYU pragma: export */
+#include "macro-fundamental.h"          /* IWYU pragma: export */
 
 #if SD_BOOT
 /* uchar.h/wchar.h are not suitable for freestanding environments. */
@@ -45,6 +50,8 @@ assert_cc(alignof(char32_t) == 4);
 #  include <wchar.h>
 #endif
 
+struct iovec;
+
 /* We use size_t/ssize_t to represent UEFI UINTN/INTN. */
 typedef size_t EFI_STATUS;
 typedef intptr_t ssize_t;
index 6dee830c14cbb396f3bfd0dd8cbb59efb3cce4aa..2857b389a22d189d1ca1549b58157cdbed386cb8 100644 (file)
@@ -3,7 +3,6 @@
 #include "alloc-util.h"
 #include "efi-string.h"
 #include "fuzz.h"
-#include "utf8.h"
 
 typedef struct {
         EFI_STATUS status;
index 36ecaf90ae80c7a1ba382755138a443a6a5fb044..2b854b3782a0c3c4ec24eb0babaa78aa4c9af2ca 100644 (file)
@@ -3,7 +3,6 @@
 #include "alloc-util.h"
 #include "efi-string.h"
 #include "fuzz.h"
-#include "utf8.h"
 
 static char16_t *memdup_str16(const uint8_t *data, size_t size) {
         char16_t *ret = memdup(data, size);
index 496fc6918991c226cc902ad468945c301df096ba..3f2a06bea2f095fb240e1ce0136a931521633cea 100644 (file)
@@ -4,10 +4,10 @@
  *   Authored by Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
  */
 
+#include "efi-log.h"
 #include "graphics.h"
 #include "proto/console-control.h"
 #include "proto/simple-text-io.h"
-#include "util.h"
 
 EFI_STATUS graphics_mode(bool on) {
         EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
index 527b05f5dbd39d37a6174412c3e8b21baae429ba..1de4fcfa054d9117d54507478faa8a1ddc415166 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "initrd.h"
-#include "macro-fundamental.h"
 #include "proto/device-path.h"
 #include "proto/load-file.h"
 #include "util.h"
index ca9dc067a5d0bf71ba1e230223c16da3d89f7291..1e6128e1effaa68d8447ff6a10892d4ac4a71c59 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "console.h"
 #include "line-edit.h"
+#include "string-util-fundamental.h"
 #include "util.h"
 
 static void cursor_left(size_t *cursor, size_t *first) {
index 54f52645d24f58fbdcc30b9aad88d658544f6554..00bdf8c1ce4be92bb4ad3c083c7555b56b42f613 100644 (file)
@@ -8,6 +8,7 @@
  * This method works for Linux 5.8 and newer on ARM/Aarch64, x86/x68_64 and RISC-V.
  */
 
+#include "efi-log.h"
 #include "initrd.h"
 #include "linux.h"
 #include "pe.h"
index ddae4d160a196add246ffc3633f98cfe5b9bd687..cf9707a6cfd7ab405bec2db8662783f2ba6668d7 100644 (file)
@@ -10,7 +10,7 @@
  * see https://docs.kernel.org/arch/x86/boot.html
  */
 
-#include "initrd.h"
+#include "efi-log.h"
 #include "linux.h"
 #include "macro-fundamental.h"
 #include "memory-util-fundamental.h"
index 48e9fb5fc50b2423ccace15d8716846a28942c47..590fed8ec27630e6b7f322ba425e8c5dfde8a9ef 100644 (file)
@@ -2,9 +2,8 @@
 
 #if ENABLE_TPM
 
-#include "macro-fundamental.h"
+#include "efi-log.h"
 #include "measure.h"
-#include "memory-util-fundamental.h"
 #include "proto/cc-measurement.h"
 #include "proto/tcg.h"
 #include "tpm2-pcr.h"
index c5cd6a57cabf077e0ed3b85f86a7b8ef91b6a328..9ce978a48b72fb3ec2f6682f7e50715c52c099bf 100644 (file)
@@ -1,10 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <limits.h>
-
 #include "chid.h"
 #include "devicetree.h"
 #include "efi-firmware.h"
+#include "efi-log.h"
 #include "pe.h"
 #include "util.h"
 
index a4d7f5ba265a4f632ceb065957e1927e6a3604cb..59ed782060a30b05d5512b3ddedae88a367024a7 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "efi-efivars.h"
+#include "efi-log.h"
 #include "memory-util-fundamental.h"
 #include "proto/rng.h"
 #include "random-seed.h"
index 5781669a4c23013fac6cdf9033954aa9820ed267..84c86fe424901b6aa5684dd2687fb7971dbbb0f1 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "console.h"
 #include "efi-efivars.h"
+#include "efi-log.h"
 #include "efi-string-table.h"
 #include "proto/security-arch.h"
 #include "secure-boot.h"
index e2674f6cd34865be69a4ef32a098c03d3e8679c3..0bbcf30123d18d84ee41b0166f76418d31a595ae 100644 (file)
@@ -1,10 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "efi-efivars.h"
 #include "efi-string.h"
-#include "proto/device-path.h"
 #include "smbios.h"
-#include "string-util-fundamental.h"
 #include "util.h"
 
 #define SMBIOS_TABLE_GUID \
index a117d1133216efdc9b17e633df6d8aaad0644479..301d7a1cc9f999ca6f5f106f4abb985341307ace 100644 (file)
@@ -1,11 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <limits.h>
-
 #include "cpio.h"
 #include "device-path-util.h"
 #include "devicetree.h"
 #include "efi-efivars.h"
+#include "efi-log.h"
 #include "export-vars.h"
 #include "graphics.h"
 #include "iovec-util-fundamental.h"
index aafdf790be3ebf39e21eb287ebe99f92442cbf97..cc0d45f617759cf963e7dd82ea8b55c9a5733de1 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "efivars-fundamental.h"
+#include "efi.h"
 
 typedef enum SysFailType {
         SYSFAIL_NO_FAILURE,
index 3f93ca05c58cb18d6cc8d986adc9ba89db6cf0c2..0924c94fa07f9d47645f7ae0fa2dd42243bedcef 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "alloc-util.h"
+#include "argv-util.h"
 #include "bcd.h"
 #include "compress.h"
 #include "fileio.h"
index 5a22db70e391cf958df6d1ab32a0ecff9d999943..400c8fc1bd3ba3d67ee30104a0c5f005fae144a4 100644 (file)
@@ -1,8 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <stddef.h>
-#include <stdint.h>
-
 #include "chid.h"
 #include "edid.h"
 #include "efi-string.h"
index 3278ac2c30df43209a4455c2d3243d0c86034e65..4d8300aa911a4fc0f702b7bdbf8165ded0916e98 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <fnmatch.h>
 
+#include "alloc-util.h"
+#include "argv-util.h"
 #include "efi-string.h"
 #include "fileio.h"
 #include "tests.h"
index 873b9fe9e6d624acf1e416f0f924daf87eb7d1a9..bd79aed0822597cad33d9293f5567766f595b384 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "ticks.h"
-#include "util.h"
 #include "vmm.h"
 
 #if defined(__i386__) || defined(__x86_64__)
index fec3764dd4296bc04351c60424a2fd6f946fdac9..d32c0ffc0a75d0628d10c4a77352a51b39efac4f 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdint.h>
+#include "efi.h"
 
 uint64_t time_usec(void);
index 20db520654b7c36de8b8cb28ea030f1537fa346a..5d439430b8de97473b63511ea94c222e06e05467 100644 (file)
@@ -1,12 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "device-path-util.h"
-#include "efi-efivars.h"
+
+#include "efi-log.h"
 #include "efi-string.h"
 #include "memory-util-fundamental.h"
 #include "proto/device-path.h"
 #include "proto/simple-text-io.h"
-#include "ticks.h"
+#include "string-util-fundamental.h"
 #include "util.h"
 #include "version.h"
 
index 4f0fe431498a14fba8d1e96ff4ea644eb2a3e996..98e9ae576eee1be9cb698231debd250701a231c2 100644 (file)
@@ -2,13 +2,10 @@
 #pragma once
 
 #include "efi.h"
-#include "efi-string.h"
 #include "memory-util-fundamental.h"
-#include "string-util-fundamental.h"
 
 #if SD_BOOT
 
-#include "efi-log.h"
 #include "proto/file-io.h"
 
 /* This is provided by the linker. */
index babe581073e90a845cccfe934bbe9962aaceed67..da17e4584aaecd941af670726b24d4a4120eb7df 100644 (file)
@@ -11,7 +11,6 @@
 #include "efi-efivars.h"
 #include "proto/device-path.h"
 #include "smbios.h"
-#include "string-util-fundamental.h"
 #include "util.h"
 #include "vmm.h"