diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-20 08:55:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-26 08:31:35 +0200 |
commit | 0d054f330377d64e994b93c842f447b4a00b3169 (patch) | |
tree | c3d1d461738ab7f0f344da98b52ab29eacfb0509 /include/blspec.h | |
parent | dbc1894b425b587a48a410e9e516c84e6192716b (diff) | |
download | barebox-0d054f330377d64e994b93c842f447b4a00b3169.tar.gz barebox-0d054f330377d64e994b93c842f447b4a00b3169.tar.xz |
blspec: factor out a struct bootentry
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/blspec.h')
-rw-r--r-- | include/blspec.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/include/blspec.h b/include/blspec.h index cb4adc58e5..aced246e85 100644 --- a/include/blspec.h +++ b/include/blspec.h @@ -9,15 +9,19 @@ struct bootentries { struct menu *menu; }; -struct blspec_entry { +struct bootentry { struct list_head list; + struct menu_entry me; +}; + +struct blspec_entry { + struct bootentry entry; + struct device_node *node; struct cdev *cdev; char *rootpath; char *configpath; - struct menu_entry me; - char *scriptpath; }; @@ -25,7 +29,7 @@ int blspec_entry_var_set(struct blspec_entry *entry, const char *name, const char *val); const char *blspec_entry_var_get(struct blspec_entry *entry, const char *name); -int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun); +int blspec_boot(struct bootentry *entry, int verbose, int dryrun); int blspec_scan_devices(struct bootentries *bootentries); @@ -33,8 +37,8 @@ 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); -#define blspec_for_each_entry(blspec, entry) \ - list_for_each_entry(entry, &blspec->entries, list) +#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) { @@ -44,16 +48,16 @@ static inline struct blspec_entry *blspec_entry_alloc(struct bootentries *booten entry->node = of_new_node(NULL, NULL); - list_add_tail(&entry->list, &bootentries->entries); + list_add_tail(&entry->entry.list, &bootentries->entries); return entry; } static inline void blspec_entry_free(struct blspec_entry *entry) { - list_del(&entry->list); + list_del(&entry->entry.list); of_delete_node(entry->node); - free(entry->me.display); + free(entry->entry.me.display); free(entry->scriptpath); free(entry->configpath); free(entry->rootpath); @@ -75,10 +79,13 @@ static inline struct bootentries *blspec_alloc(void) static inline void blspec_free(struct bootentries *bootentries) { - struct blspec_entry *entry, *tmp; + struct bootentry *be, *tmp; + struct blspec_entry *entry; - list_for_each_entry_safe(entry, tmp, &bootentries->entries, list) + 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); |