diff options
Diffstat (limited to 'common/boot.c')
-rw-r--r-- | common/boot.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/common/boot.c b/common/boot.c index 4306319331..cef3d5e514 100644 --- a/common/boot.c +++ b/common/boot.c @@ -244,6 +244,25 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat return ret; } +static LIST_HEAD(bootentry_providers); + +struct bootentry_provider { + int (*fn)(struct bootentries *bootentries, const char *name); + struct list_head list; +}; + +int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const char *name)) +{ + struct bootentry_provider *p; + + p = xzalloc(sizeof(*p)); + p->fn = fn; + + list_add_tail(&p->list, &bootentry_providers); + + return 0; +} + /* * bootentry_create_from_name - create boot entries from a name * @@ -261,22 +280,11 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat int bootentry_create_from_name(struct bootentries *bootentries, const char *name) { + struct bootentry_provider *p; int found = 0, ret; - if (IS_ENABLED(CONFIG_BLSPEC)) { - ret = blspec_scan_devicename(bootentries, name); - if (ret > 0) - found += ret; - - if (*name == '/' || !strncmp(name, "nfs://", 6)) { - ret = blspec_scan_directory(bootentries, name); - if (ret > 0) - found += ret; - } - } - - if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) { - ret = bootchooser_create_bootentry(bootentries); + list_for_each_entry(p, &bootentry_providers, list) { + ret = p->fn(bootentries, name); if (ret > 0) found += ret; } |