]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/bootspec.h
tree-wide: drop 'This file is part of systemd' blurb
[thirdparty/systemd.git] / src / shared / bootspec.h
CommitLineData
7e87c7d9 1/***
7e87c7d9 2 Copyright 2017 Zbigniew Jędrzejewski-Szmek
7e87c7d9
ZJS
3***/
4
5#pragma once
6
7#include <stdlib.h>
8
9typedef struct BootEntry {
10 char *filename;
11
12 char *title;
64f05708 13 char *show_title;
7e87c7d9
ZJS
14 char *version;
15 char *machine_id;
16 char *architecture;
17 char **options;
18 char *kernel; /* linux is #defined to 1, yikes! */
19 char *efi;
20 char **initrd;
21 char *device_tree;
22} BootEntry;
23
24typedef struct BootConfig {
25 char *default_pattern;
26 char *timeout;
27 char *editor;
c1d4e298
JJ
28 char *auto_entries;
29 char *auto_firmware;
d37b0737 30 char *console_mode;
7e87c7d9
ZJS
31
32 char *entry_oneshot;
33 char *entry_default;
34
35 BootEntry *entries;
36 size_t n_entries;
37 ssize_t default_entry;
38} BootConfig;
39
40void boot_entry_free(BootEntry *entry);
41int boot_entry_load(const char *path, BootEntry *entry);
42int boot_entries_find(const char *dir, BootEntry **entries, size_t *n_entries);
7e87c7d9
ZJS
43
44int boot_loader_read_conf(const char *path, BootConfig *config);
45void boot_config_free(BootConfig *config);
46int boot_entries_load_config(const char *esp_path, BootConfig *config);
64f05708
ZJS
47
48static inline const char* boot_entry_title(const BootEntry *entry) {
49 return entry->show_title ?: entry->title ?: entry->filename;
50}
af918182 51
5caa3167 52int 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);