summaryrefslogtreecommitdiffstats
path: root/include/bootchooser.h
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2016-08-24 12:22:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-09-22 11:44:23 +0200
commitcc532a3f733718526898c14f8137118b7d76a5bc (patch)
tree2addc58100c74b55f6477012f1d2f4df27de0c99 /include/bootchooser.h
parent6d8beeaad1e1133ae48664223793394310b1db46 (diff)
downloadbarebox-cc532a3f733718526898c14f8137118b7d76a5bc.tar.gz
barebox-cc532a3f733718526898c14f8137118b7d76a5bc.tar.xz
boot: add framework for redundant boot scenarios
There are several use cases where a redundant Linux system is needed. The barebox bootchooser framework provides the building blocks to model different use cases without the need to start from the scratch over and over again. The bootchooser works on abstract boot targets, each with a set of properties and implements an algorithm which selects the highest priority target to boot. See the documentation contained in this patch for more information. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/bootchooser.h')
-rw-r--r--include/bootchooser.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/bootchooser.h b/include/bootchooser.h
new file mode 100644
index 0000000000..c948247722
--- /dev/null
+++ b/include/bootchooser.h
@@ -0,0 +1,37 @@
+#ifndef __BOOTCHOOSER_H
+#define __BOOTCHOOSER_H
+
+#include <of.h>
+#include <boot.h>
+
+struct bootchooser;
+struct bootchooser_target;
+
+struct bootchooser *bootchooser_get(void);
+int bootchooser_save(struct bootchooser *bootchooser);
+int bootchooser_put(struct bootchooser *bootchooser);
+
+void bootchooser_info(struct bootchooser *bootchooser);
+
+struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser *bootchooser);
+const char *bootchooser_target_name(struct bootchooser_target *target);
+struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootchooser,
+ const char *name);
+void bootchooser_target_force_boot(struct bootchooser_target *target);
+
+int bootchooser_create_bootentry(struct bootentries *entries);
+
+int bootchooser_target_set_attempts(struct bootchooser_target *target, int attempts);
+int bootchooser_target_set_priority(struct bootchooser_target *target, int priority);
+
+void bootchooser_last_boot_successful(void);
+
+struct bootchooser_target *bootchooser_target_first(struct bootchooser *bootchooser);
+struct bootchooser_target *bootchooser_target_next(struct bootchooser *bootchooser,
+ struct bootchooser_target *cur);
+
+#define bootchooser_for_each_target(bootchooser, target) \
+ for (target = bootchooser_target_first(bootchooser); target; \
+ target = bootchooser_target_next(bootchooser, target))
+
+#endif /* __BOOTCHOOSER_H */