]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/bootspec.h
efi: rework find_esp() error propagation/logging a bit
[thirdparty/systemd.git] / src / shared / bootspec.h
CommitLineData
7e87c7d9
ZJS
1/***
2 This file is part of systemd.
3
4 Copyright 2017 Zbigniew Jędrzejewski-Szmek
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18***/
19
20#pragma once
21
22#include <stdlib.h>
23
24typedef struct BootEntry {
25 char *filename;
26
27 char *title;
64f05708 28 char *show_title;
7e87c7d9
ZJS
29 char *version;
30 char *machine_id;
31 char *architecture;
32 char **options;
33 char *kernel; /* linux is #defined to 1, yikes! */
34 char *efi;
35 char **initrd;
36 char *device_tree;
37} BootEntry;
38
39typedef struct BootConfig {
40 char *default_pattern;
41 char *timeout;
42 char *editor;
43
44 char *entry_oneshot;
45 char *entry_default;
46
47 BootEntry *entries;
48 size_t n_entries;
49 ssize_t default_entry;
50} BootConfig;
51
52void boot_entry_free(BootEntry *entry);
53int boot_entry_load(const char *path, BootEntry *entry);
54int boot_entries_find(const char *dir, BootEntry **entries, size_t *n_entries);
7e87c7d9
ZJS
55
56int boot_loader_read_conf(const char *path, BootConfig *config);
57void boot_config_free(BootConfig *config);
58int boot_entries_load_config(const char *esp_path, BootConfig *config);
64f05708
ZJS
59
60static inline const char* boot_entry_title(const BootEntry *entry) {
61 return entry->show_title ?: entry->title ?: entry->filename;
62}
af918182 63
5caa3167 64int 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);