]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/efi-loader.h
logind: also cache LoaderEntryOneShot EFI variable
[thirdparty/systemd.git] / src / shared / efi-loader.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "efivars.h"
5
6 #include <sys/stat.h>
7
8 #if ENABLE_EFI
9
10 int efi_reboot_to_firmware_supported(void);
11 int efi_get_reboot_to_firmware(void);
12 int efi_set_reboot_to_firmware(bool value);
13
14 int efi_get_boot_option(uint16_t nr, char **title, sd_id128_t *part_uuid, char **path, bool *active);
15 int efi_add_boot_option(uint16_t id, const char *title, uint32_t part, uint64_t pstart, uint64_t psize, sd_id128_t part_uuid, const char *path);
16 int efi_remove_boot_option(uint16_t id);
17 int efi_get_boot_order(uint16_t **order);
18 int efi_set_boot_order(uint16_t *order, size_t n);
19 int efi_get_boot_options(uint16_t **options);
20
21 int efi_loader_get_device_part_uuid(sd_id128_t *u);
22 int efi_loader_get_boot_usec(usec_t *firmware, usec_t *loader);
23
24 int efi_loader_get_entries(char ***ret);
25
26 int efi_loader_get_features(uint64_t *ret);
27
28 int efi_loader_get_config_timeout_one_shot(usec_t *ret);
29 int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat);
30
31 #else
32
33 static inline int efi_reboot_to_firmware_supported(void) {
34 return -EOPNOTSUPP;
35 }
36
37 static inline int efi_get_reboot_to_firmware(void) {
38 return -EOPNOTSUPP;
39 }
40
41 static inline int efi_set_reboot_to_firmware(bool value) {
42 return -EOPNOTSUPP;
43 }
44
45 static inline int efi_get_boot_option(uint16_t nr, char **title, sd_id128_t *part_uuid, char **path, bool *active) {
46 return -EOPNOTSUPP;
47 }
48
49 static inline int efi_add_boot_option(uint16_t id, const char *title, uint32_t part, uint64_t pstart, uint64_t psize, sd_id128_t part_uuid, const char *path) {
50 return -EOPNOTSUPP;
51 }
52
53 static inline int efi_remove_boot_option(uint16_t id) {
54 return -EOPNOTSUPP;
55 }
56
57 static inline int efi_get_boot_order(uint16_t **order) {
58 return -EOPNOTSUPP;
59 }
60
61 static inline int efi_set_boot_order(uint16_t *order, size_t n) {
62 return -EOPNOTSUPP;
63 }
64
65 static inline int efi_get_boot_options(uint16_t **options) {
66 return -EOPNOTSUPP;
67 }
68
69 static inline int efi_loader_get_device_part_uuid(sd_id128_t *u) {
70 return -EOPNOTSUPP;
71 }
72
73 static inline int efi_loader_get_boot_usec(usec_t *firmware, usec_t *loader) {
74 return -EOPNOTSUPP;
75 }
76
77 static inline int efi_loader_get_entries(char ***ret) {
78 return -EOPNOTSUPP;
79 }
80
81 static inline int efi_loader_get_features(uint64_t *ret) {
82 return -EOPNOTSUPP;
83 }
84
85 static inline int efi_loader_get_config_timeout_one_shot(usec_t *ret) {
86 return -EOPNOTSUPP;
87 }
88
89 static inline int efi_loader_update_entry_one_shot_cache(char **cache, struct stat *cache_stat) {
90 return -EOPNOTSUPP;
91 }
92
93 #endif
94
95 bool efi_loader_entry_name_valid(const char *s);
96
97 char *efi_tilt_backslashes(char *s);