Skip to content

Commit d4e88a1

Browse files
medhefgonicholasbishop
authored andcommitted
loaded_image: Add set_unload
1 parent 39cf059 commit d4e88a1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

uefi/src/proto/loaded_image.rs

+20
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ impl LoadedImage {
149149
self.image_size = size;
150150
}
151151

152+
/// Set the callback handler to unload the image.
153+
///
154+
/// Drivers that wish to support unloading have to register their unload handler
155+
/// using this protocol. It is responsible for cleaning up any resources the
156+
/// image is using before returning. Unloading a driver is done with
157+
/// [`BootServices::unload_image`].
158+
///
159+
/// # Safety
160+
///
161+
/// Only the driver that this [`LoadedImage`] is attached to should register an
162+
/// unload handler.
163+
///
164+
/// [`BootServices::unload_image`]: crate::table::boot::BootServices
165+
pub unsafe fn set_unload(
166+
&mut self,
167+
unload: extern "efiapi" fn(image_handle: Handle) -> Status,
168+
) {
169+
self.unload = unload;
170+
}
171+
152172
/// Set the load options for the image. This can be used prior to
153173
/// calling `BootServices.start_image` to control the command line
154174
/// passed to the image.

0 commit comments

Comments
 (0)