diff --git a/common/bbu.c b/common/bbu.c index 031c433..3b37226 100644 --- a/common/bbu.c +++ b/common/bbu.c @@ -30,6 +30,21 @@ static LIST_HEAD(bbu_image_handlers); +int bbu_handlers_iterate(int (*fn)(struct bbu_handler *, void *), void *ctx) +{ + struct bbu_handler *handler; + + list_for_each_entry(handler, &bbu_image_handlers, list) { + int ret; + + ret = fn(handler, ctx); + if (ret) + return ret; + } + + return 0; +} + int bbu_force(struct bbu_data *data, const char *fmt, ...) { va_list args; diff --git a/include/bbu.h b/include/bbu.h index 9d24ffc..54434b0 100644 --- a/include/bbu.h +++ b/include/bbu.h @@ -42,6 +42,8 @@ void bbu_handlers_list(void); +int bbu_handlers_iterate(int (*fn)(struct bbu_handler *, void *), void *); + #ifdef CONFIG_BAREBOX_UPDATE int bbu_register_handler(struct bbu_handler *);