mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 02:20:19 +03:00
[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:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user