Skip to content

loaded_image: Add set_unload #835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions uefi/src/proto/loaded_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@ impl LoadedImage {
self.image_size = size;
}

/// Set the callback handler to unload the image.
///
/// Drivers that wish to support unloading have to register their unload handler
/// using this protocol. It is responsible for cleaning up any resources the
/// image is using before returning. Unloading a driver is done with
/// [`BootServices::unload_image`].
///
/// # Safety
///
/// Only the driver that this [`LoadedImage`] is attached to should register an
/// unload handler.
///
/// [`BootServices::unload_image`]: crate::table::boot::BootServices
pub unsafe fn set_unload(
&mut self,
unload: extern "efiapi" fn(image_handle: Handle) -> Status,
) {
self.unload = unload;
}

/// Set the load options for the image. This can be used prior to
/// calling `BootServices.start_image` to control the command line
/// passed to the image.
Expand Down