summaryrefslogtreecommitdiff
path: root/src/shared/bootspec.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-17 18:23:16 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-07 15:14:21 +0100
commit7e87c7d9149cb06a0e4cbe24e808edd906f71fc6 (patch)
tree34013b505c66ad8f2cae37b26a4b87a2e3ca489b /src/shared/bootspec.h
parenta2fa605a653faff46a39f069e28441e89b3db6dd (diff)
downloadsystemd-7e87c7d9149cb06a0e4cbe24e808edd906f71fc6.tar.gz
bootctl: add listing of loader entries
Diffstat (limited to 'src/shared/bootspec.h')
-rw-r--r--src/shared/bootspec.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h
new file mode 100644
index 0000000000..ff2b90cd32
--- /dev/null
+++ b/src/shared/bootspec.h
@@ -0,0 +1,58 @@
+/***
+ This file is part of systemd.
+
+ Copyright 2017 Zbigniew Jędrzejewski-Szmek
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#pragma once
+
+#include <stdlib.h>
+
+typedef struct BootEntry {
+ char *filename;
+
+ char *title;
+ char *version;
+ char *machine_id;
+ char *architecture;
+ char **options;
+ char *kernel; /* linux is #defined to 1, yikes! */
+ char *efi;
+ char **initrd;
+ char *device_tree;
+} BootEntry;
+
+typedef struct BootConfig {
+ char *default_pattern;
+ char *timeout;
+ char *editor;
+
+ char *entry_oneshot;
+ char *entry_default;
+
+ BootEntry *entries;
+ size_t n_entries;
+ ssize_t default_entry;
+} BootConfig;
+
+void boot_entry_free(BootEntry *entry);
+int boot_entry_load(const char *path, BootEntry *entry);
+int boot_entries_find(const char *dir, BootEntry **entries, size_t *n_entries);
+int boot_entries_select_default(const BootConfig *config);
+
+int boot_loader_read_conf(const char *path, BootConfig *config);
+void boot_config_free(BootConfig *config);
+int boot_entries_load_config(const char *esp_path, BootConfig *config);