[PATCH 31/44] bbu: add easy way to check for existent providers
Ahmad Fatoum
a.fatoum at barebox.org
Mon Aug 11 05:28:11 PDT 2025
This function will be called from the upcoming bfetch command to
determine whether the running barebox has barebox update handlers
registered.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
common/bbu.c | 8 ++++++++
include/bbu.h | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/common/bbu.c b/common/bbu.c
index 0dc32e45ea2f..03261583fe0b 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -289,6 +289,14 @@ int barebox_update(struct bbu_data *data, struct bbu_handler *handler)
return 0;
}
+/*
+ * report whether any update handlers have been registered so far
+ */
+bool bbu_handlers_available(void)
+{
+ return !list_empty(&bbu_image_handlers);
+}
+
/*
* print a list of all registered update handlers
*/
diff --git a/include/bbu.h b/include/bbu.h
index bce138d95b37..94006563c90e 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -58,6 +58,8 @@ int bbu_std_file_handler(struct bbu_handler *handler,
#ifdef CONFIG_BAREBOX_UPDATE
+bool bbu_handlers_available(void);
+
int bbu_register_handler(struct bbu_handler *);
int bbu_register_std_file_update(const char *name, unsigned long flags,
@@ -71,6 +73,11 @@ int bbu_mmcboot_register_handler(const char *name,
#else
+static inline bool bbu_handlers_available(void)
+{
+ return false;
+}
+
static inline int bbu_register_handler(struct bbu_handler *unused)
{
return -EINVAL;
--
2.39.5
More information about the barebox
mailing list