summaryrefslogtreecommitdiff
path: root/src/shared/efi-loader.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-01-24 22:45:25 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-01-24 23:07:21 +0000
commit2f6c52b919dcc4a52e597ada11af9267e3550029 (patch)
tree0fdfdbfa485ab2319704d96bf3d1fe6dce8cbd3b /src/shared/efi-loader.h
parent1d62f3a7a112c30399698dc76221f5e0e5b27ab5 (diff)
downloadsystemd-2f6c52b919dcc4a52e597ada11af9267e3550029.tar.gz
shared/efi-loader: fix compilation with !ENABLE_EFI, improve messages
When compiled without ENABLE_EFI, efi_stub_measured() was not defined, so compilation would fail. But it's not enough to add a stub that returns -EOPNOTSUPP. We call this function in various places and usually print the error at warning or error level, so we'd print a confusing message. We also can't add a stub that always returns 0, because then we'd print a message like "Kernel stub did not measure", which would be confusing too. Adding special handling for -EOPNOTSUPP in every caller is also unattractive. So instead efi_stub_measured() is reworked to log the warning or error internally, and such logging is removed from the callers, and a stub is added that logs a custom message.
Diffstat (limited to 'src/shared/efi-loader.h')
-rw-r--r--src/shared/efi-loader.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/efi-loader.h b/src/shared/efi-loader.h
index 56ccdee9c1..834362292a 100644
--- a/src/shared/efi-loader.h
+++ b/src/shared/efi-loader.h
@@ -18,7 +18,7 @@ int efi_loader_get_entries(char ***ret);
int efi_loader_get_features(uint64_t *ret);
int efi_stub_get_features(uint64_t *ret);
-int efi_stub_measured(void);
+int efi_stub_measured(int log_level);
int efi_loader_get_config_timeout_one_shot(usec_t *ret);
int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat);
@@ -45,6 +45,11 @@ static inline int efi_stub_get_features(uint64_t *ret) {
return -EOPNOTSUPP;
}
+static inline int efi_stub_measured(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;
}