@@ -718,7 +718,12 @@ pub fn disconnect_controller(
718718/// When a protocol interface is installed, firmware will call all functions
719719/// that have registered to wait for that interface to be installed.
720720///
721- /// If `handle` is `None`, a new handle will be created and returned.
721+ /// # Arguments
722+ ///
723+ /// - `handle`: Either `None` to allocate a new handle or an existing handle.
724+ /// - `interface`: The protocol implementation. The memory backing the
725+ /// implementation **must live as long as the handle!**. Callers need to
726+ /// ensure a matching lifetime!
722727///
723728/// # Safety
724729///
@@ -728,7 +733,20 @@ pub fn disconnect_controller(
728733///
729734/// * [`Status::OUT_OF_RESOURCES`]: failed to allocate a new handle.
730735/// * [`Status::INVALID_PARAMETER`]: this protocol is already installed on the handle.
731- pub unsafe fn install_protocol_interface (
736+ pub unsafe fn install_protocol_interface < P : ProtocolPointer + ?Sized > (
737+ handle : Option < Handle > ,
738+ interface : * const c_void ,
739+ ) -> Result < Handle > {
740+ unsafe { install_protocol_interface_by_guid ( handle, & P :: GUID , interface) }
741+ }
742+
743+ /// Variant of [`install_protocol_interface`] that consumes the [`Guid`] as
744+ /// parameter.
745+ ///
746+ /// # Safety
747+ ///
748+ /// See safety section in [`install_protocol_interface`].
749+ pub unsafe fn install_protocol_interface_by_guid (
732750 handle : Option < Handle > ,
733751 protocol : & Guid ,
734752 interface : * const c_void ,
@@ -766,7 +784,21 @@ pub unsafe fn install_protocol_interface(
766784///
767785/// * [`Status::NOT_FOUND`]: the old interface was not found on the handle.
768786/// * [`Status::ACCESS_DENIED`]: the old interface is still in use and cannot be uninstalled.
769- pub unsafe fn reinstall_protocol_interface (
787+ pub unsafe fn reinstall_protocol_interface < P : ProtocolPointer + ?Sized > (
788+ handle : Handle ,
789+ old_interface : * const c_void ,
790+ new_interface : * const c_void ,
791+ ) -> Result < ( ) > {
792+ unsafe { reinstall_protocol_interface_by_guid ( handle, & P :: GUID , old_interface, new_interface) }
793+ }
794+
795+ /// Variant of [`reinstall_protocol_interface`] that consumes the [`Guid`] as
796+ /// parameter.
797+ ///
798+ /// # Safety
799+ ///
800+ /// See safety section in [`reinstall_protocol_interface`].
801+ pub unsafe fn reinstall_protocol_interface_by_guid (
770802 handle : Handle ,
771803 protocol : & Guid ,
772804 old_interface : * const c_void ,
@@ -796,7 +828,20 @@ pub unsafe fn reinstall_protocol_interface(
796828///
797829/// * [`Status::NOT_FOUND`]: the interface was not found on the handle.
798830/// * [`Status::ACCESS_DENIED`]: the interface is still in use and cannot be uninstalled.
799- pub unsafe fn uninstall_protocol_interface (
831+ pub unsafe fn uninstall_protocol_interface < P : ProtocolPointer + ?Sized > (
832+ handle : Handle ,
833+ interface : * const c_void ,
834+ ) -> Result < ( ) > {
835+ unsafe { uninstall_protocol_interface_by_guid ( handle, & P :: GUID , interface) }
836+ }
837+
838+ /// Variant of [`uninstall_protocol_interface`] that consumes the [`Guid`] as
839+ /// parameter.
840+ ///
841+ /// # Safety
842+ ///
843+ /// See safety section in [`uninstall_protocol_interface`].
844+ pub unsafe fn uninstall_protocol_interface_by_guid (
800845 handle : Handle ,
801846 protocol : & Guid ,
802847 interface : * const c_void ,
0 commit comments