[image] Simplify image management

Refactor the {load,exec} image operations as {probe,exec}.  This makes
the probe mechanism cleaner, eliminates some forward declarations,
avoids holding magic state in image->priv, eliminates the possibility
of screwing up between the "load" and "exec" stages, and makes the
documentation simpler since the concept of "loading" (as distinct from
"executing") no longer needs to be explained.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2011-03-07 00:37:50 +00:00
parent 530a01eff0
commit 34b6ecb2f1
20 changed files with 414 additions and 501 deletions

View File

@@ -26,8 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
FEATURE ( FEATURE_IMAGE, "EFI", DHCP_EB_FEATURE_EFI, 1 );
struct image_type efi_image_type __image_type ( PROBE_NORMAL );
/** Event used to signal shutdown */
static EFI_EVENT efi_shutdown_event;
@@ -99,12 +97,12 @@ done:
}
/**
* Load EFI image into memory
* Probe EFI image
*
* @v image EFI file
* @ret rc Return status code
*/
static int efi_image_load ( struct image *image ) {
static int efi_image_probe ( struct image *image ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE handle;
EFI_STATUS efirc;
@@ -119,10 +117,6 @@ static int efi_image_load ( struct image *image ) {
return -ENOEXEC;
}
/* This is an EFI image */
if ( ! image->type )
image->type = &efi_image_type;
/* Unload the image. We can't leave it loaded, because we
* have no "unload" operation.
*/
@@ -134,6 +128,6 @@ static int efi_image_load ( struct image *image ) {
/** EFI image type */
struct image_type efi_image_type __image_type ( PROBE_NORMAL ) = {
.name = "EFI",
.load = efi_image_load,
.probe = efi_image_probe,
.exec = efi_image_exec,
};