Skip to content

Commit 90def73

Browse files
relicensing: Rewrite PR "loaded_image: Add set_unload"
This covers these commits: d4e88a1
1 parent 83e99f2 commit 90def73

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Diff for: uefi/src/proto/loaded_image.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,21 @@ impl LoadedImage {
134134
self.0.image_size = size;
135135
}
136136

137-
/// Set the callback handler to unload the image.
138-
///
139-
/// Drivers that wish to support unloading have to register their unload handler
140-
/// using this protocol. It is responsible for cleaning up any resources the
141-
/// image is using before returning. Unloading a driver is done with
142-
/// [`boot::unload_image`].
137+
/// Registers a cleanup function that is called when [`boot::unload_image`]
138+
/// is called.
143139
///
144140
/// # Safety
145141
///
146-
/// Only the driver that this [`LoadedImage`] is attached to should register an
147-
/// unload handler.
142+
/// The registered function must reside in memory that is not freed until
143+
/// after the image is unloaded.
148144
///
149145
/// [`boot::unload_image`]: crate::boot::unload_image
150146
pub unsafe fn set_unload(
151147
&mut self,
152148
unload: extern "efiapi" fn(image_handle: Handle) -> Status,
153149
) {
154-
type RawFn = unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle) -> uefi_raw::Status;
155-
let unload: RawFn = mem::transmute(unload);
150+
let unload: unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle) -> uefi_raw::Status =
151+
mem::transmute(unload);
156152
self.0.unload = Some(unload);
157153
}
158154

0 commit comments

Comments
 (0)