summaryrefslogtreecommitdiff
path: root/src/shared/bootspec.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-11 22:04:46 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-11 23:18:56 +0100
commit5caa3167ff98a29c1ef9bbe9c4fddf6aa1cd8888 (patch)
tree78ad8a96b929bdb89fe58c18cf1eaf794fb0b34c /src/shared/bootspec.h
parent4a0e9289bf443fec9fc56af25f90e2a100ba7a41 (diff)
downloadsystemd-5caa3167ff98a29c1ef9bbe9c4fddf6aa1cd8888.tar.gz
efi: rework find_esp() error propagation/logging a bit
This renames find_esp() to find_esp_and_warn() and tries to normalize its behaviour: 1. Change the error that is returned when we can't find the ESP to ENOKEY (from ENOENT). This way the error code can only mean one thing: that our search loop didn't find a good candidate. 2. Really log about all errors, except for ENOKEY and EACCES, and document the letter cases. 3. Normalize parameters to the call: separate out the path parameter in two: an input path and an output path. That way the memory management is clear: we will access the input parameter only for reading, and only write out the output parameter, using malloc() memory. Before the calling convention were quire surprising for internal API code, as the path parameter had to be malloc() memory and might and might not have changed. 4. Rename bootctl's find_esp_warn() to acquire_esp(), and make it a simple wrapper around find_esp_warn(), that basically just adds the friendly logging for the ENOKEY case. This rework removes double logging in a number of error cases, as we no longer log here in anything but ENOKEY, and leave that entirely to find_esp_warn(). 5. find_esp_and_warn() now takes a bool flag parameter "unprivileged_mode", which disables logging in the EACCES case, and skips privileged validation of the path. This makes the function less magic, and doesn't hide this internal silencing automatism from the caller anymore. With all that in place "bootctl list" and "bootctl status" work properly (or as good as they can) when I invoke the tools whithout privileges on my system where /boot is not world-readable
Diffstat (limited to 'src/shared/bootspec.h')
-rw-r--r--src/shared/bootspec.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h
index fb8c10a69a..d9c641bf08 100644
--- a/src/shared/bootspec.h
+++ b/src/shared/bootspec.h
@@ -61,5 +61,4 @@ static inline const char* boot_entry_title(const BootEntry *entry) {
return entry->show_title ?: entry->title ?: entry->filename;
}
-int find_esp(char **path,
- uint32_t *part, uint64_t *pstart, uint64_t *psize, sd_id128_t *uuid);
+int find_esp_and_warn(const char *path, bool unprivileged_mode, char **ret_path, uint32_t *ret_part, uint64_t *ret_pstart, uint64_t *ret_psize, sd_id128_t *ret_uuid);