[image] Use list_first_entry() to clarify logic in main()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
e87fc5e743
commit
7752541bb7
|
@ -88,11 +88,8 @@ __asmcall int main ( void ) {
|
||||||
* booting fails for any reason, offer a second chance
|
* booting fails for any reason, offer a second chance
|
||||||
* to enter the shell for diagnostics.
|
* to enter the shell for diagnostics.
|
||||||
*/
|
*/
|
||||||
if ( have_images() ) {
|
if ( ( image = first_image() ) != NULL ) {
|
||||||
for_each_image ( image ) {
|
image_exec ( image );
|
||||||
image_exec ( image );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
autoboot();
|
autoboot();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,15 @@ static inline int have_images ( void ) {
|
||||||
return ( ! list_empty ( &images ) );
|
return ( ! list_empty ( &images ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve first image
|
||||||
|
*
|
||||||
|
* @ret image Image, or NULL
|
||||||
|
*/
|
||||||
|
static inline struct image * first_image ( void ) {
|
||||||
|
return list_first_entry ( &images, struct image, list );
|
||||||
|
}
|
||||||
|
|
||||||
extern struct image * alloc_image ( void );
|
extern struct image * alloc_image ( void );
|
||||||
extern void image_set_uri ( struct image *image, struct uri *uri );
|
extern void image_set_uri ( struct image *image, struct uri *uri );
|
||||||
extern int image_set_cmdline ( struct image *image, const char *cmdline );
|
extern int image_set_cmdline ( struct image *image, const char *cmdline );
|
||||||
|
|
Reference in New Issue