summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-07-20 09:47:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-07-26 08:31:35 +0200
commite113fa5f1d498f86705bfb53c6ae8b8a8e225173 (patch)
tree20d1c6624819cb7385c24c565dafb18e0888e012 /include
parentff6bc088015606f8b272c694c2a622a006d702e3 (diff)
downloadbarebox-e113fa5f1d498f86705bfb53c6ae8b8a8e225173.tar.gz
barebox-e113fa5f1d498f86705bfb53c6ae8b8a8e225173.tar.xz
blspec: separate bootentries from blspec entries
This completes the separation of the blspec code from the boot code. With this the boot code only handles generic boot entries of type struct bootentry which are embedded into the type (blspec/bootscript) specific structs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/blspec.h60
1 files changed, 4 insertions, 56 deletions
diff --git a/include/blspec.h b/include/blspec.h
index c956f0d940..7a16ae73c6 100644
--- a/include/blspec.h
+++ b/include/blspec.h
@@ -14,6 +14,8 @@ struct bootentry {
struct menu_entry me;
char *title;
char *description;
+ int (*boot)(struct bootentry *entry, int verbose, int dryrun);
+ void (*release)(struct bootentry *entry);
};
struct blspec_entry {
@@ -23,8 +25,6 @@ struct blspec_entry {
struct cdev *cdev;
char *rootpath;
char *configpath;
-
- char *scriptpath;
};
int blspec_entry_var_set(struct blspec_entry *entry, const char *name,
@@ -39,61 +39,9 @@ int blspec_scan_device(struct bootentries *bootentries, struct device_d *dev);
int blspec_scan_devicename(struct bootentries *bootentries, const char *devname);
int blspec_scan_directory(struct bootentries *bootentries, const char *root);
+int bootentries_add_entry(struct bootentries *entries, struct bootentry *entry);
+
#define bootentries_for_each_entry(bootentries, entry) \
list_for_each_entry(entry, &bootentries->entries, list)
-static inline struct blspec_entry *blspec_entry_alloc(struct bootentries *bootentries)
-{
- struct blspec_entry *entry;
-
- entry = xzalloc(sizeof(*entry));
-
- entry->node = of_new_node(NULL, NULL);
-
- list_add_tail(&entry->entry.list, &bootentries->entries);
-
- return entry;
-}
-
-static inline void blspec_entry_free(struct blspec_entry *entry)
-{
- list_del(&entry->entry.list);
- of_delete_node(entry->node);
- free(entry->entry.me.display);
- free(entry->entry.title);
- free(entry->entry.description);
- free(entry->scriptpath);
- free(entry->configpath);
- free(entry->rootpath);
- free(entry);
-}
-
-static inline struct bootentries *blspec_alloc(void)
-{
- struct bootentries *bootentries;
-
- bootentries = xzalloc(sizeof(*bootentries));
- INIT_LIST_HEAD(&bootentries->entries);
-
- if (IS_ENABLED(CONFIG_MENU))
- bootentries->menu = menu_alloc();
-
- return bootentries;
-}
-
-static inline void blspec_free(struct bootentries *bootentries)
-{
- struct bootentry *be, *tmp;
- struct blspec_entry *entry;
-
- list_for_each_entry_safe(be, tmp, &bootentries->entries, list) {
- entry = container_of(be, struct blspec_entry, entry);
- blspec_entry_free(entry);
- }
- if (bootentries->menu)
- free(bootentries->menu->display);
- free(bootentries->menu);
- free(bootentries);
-}
-
#endif /* __LOADER_H__ */