tree-wide: standardize header names across src/fundamental, src/basic and src/shared

Drop the -fundamental suffix from src/fundamental/ headers in favor of names
that match their src/basic/ or src/shared/ counterparts (e.g.
macro-fundamental.h -> macro.h, assert-fundamental.h -> assert-util.h,
cleanup-fundamental.h -> cleanup-util.h). Rename src/basic/{btrfs,label}.{c,h}
to use the -util suffix to match the existing shared/btrfs-util and
shared/label-util siblings. Rename src/shared/mkdir-label.{c,h} to mkdir.{c,h}
and src/shared/tmpfile-util-label.{c,h} to tmpfile-util.{c,h} to match the
corresponding src/basic names.

This saves us from having to come up with separate names for files that do
the same thing across tiers, and it makes it easier to move stuff between
src/fundamental, src/basic and src/shared: consumers just #include "foo.h"
and pick up whichever tier their -I path resolves to first, so call sites
don't need to be updated when an API moves between layers.

Where a higher-tier wrapper exists (e.g. src/basic/macro.h wrapping
src/fundamental/macro.h), the wrapper uses an explicit "../fundamental/foo.h"
or "../basic/foo.h" relative include for the lower-tier header. We can't use
GCC's #include_next directive for this — when the wrapper is reachable both
via same-dir-as-source lookup and via -I (e.g. -Isrc/shared) for the
directory it lives in, #include_next advances by exactly one slot in libcpp's
internal directory chain and lands on the same physical directory it was
already in, never reaching the lower-tier sibling (see make_cpp_dir() in
gcc/libcpp/files.cc:1986).

To make sure the right headers are always picked up, the include directories
are reordered so that e.g. src/shared always takes priority over src/basic and
similar for the other directories.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Daan De Meyer
2026-05-21 10:33:03 +09:00
committed by Yu Watanabe
parent 7e77105988
commit 74d392ed1b
166 changed files with 219 additions and 212 deletions
+1 -1
View File
@@ -11,6 +11,6 @@ CompileFlags:
Diagnostics: Diagnostics:
UnusedIncludes: Strict UnusedIncludes: Strict
# __no_reorder__ is a GCC-only attribute (see _no_reorder_ in # __no_reorder__ is a GCC-only attribute (see _no_reorder_ in
# src/fundamental/macro-fundamental.h). Meson detects it during configure # src/fundamental/macro.h). Meson detects it during configure
# with GCC and enables it unconditionally, so clangd flags every use. # with GCC and enables it unconditionally, so clangd flags every use.
Suppress: [unknown-attributes] Suppress: [unknown-attributes]
+2 -2
View File
@@ -67,8 +67,8 @@ The following exceptions apply:
* the tools/chromiumos/gen_autosuspend_rules.py script is licensed under the * the tools/chromiumos/gen_autosuspend_rules.py script is licensed under the
**BSD-3-Clause** license. **BSD-3-Clause** license.
* the following sources are under **Public Domain** (LicenseRef-alg-sha1-public-domain): * the following sources are under **Public Domain** (LicenseRef-alg-sha1-public-domain):
- src/fundamental/sha1-fundamental.c - src/fundamental/sha1.c
- src/fundamental/sha1-fundamental.h - src/fundamental/sha1.h
* the following files are licensed under **BSD-3-Clause** license: * the following files are licensed under **BSD-3-Clause** license:
- src/boot/chid.c - src/boot/chid.c
- src/boot/chid.h - src/boot/chid.h
+1 -1
View File
@@ -101,7 +101,7 @@
/* sizeof() does not evaluate its argument, so *ptr inside sizeof() is not a real dereference. /* sizeof() does not evaluate its argument, so *ptr inside sizeof() is not a real dereference.
* The SIZEOF() macro is an alias for sizeof() that hides the argument from coccinelle to avoid * The SIZEOF() macro is an alias for sizeof() that hides the argument from coccinelle to avoid
* false positives from check-pointer-deref.cocci. See assert-fundamental.h for the definition. */ * false positives from check-pointer-deref.cocci. See assert-util.h for the definition. */
#define SIZEOF(x) 8 #define SIZEOF(x) 8
/* Work around a bug in zlib.h parsing on Fedora (and possibly others) /* Work around a bug in zlib.h parsing on Fedora (and possibly others)
+4 -4
View File
@@ -366,10 +366,10 @@ SPDX-License-Identifier: LGPL-2.1-or-later
- `src/shared`: `shared-forward.h` - `src/shared`: `shared-forward.h`
Header files that extend other header files can include the original header Header files that extend other header files can include the original header
file. For example, `iovec-util.h` includes `iovec-fundamental.h` and file. For example, `iovec-util.h` includes `sys/uio.h`. To identify headers
`sys/uio.h`. To identify headers that are exported from other headers, add a that are exported from other headers, add a `IWYU pragma: export` comment
`IWYU pragma: export` comment to the includes so that these exports are to the includes so that these exports are recognized by clang static analysis
recognized by clang static analysis tooling. tooling.
Bad: Bad:
+3 -3
View File
@@ -1715,7 +1715,7 @@ basic_includes = [
version_include, version_include,
] ]
libsystemd_includes = [basic_includes, include_directories( libsystemd_includes = [include_directories(
'src/libsystemd/sd-bus', 'src/libsystemd/sd-bus',
'src/libsystemd/sd-common', 'src/libsystemd/sd-common',
'src/libsystemd/sd-device', 'src/libsystemd/sd-device',
@@ -1728,14 +1728,14 @@ libsystemd_includes = [basic_includes, include_directories(
'src/libsystemd/sd-network', 'src/libsystemd/sd-network',
'src/libsystemd/sd-path', 'src/libsystemd/sd-path',
'src/libsystemd/sd-resolve', 'src/libsystemd/sd-resolve',
'src/libsystemd/sd-varlink')] 'src/libsystemd/sd-varlink'), basic_includes]
includes = [ includes = [
libsystemd_includes,
include_directories( include_directories(
'src/shared', 'src/shared',
'src/bpf', 'src/bpf',
), ),
libsystemd_includes,
] ]
subdir('po') subdir('po')
+2 -2
View File
@@ -6,9 +6,9 @@
#include "analyze.h" #include "analyze.h"
#include "analyze-chid.h" #include "analyze-chid.h"
#include "ansi-color.h" #include "ansi-color.h"
#include "chid-fundamental.h" #include "chid.h"
#include "device-util.h" #include "device-util.h"
#include "edid-fundamental.h" #include "edid.h"
#include "efi-api.h" #include "efi-api.h"
#include "errno-util.h" #include "errno-util.h"
#include "escape.h" #include "escape.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "assert-fundamental.h" /* IWYU pragma: export */ #include "../fundamental/assert-util.h" /* IWYU pragma: export */
/* Logging for various assertions */ /* Logging for various assertions */
+2 -1
View File
@@ -17,7 +17,8 @@
#include "assert-util.h" /* IWYU pragma: export */ #include "assert-util.h" /* IWYU pragma: export */
#include "cleanup-util.h" /* IWYU pragma: export */ #include "cleanup-util.h" /* IWYU pragma: export */
#include "macro.h" /* IWYU pragma: export */ #include "macro.h" /* IWYU pragma: export */
#include "string-table-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/string-table.h" /* IWYU pragma: export */
/* Generic types */ /* Generic types */
+1 -1
View File
@@ -5,7 +5,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "alloc-util.h" #include "alloc-util.h"
#include "btrfs.h" #include "btrfs-util.h"
#include "errno-util.h" #include "errno-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "fs-util.h" #include "fs-util.h"
+2 -2
View File
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "assert-fundamental.h" #include "../fundamental/assert-util.h"
#include "cleanup-fundamental.h" /* IWYU pragma: export */ #include "../fundamental/cleanup-util.h" /* IWYU pragma: export */
typedef void (*free_func_t)(void *p); typedef void (*free_func_t)(void *p);
typedef void* (*mfree_func_t)(void *p); typedef void* (*mfree_func_t)(void *p);
-1
View File
@@ -8,7 +8,6 @@
#include <unistd.h> #include <unistd.h>
#include "confidential-virt.h" #include "confidential-virt.h"
#include "confidential-virt-fundamental.h"
#include "errno-util.h" /* IWYU pragma: keep */ #include "errno-util.h" /* IWYU pragma: keep */
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h" /* IWYU pragma: keep */ #include "fileio.h" /* IWYU pragma: keep */
+2
View File
@@ -3,6 +3,8 @@
#include "basic-forward.h" #include "basic-forward.h"
#include "../fundamental/confidential-virt.h" /* IWYU pragma: export */
typedef enum ConfidentialVirtualization { typedef enum ConfidentialVirtualization {
CONFIDENTIAL_VIRTUALIZATION_NONE = 0, CONFIDENTIAL_VIRTUALIZATION_NONE = 0,
+1 -1
View File
@@ -5,7 +5,7 @@
#include "sd-id128.h" #include "sd-id128.h"
#include "efivars-fundamental.h" /* IWYU pragma: export */ #include "../fundamental/efivars.h" /* IWYU pragma: export */
#define EFI_VENDOR_LOADER SD_ID128_MAKE(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f) #define EFI_VENDOR_LOADER SD_ID128_MAKE(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f)
#define EFI_VENDOR_LOADER_STR SD_ID128_MAKE_UUID_STR(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f) #define EFI_VENDOR_LOADER_STR SD_ID128_MAKE_UUID_STR(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f)
+1 -1
View File
@@ -10,7 +10,7 @@
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h" #include "fileio.h"
#include "fs-util.h" #include "fs-util.h"
#include "label.h" #include "label-util.h"
#include "log.h" #include "log.h"
#include "string-util.h" #include "string-util.h"
#include "strv.h" #include "strv.h"
+1 -1
View File
@@ -16,7 +16,7 @@
#include "hexdecoct.h" #include "hexdecoct.h"
#include "io-util.h" #include "io-util.h"
#include "iovec-util.h" #include "iovec-util.h"
#include "label.h" #include "label-util.h"
#include "log.h" #include "log.h"
#include "mkdir.h" #include "mkdir.h"
#include "nulstr-util.h" #include "nulstr-util.h"
+2 -2
View File
@@ -7,14 +7,14 @@
#include <unistd.h> #include <unistd.h>
#include "alloc-util.h" #include "alloc-util.h"
#include "btrfs.h" #include "btrfs-util.h"
#include "chattr-util.h" #include "chattr-util.h"
#include "dirent-util.h" #include "dirent-util.h"
#include "errno-util.h" #include "errno-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "fs-util.h" #include "fs-util.h"
#include "hostname-util.h" #include "hostname-util.h"
#include "label.h" #include "label-util.h"
#include "lock-util.h" #include "lock-util.h"
#include "log.h" #include "log.h"
#include "mkdir.h" #include "mkdir.h"
+2 -1
View File
@@ -4,7 +4,8 @@
#include <sys/uio.h> /* IWYU pragma: export */ #include <sys/uio.h> /* IWYU pragma: export */
#include "basic-forward.h" #include "basic-forward.h"
#include "iovec-util-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/iovec-util.h" /* IWYU pragma: export */
extern const struct iovec iovec_nul_byte; /* Points to a single NUL byte */ extern const struct iovec iovec_nul_byte; /* Points to a single NUL byte */
extern const struct iovec iovec_empty; /* Points to an empty, but valid (i.e. non-NULL) pointer */ extern const struct iovec iovec_empty; /* Points to an empty, but valid (i.e. non-NULL) pointer */
+1 -1
View File
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "label.h" #include "label-util.h"
static const LabelOps *label_ops = NULL; static const LabelOps *label_ops = NULL;
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "macro-fundamental.h" /* IWYU pragma: export */ #include "../fundamental/macro.h" /* IWYU pragma: export */
#if !defined(HAS_FEATURE_MEMORY_SANITIZER) #if !defined(HAS_FEATURE_MEMORY_SANITIZER)
# if defined(__has_feature) # if defined(__has_feature)
+2 -1
View File
@@ -4,7 +4,8 @@
#include <string.h> #include <string.h>
#include "basic-forward.h" #include "basic-forward.h"
#include "memory-util-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/memory-util.h" /* IWYU pragma: export */
size_t page_size(void) _pure_; size_t page_size(void) _pure_;
#define PAGE_ALIGN(l) ALIGN_TO(l, page_size()) #define PAGE_ALIGN(l) ALIGN_TO(l, page_size())
+2 -2
View File
@@ -10,7 +10,7 @@ basic_sources = files(
'arphrd-util.c', 'arphrd-util.c',
'assert-util.c', 'assert-util.c',
'audit-util.c', 'audit-util.c',
'btrfs.c', 'btrfs-util.c',
'build.c', 'build.c',
'build-path.c', 'build-path.c',
'bus-label.c', 'bus-label.c',
@@ -57,7 +57,7 @@ basic_sources = files(
'iovec-util.c', 'iovec-util.c',
'iovec-wrapper.c', 'iovec-wrapper.c',
'keyring-util.c', 'keyring-util.c',
'label.c', 'label-util.c',
'limits-util.c', 'limits-util.c',
'locale-util.c', 'locale-util.c',
'lock-util.c', 'lock-util.c',
+1 -1
View File
@@ -3,7 +3,7 @@
#include <unistd.h> #include <unistd.h>
#include "alloc-util.h" #include "alloc-util.h"
#include "btrfs.h" #include "btrfs-util.h"
#include "chase.h" #include "chase.h"
#include "errno-util.h" #include "errno-util.h"
#include "fd-util.h" #include "fd-util.h"
+2 -1
View File
@@ -3,7 +3,8 @@
#pragma once #pragma once
#include "basic-forward.h" #include "basic-forward.h"
#include "sha256-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/sha256.h" /* IWYU pragma: export */
int sha256_fd(int fd, uint64_t max_size, uint8_t ret[static SHA256_DIGEST_SIZE]); int sha256_fd(int fd, uint64_t max_size, uint8_t ret[static SHA256_DIGEST_SIZE]);
+2 -1
View File
@@ -5,7 +5,8 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "basic-forward.h" #include "basic-forward.h"
#include "string-util-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/string-util.h" /* IWYU pragma: export */
static inline char* strstr_ptr_internal(const char *haystack, const char *needle) { static inline char* strstr_ptr_internal(const char *haystack, const char *needle) {
if (!haystack || !needle) if (!haystack || !needle)
+2 -1
View File
@@ -2,7 +2,8 @@
#pragma once #pragma once
#include "basic-forward.h" #include "basic-forward.h"
#include "strv-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/strv.h" /* IWYU pragma: export */
char* strv_find(char * const *l, const char *name) _pure_; char* strv_find(char * const *l, const char *name) _pure_;
char* strv_find_case(char * const *l, const char *name) _pure_; char* strv_find_case(char * const *l, const char *name) _pure_;
+2 -1
View File
@@ -4,7 +4,8 @@
#include <endian.h> #include <endian.h>
#include "basic-forward.h" #include "basic-forward.h"
#include "unaligned-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/unaligned.h" /* IWYU pragma: export */
/* BE */ /* BE */
+1 -1
View File
@@ -4,7 +4,7 @@
#include "efi-efivars.h" #include "efi-efivars.h"
#include "efi-log.h" #include "efi-log.h"
#include "random-seed.h" #include "random-seed.h"
#include "sha256-fundamental.h" #include "sha256.h"
#include "util.h" #include "util.h"
#define BOOT_SECRET_MIXIN_PATH u"\\loader\\boot-secret-mixin" #define BOOT_SECRET_MIXIN_PATH u"\\loader\\boot-secret-mixin"
+5 -5
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bcd.h" #include "bcd.h"
#include "bootspec-fundamental.h" #include "bootspec.h"
#include "console.h" #include "console.h"
#include "cpio.h" #include "cpio.h"
#include "device-path-util.h" #include "device-path-util.h"
@@ -10,14 +10,14 @@
#include "efi-efivars.h" #include "efi-efivars.h"
#include "efi-log.h" #include "efi-log.h"
#include "efi-string-table.h" #include "efi-string-table.h"
#include "efivars-fundamental.h" #include "efivars.h"
#include "export-vars.h" #include "export-vars.h"
#include "graphics.h" #include "graphics.h"
#include "initrd.h" #include "initrd.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
#include "line-edit.h" #include "line-edit.h"
#include "measure.h" #include "measure.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "part-discovery.h" #include "part-discovery.h"
#include "pe.h" #include "pe.h"
#include "proto/block-io.h" #include "proto/block-io.h"
@@ -29,7 +29,7 @@
#include "secure-boot.h" #include "secure-boot.h"
#include "shim.h" #include "shim.h"
#include "smbios.h" #include "smbios.h"
#include "strv-fundamental.h" #include "strv.h"
#include "sysfail.h" #include "sysfail.h"
#include "ticks.h" #include "ticks.h"
#include "tpm2-pcr.h" #include "tpm2-pcr.h"
-1
View File
@@ -15,7 +15,6 @@
*/ */
#include "chid.h" #include "chid.h"
#include "chid-fundamental.h"
#include "edid.h" #include "edid.h"
#if SD_BOOT #if SD_BOOT
#include "efi-log.h" #include "efi-log.h"
+2 -1
View File
@@ -1,9 +1,10 @@
/* SPDX-License-Identifier: BSD-3-Clause */ /* SPDX-License-Identifier: BSD-3-Clause */
#pragma once #pragma once
#include "chid-fundamental.h" /* IWYU pragma: export */
#include "efi.h" #include "efi.h"
#include "../fundamental/chid.h" /* IWYU pragma: export */
/* A .hwids PE section consists of a series of 'Device' structures. A 'Device' structure binds a CHID to some /* A .hwids PE section consists of a series of 'Device' structures. A 'Device' structure binds a CHID to some
* resource, for now only Devicetree blobs. Designed to be extensible to other types of resources, should the * resource, for now only Devicetree blobs. Designed to be extensible to other types of resources, should the
* need arise. The series of 'Device' structures is followed by some space for strings that can be referenced * need arise. The series of 'Device' structures is followed by some space for strings that can be referenced
+1 -1
View File
@@ -6,7 +6,7 @@
#include "efi-string.h" #include "efi-string.h"
#include "proto/graphics-output.h" #include "proto/graphics-output.h"
#include "proto/pci-io.h" #include "proto/pci-io.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
#define SYSTEM_FONT_WIDTH 8 #define SYSTEM_FONT_WIDTH 8
+2 -2
View File
@@ -2,9 +2,9 @@
#include "cpio.h" #include "cpio.h"
#include "efi-log.h" #include "efi-log.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
#include "measure.h" #include "measure.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "tpm2-pcr.h" #include "tpm2-pcr.h"
#include "util.h" #include "util.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "device-path-util.h" #include "device-path-util.h"
#include "efi-string.h" #include "efi-string.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
static const EFI_DEVICE_PATH *device_path_find_end_node(const EFI_DEVICE_PATH *dp) { static const EFI_DEVICE_PATH *device_path_find_end_node(const EFI_DEVICE_PATH *dp) {
+1 -1
View File
@@ -3,7 +3,7 @@
#include "device-path-util.h" #include "device-path-util.h"
#include "drivers.h" #include "drivers.h"
#include "efi-log.h" #include "efi-log.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
static EFI_STATUS load_one_driver( static EFI_STATUS load_one_driver(
+2 -1
View File
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "edid-fundamental.h" /* IWYU pragma: export */
#include "efi.h" #include "efi.h"
#include "../fundamental/edid.h" /* IWYU pragma: export */
EFI_STATUS edid_get_discovered_panel_id(char16_t **ret_panel); EFI_STATUS edid_get_discovered_panel_id(char16_t **ret_panel);
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi.h" #include "efi.h"
#include "efivars-fundamental.h" /* IWYU pragma: export */ #include "efivars.h" /* IWYU pragma: export */
/* /*
* Allocated random UUID, intended to be shared across tools that implement * Allocated random UUID, intended to be shared across tools that implement
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi-string.h" #include "efi-string.h"
#include "macro-fundamental.h" #include "macro.h"
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ #define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
scope const char* name##_to_string(type i) { \ scope const char* name##_to_string(type i) { \
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "efi-string.h" #include "efi-string.h"
#include "string-util-fundamental.h" #include "string-util.h"
#if SD_BOOT #if SD_BOOT
# include "proto/simple-text-io.h" # include "proto/simple-text-io.h"
+6 -5
View File
@@ -9,11 +9,12 @@
#include <stddef.h> /* IWYU pragma: export */ #include <stddef.h> /* IWYU pragma: export */
#include <stdint.h> /* IWYU pragma: export */ #include <stdint.h> /* IWYU pragma: export */
#include "assert-fundamental.h" /* IWYU pragma: export */ #include "assert-util.h" /* IWYU pragma: export */
#include "cleanup-fundamental.h" /* IWYU pragma: export */ #include "cleanup-util.h" /* IWYU pragma: export */
#include "efi-fundamental.h" /* IWYU pragma: export */ #include "macro.h" /* IWYU pragma: export */
#include "macro-fundamental.h" /* IWYU pragma: export */ #include "string-table.h" /* IWYU pragma: export */
#include "string-table-fundamental.h" /* IWYU pragma: export */
#include "../fundamental/efi.h" /* IWYU pragma: export */
#if SD_BOOT #if SD_BOOT
/* uchar.h/wchar.h are not suitable for freestanding environments. */ /* uchar.h/wchar.h are not suitable for freestanding environments. */
+1 -1
View File
@@ -2,7 +2,7 @@
#include "efi-log.h" #include "efi-log.h"
#include "initrd.h" #include "initrd.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
#include "proto/device-path.h" #include "proto/device-path.h"
#include "proto/load-file.h" #include "proto/load-file.h"
#include "util.h" #include "util.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi.h" #include "efi.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
#include "util.h" #include "util.h"
EFI_STATUS initrd_register( EFI_STATUS initrd_register(
+1 -1
View File
@@ -2,7 +2,7 @@
#include "console.h" #include "console.h"
#include "line-edit.h" #include "line-edit.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
static void cursor_left(size_t *cursor, size_t *first) { static void cursor_left(size_t *cursor, size_t *first) {
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi.h" #include "efi.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
EFI_STATUS linux_exec( EFI_STATUS linux_exec(
EFI_HANDLE parent, EFI_HANDLE parent,
+2 -2
View File
@@ -12,8 +12,8 @@
#include "efi-log.h" #include "efi-log.h"
#include "linux.h" #include "linux.h"
#include "macro-fundamental.h" #include "macro.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "util.h" #include "util.h"
#define KERNEL_SECTOR_SIZE 512u #define KERNEL_SECTOR_SIZE 512u
+2 -2
View File
@@ -12,8 +12,8 @@ libefitest = static_library(
), ),
build_by_default : false, build_by_default : false,
include_directories : [ include_directories : [
basic_includes,
include_directories('.'), include_directories('.'),
basic_includes,
], ],
implicit_include_directories : false, implicit_include_directories : false,
dependencies : userspace) dependencies : userspace)
@@ -164,8 +164,8 @@ configure_file(
############################################################ ############################################################
efi_includes = [ efi_includes = [
fundamental_include,
include_directories('.'), include_directories('.'),
fundamental_include,
version_include, version_include,
] ]
+1 -1
View File
@@ -6,7 +6,7 @@
#include "proto/block-io.h" #include "proto/block-io.h"
#include "proto/device-path.h" #include "proto/device-path.h"
#include "proto/disk-io.h" #include "proto/disk-io.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
typedef struct { typedef struct {
+2 -2
View File
@@ -2,11 +2,11 @@
#include "efi-efivars.h" #include "efi-efivars.h"
#include "efi-log.h" #include "efi-log.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "proto/rng.h" #include "proto/rng.h"
#include "random-seed.h" #include "random-seed.h"
#include "secure-boot.h" #include "secure-boot.h"
#include "sha256-fundamental.h" #include "sha256.h"
#include "util.h" #include "util.h"
#define RANDOM_MAX_SIZE_MIN (32U) #define RANDOM_MAX_SIZE_MIN (32U)
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi.h" #include "efi.h"
#include "efivars-fundamental.h" #include "efivars.h"
typedef enum { typedef enum {
ENROLL_OFF, /* no Secure Boot key enrollment whatsoever, even manual entries are not generated */ ENROLL_OFF, /* no Secure Boot key enrollment whatsoever, even manual entries are not generated */
+1 -1
View File
@@ -4,7 +4,7 @@
#include "logarithm.h" #include "logarithm.h"
#include "proto/graphics-output.h" #include "proto/graphics-output.h"
#include "splash.h" #include "splash.h"
#include "unaligned-fundamental.h" #include "unaligned.h"
#include "util.h" #include "util.h"
struct bmp_file { struct bmp_file {
+2 -2
View File
@@ -11,10 +11,10 @@
#include "export-vars.h" #include "export-vars.h"
#include "graphics.h" #include "graphics.h"
#include "initrd.h" #include "initrd.h"
#include "iovec-util-fundamental.h" #include "iovec-util.h"
#include "linux.h" #include "linux.h"
#include "measure.h" #include "measure.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "part-discovery.h" #include "part-discovery.h"
#include "pe.h" #include "pe.h"
#include "proto/shell-parameters.h" #include "proto/shell-parameters.h"
+2 -2
View File
@@ -4,10 +4,10 @@
#include "efi-log.h" #include "efi-log.h"
#include "efi-string.h" #include "efi-string.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "proto/device-path.h" #include "proto/device-path.h"
#include "proto/simple-text-io.h" #include "proto/simple-text-io.h"
#include "string-util-fundamental.h" #include "string-util.h"
#include "util.h" #include "util.h"
#include "version.h" #include "version.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "efi.h" #include "efi.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#if SD_BOOT #if SD_BOOT
+1 -1
View File
@@ -4,7 +4,7 @@
# include <cpuid.h> # include <cpuid.h>
#endif #endif
#include "confidential-virt-fundamental.h" #include "confidential-virt.h"
#include "device-path-util.h" #include "device-path-util.h"
#include "drivers.h" #include "drivers.h"
#include "efi-string.h" #include "efi-string.h"
+1 -1
View File
@@ -19,7 +19,7 @@
#include "crypto-util.h" #include "crypto-util.h"
#include "dirent-util.h" #include "dirent-util.h"
#include "efi-api.h" #include "efi-api.h"
#include "efi-fundamental.h" #include "efi.h"
#include "efivars.h" #include "efivars.h"
#include "env-file.h" #include "env-file.h"
#include "fd-util.h" #include "fd-util.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#include "io-util.h" #include "io-util.h"
#include "label-util.h" #include "label-util.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount.h" #include "mount.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
+1 -1
View File
@@ -17,7 +17,7 @@
#include "label-util.h" #include "label-util.h"
#include "log.h" #include "log.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
#include "namespace-util.h" #include "namespace-util.h"
+1 -1
View File
@@ -53,7 +53,7 @@
#include "libmount-util.h" #include "libmount-util.h"
#include "manager.h" #include "manager.h"
#include "memfd-util.h" #include "memfd-util.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
#include "mstack.h" #include "mstack.h"
+1 -1
View File
@@ -4,7 +4,7 @@
#include "errno-util.h" #include "errno-util.h"
#include "generator-setup.h" #include "generator-setup.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "path-lookup.h" #include "path-lookup.h"
#include "rm-rf.h" #include "rm-rf.h"
+1 -1
View File
@@ -17,7 +17,7 @@
#include "initrd-util.h" #include "initrd-util.h"
#include "io-util.h" #include "io-util.h"
#include "log.h" #include "log.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
#include "parse-util.h" #include "parse-util.h"
+1 -1
View File
@@ -78,7 +78,7 @@
#include "manager.h" #include "manager.h"
#include "manager-dump.h" #include "manager-dump.h"
#include "manager-serialize.h" #include "manager-serialize.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-setup.h" #include "mount-setup.h"
#include "mount-util.h" #include "mount-util.h"
#include "options.h" #include "options.h"
+1 -1
View File
@@ -61,7 +61,7 @@
#include "manager-dump.h" #include "manager-dump.h"
#include "manager-serialize.h" #include "manager-serialize.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "notify-recv.h" #include "notify-recv.h"
#include "parse-util.h" #include "parse-util.h"
+1 -1
View File
@@ -159,7 +159,7 @@ generated_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_d
libcore_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc] libcore_sources += [load_fragment_gperf_c, load_fragment_gperf_nulstr_c, bpf_delegate_configs_inc]
libcore_build_dir = meson.current_build_dir() libcore_build_dir = meson.current_build_dir()
libcore_name = 'systemd-core-@0@'.format(shared_lib_tag) libcore_name = 'systemd-core-@0@'.format(shared_lib_tag)
core_includes = [includes, include_directories('.')] core_includes = [include_directories('.'), includes]
libcore_static = static_library( libcore_static = static_library(
libcore_name, libcore_name,
+1 -1
View File
@@ -23,7 +23,7 @@
#include "libmount-util.h" #include "libmount-util.h"
#include "log.h" #include "log.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "mount.h" #include "mount.h"
#include "mount-setup.h" #include "mount-setup.h"
+1 -1
View File
@@ -31,7 +31,7 @@
#include "log.h" #include "log.h"
#include "loop-util.h" #include "loop-util.h"
#include "loopback-setup.h" #include "loopback-setup.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
#include "mstack.h" #include "mstack.h"
+1 -1
View File
@@ -15,7 +15,7 @@
#include "glob-util.h" #include "glob-util.h"
#include "inotify-util.h" #include "inotify-util.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "path.h" #include "path.h"
#include "path-util.h" #include "path-util.h"
#include "serialize.h" #include "serialize.h"
+1 -1
View File
@@ -30,7 +30,7 @@
#include "ip-protocol-list.h" #include "ip-protocol-list.h"
#include "log.h" #include "log.h"
#include "manager.h" #include "manager.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "namespace-util.h" #include "namespace-util.h"
#include "parse-util.h" #include "parse-util.h"
#include "path-util.h" #include "path-util.h"
+1 -1
View File
@@ -40,7 +40,7 @@
#include "load-fragment.h" #include "load-fragment.h"
#include "log.h" #include "log.h"
#include "logarithm.h" #include "logarithm.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "manager.h" #include "manager.h"
#include "mount-util.h" #include "mount-util.h"
#include "mountpoint-util.h" #include "mountpoint-util.h"
+1 -1
View File
@@ -33,7 +33,7 @@
#include "journal-send.h" #include "journal-send.h"
#include "json-util.h" #include "json-util.h"
#include "log.h" #include "log.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "namespace-util.h" #include "namespace-util.h"
#include "path-util.h" #include "path-util.h"
#include "process-util.h" #include "process-util.h"
+1 -1
View File
@@ -55,7 +55,7 @@
#include "strv.h" #include "strv.h"
#include "terminal-util.h" #include "terminal-util.h"
#include "time-util.h" #include "time-util.h"
#include "tmpfile-util-label.h" #include "tmpfile-util.h"
#include "user-util.h" #include "user-util.h"
#include "vconsole-util.h" #include "vconsole-util.h"
@@ -5,7 +5,7 @@
# include <assert.h> # include <assert.h>
#endif #endif
#include "macro-fundamental.h" #include "macro.h"
#if SD_BOOT #if SD_BOOT
_noreturn_ void efi_assert(const char *expr, const char *file, unsigned line, const char *function); _noreturn_ void efi_assert(const char *expr, const char *file, unsigned line, const char *function);
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bootspec-fundamental.h" #include "bootspec.h"
bool bootspec_pick_name_version_sort_key( bool bootspec_pick_name_version_sort_key(
const sd_char *os_pretty_name, const sd_char *os_pretty_name,
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "string-util-fundamental.h" #include "string-util.h"
bool bootspec_pick_name_version_sort_key( bool bootspec_pick_name_version_sort_key(
const sd_char *os_pretty_name, const sd_char *os_pretty_name,
@@ -24,10 +24,10 @@
#define strlen16 char16_strlen #define strlen16 char16_strlen
#endif #endif
#include "chid-fundamental.h" #include "chid.h"
#include "macro-fundamental.h" #include "macro.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "sha1-fundamental.h" #include "sha1.h"
static void get_chid( static void get_chid(
const char16_t *const smbios_fields[static _CHID_SMBIOS_FIELDS_MAX], const char16_t *const smbios_fields[static _CHID_SMBIOS_FIELDS_MAX],
@@ -2,14 +2,12 @@
#pragma once #pragma once
#if SD_BOOT #include "efi.h"
# include "efi.h"
#else #if !SD_BOOT
# include <uchar.h> # include <uchar.h>
#endif #endif
#include "efi-fundamental.h"
#define CHID_TYPES_MAX 18 #define CHID_TYPES_MAX 18
/* Any chids starting from EXTRA_CHID_BASE are non-standard and are subject to change and renumeration at any time */ /* Any chids starting from EXTRA_CHID_BASE are non-standard and are subject to change and renumeration at any time */
#define EXTRA_CHID_BASE 15 #define EXTRA_CHID_BASE 15
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "assert-fundamental.h" #include "assert-util.h"
/* A wrapper for 'func' to return void. /* A wrapper for 'func' to return void.
* Only useful when a void-returning function is required by some API. */ * Only useful when a void-returning function is required by some API. */
@@ -4,8 +4,8 @@
#include <endian.h> #include <endian.h>
#endif #endif
#include "edid-fundamental.h" #include "edid.h"
#include "efivars-fundamental.h" #include "efivars.h"
#define EDID_FIXED_HEADER_PATTERN "\x00\xFF\xFF\xFF\xFF\xFF\xFF" #define EDID_FIXED_HEADER_PATTERN "\x00\xFF\xFF\xFF\xFF\xFF\xFF"
assert_cc(sizeof_field(EdidHeader, pattern) == sizeof(EDID_FIXED_HEADER_PATTERN)); assert_cc(sizeof_field(EdidHeader, pattern) == sizeof(EDID_FIXED_HEADER_PATTERN));
@@ -10,7 +10,7 @@
# include <uchar.h> # include <uchar.h>
#endif #endif
#include "macro-fundamental.h" #include "macro.h"
/* EDID structure, version 1.4 */ /* EDID structure, version 1.4 */
typedef struct EdidHeader { typedef struct EdidHeader {
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "efivars-fundamental.h" #include "efivars.h"
static const sd_char * const table[_SECURE_BOOT_MAX] = { static const sd_char * const table[_SECURE_BOOT_MAX] = {
[SECURE_BOOT_UNSUPPORTED] = STR_C("unsupported"), [SECURE_BOOT_UNSUPPORTED] = STR_C("unsupported"),
@@ -6,7 +6,7 @@
#else #else
# include <errno.h> # include <errno.h>
#endif #endif
#include "string-util-fundamental.h" #include "string-util.h"
/* Features of the loader, i.e. systemd-boot */ /* Features of the loader, i.e. systemd-boot */
#define EFI_LOADER_FEATURE_CONFIG_TIMEOUT (UINT64_C(1) << 0) #define EFI_LOADER_FEATURE_CONFIG_TIMEOUT (UINT64_C(1) << 0)
@@ -5,8 +5,8 @@
#include <sys/uio.h> #include <sys/uio.h>
#endif #endif
#include "assert-fundamental.h" /* IWYU pragma: keep */ #include "assert-util.h" /* IWYU pragma: keep */
#include "macro-fundamental.h" #include "macro.h"
#if SD_BOOT #if SD_BOOT
/* struct iovec is a POSIX userspace construct. Let's introduce it also in EFI mode, it's just so useful */ /* struct iovec is a POSIX userspace construct. Let's introduce it also in EFI mode, it's just so useful */
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "memory-util-fundamental.h" #include "memory-util.h"
bool memeqbyte(uint8_t byte, const void *data, size_t length) { bool memeqbyte(uint8_t byte, const void *data, size_t length) {
assert(data || length == 0); assert(data || length == 0);
@@ -9,8 +9,8 @@
# include <string.h> # include <string.h>
#endif #endif
#include "assert-fundamental.h" /* IWYU pragma: keep */ #include "assert-util.h" /* IWYU pragma: keep */
#include "macro-fundamental.h" #include "macro.h"
#define memzero(x, l) \ #define memzero(x, l) \
({ \ ({ \
+9 -9
View File
@@ -3,15 +3,15 @@
fundamental_include = include_directories('.') fundamental_include = include_directories('.')
fundamental_sources = files( fundamental_sources = files(
'bootspec-fundamental.c', 'bootspec.c',
'chid-fundamental.c', 'chid.c',
'edid-fundamental.c', 'edid.c',
'efivars-fundamental.c', 'efivars.c',
'iovec-util-fundamental.h', 'iovec-util.h',
'memory-util-fundamental.c', 'memory-util.c',
'sha1-fundamental.c', 'sha1.c',
'sha256-fundamental.c', 'sha256.c',
'string-util-fundamental.c', 'string-util.c',
'uki.c', 'uki.c',
) )
@@ -82,8 +82,8 @@ modified for use with systemd
# include <string.h> # include <string.h>
#endif #endif
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "sha1-fundamental.h" #include "sha1.h"
#define SHA1_DIGEST_SIZE 20 #define SHA1_DIGEST_SIZE 20
@@ -27,10 +27,10 @@
# include <string.h> # include <string.h>
#endif #endif
#include "assert-fundamental.h" #include "assert-util.h"
#include "memory-util-fundamental.h" #include "memory-util.h"
#include "sha256-fundamental.h" #include "sha256.h"
#include "unaligned-fundamental.h" #include "unaligned.h"
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define SWAP(n) \ # define SWAP(n) \
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "macro-fundamental.h" #include "macro.h"
#define DECLARE_STRING_TABLE_LOOKUP_TO_STRING(name, type) \ #define DECLARE_STRING_TABLE_LOOKUP_TO_STRING(name, type) \
const char* name##_to_string(type i) _const_ const char* name##_to_string(type i) _const_
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "macro-fundamental.h" #include "macro.h"
#include "string-util-fundamental.h" #include "string-util.h"
sd_char *startswith_internal(const sd_char *s, const sd_char *prefix) { sd_char *startswith_internal(const sd_char *s, const sd_char *prefix) {
size_t l; size_t l;
@@ -8,8 +8,8 @@
# include <string.h> # include <string.h>
#endif #endif
#include "assert-fundamental.h" /* IWYU pragma: keep */ #include "assert-util.h" /* IWYU pragma: keep */
#include "macro-fundamental.h" #include "macro.h"
/* What is interpreted as whitespace? */ /* What is interpreted as whitespace? */
#define WHITESPACE " \t\n\r" #define WHITESPACE " \t\n\r"
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once #pragma once
#include "macro-fundamental.h" #include "macro.h"
#include "string-util-fundamental.h" #include "string-util.h"
#define _STRV_FOREACH(s, l, i) \ #define _STRV_FOREACH(s, l, i) \
for (typeof(*(l)) *s, *i = (l); (s = i) && *i; i++) for (typeof(*(l)) *s, *i = (l); (s = i) && *i; i++)
+1 -1
View File
@@ -17,7 +17,7 @@
#include "install-file.h" #include "install-file.h"
#include "log.h" #include "log.h"
#include "main-func.h" #include "main-func.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "options.h" #include "options.h"
#include "parse-argument.h" #include "parse-argument.h"
#include "path-util.h" #include "path-util.h"
+1 -1
View File
@@ -18,7 +18,7 @@
#include "install-file.h" #include "install-file.h"
#include "io-util.h" #include "io-util.h"
#include "log.h" #include "log.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "pretty-print.h" #include "pretty-print.h"
#include "qcow2-util.h" #include "qcow2-util.h"
#include "ratelimit.h" #include "ratelimit.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#include "install-file.h" #include "install-file.h"
#include "io-util.h" #include "io-util.h"
#include "log.h" #include "log.h"
#include "mkdir-label.h" #include "mkdir.h"
#include "path-util.h" #include "path-util.h"
#include "pidref.h" #include "pidref.h"
#include "pretty-print.h" #include "pretty-print.h"

Some files were not shown because too many files have changed in this diff Show More