Skip to content

Commit fb476c6

Browse files
Add open_protocol_exclusive
1 parent fca3507 commit fb476c6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/table/boot.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,26 @@ impl BootServices {
10071007
})
10081008
}
10091009

1010+
/// Open a protocol interface for a handle in exclusive mode.
1011+
///
1012+
/// If successful, a [`ScopedProtocol`] is returned that will
1013+
/// automatically close the protocol interface when dropped.
1014+
///
1015+
/// [`handle_protocol`]: BootServices::handle_protocol
1016+
pub fn open_protocol_exclusive<P: ProtocolPointer + ?Sized>(
1017+
&self,
1018+
handle: Handle,
1019+
) -> Result<ScopedProtocol<P>> {
1020+
self.open_protocol::<P>(
1021+
OpenProtocolParams {
1022+
handle,
1023+
agent: self.image_handle(),
1024+
controller: None,
1025+
},
1026+
OpenProtocolAttributes::Exclusive,
1027+
)
1028+
}
1029+
10101030
/// Test whether a handle supports a protocol.
10111031
pub fn test_protocol<P: Protocol>(&self, params: OpenProtocolParams) -> Result<()> {
10121032
const TEST_PROTOCOL: u32 = 0x04;

0 commit comments

Comments
 (0)