diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-20 09:47:10 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-26 08:31:35 +0200 |
commit | e113fa5f1d498f86705bfb53c6ae8b8a8e225173 (patch) | |
tree | 20d1c6624819cb7385c24c565dafb18e0888e012 /common | |
parent | ff6bc088015606f8b272c694c2a622a006d702e3 (diff) | |
download | barebox-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 'common')
-rw-r--r-- | common/blspec.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/common/blspec.c b/common/blspec.c index dff0928fd2..aa70685414 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -55,6 +55,29 @@ const char *blspec_entry_var_get(struct blspec_entry *entry, const char *name) return ret ? NULL : str; } +static void blspec_entry_free(struct bootentry *be) +{ + struct blspec_entry *entry = container_of(be, struct blspec_entry, entry); + + of_delete_node(entry->node); + free(entry->configpath); + free(entry->rootpath); + free(entry); +} + +static struct blspec_entry *blspec_entry_alloc(struct bootentries *bootentries) +{ + struct blspec_entry *entry; + + entry = xzalloc(sizeof(*entry)); + + entry->node = of_new_node(NULL, NULL); + entry->entry.release = blspec_entry_free; + entry->entry.boot = blspec_boot; + + return entry; +} + /* * blspec_entry_open - open an entry given a path */ @@ -397,7 +420,7 @@ int blspec_scan_directory(struct bootentries *bootentries, const char *root) entry->cdev = get_cdev_by_mountpath(root); if (!entry_is_of_compatible(entry)) { - blspec_entry_free(entry); + blspec_entry_free(&entry->entry); continue; } @@ -417,6 +440,9 @@ int blspec_scan_directory(struct bootentries *bootentries, const char *root) free(hwdevname); entry->entry.me.type = MENU_ENTRY_NORMAL; + entry->entry.release = blspec_entry_free; + + bootentries_add_entry(bootentries, &entry->entry); } ret = found; |