Skip to content

Commit 8ee0b6c

Browse files
Merge pull request #1635 from JarlEvanson/enable-access
Enable access to hidden RAII guard components
2 parents 4248ee8 + ea6cd41 commit 8ee0b6c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Diff for: uefi/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Added `proto::scsi::pass_thru::ExtScsiPassThru`.
1212
- Added `proto::nvme::pass_thru::NvmePassThru`.
1313
- Added `proto::ata::pass_thru::AtaPassThru`.
14+
- Added `boot::ScopedProtocol::open_params()`.
15+
- Added `boot::TplGuard::old_tpl()`.
1416

1517
## Changed
1618
- **Breaking:** Removed `BootPolicyError` as `BootPolicy` construction is no

Diff for: uefi/src/boot.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,14 @@ pub struct ScopedProtocol<P: Protocol + ?Sized> {
15361536
open_params: OpenProtocolParams,
15371537
}
15381538

1539+
impl<P: Protocol + ?Sized> ScopedProtocol<P> {
1540+
/// Returns the [`OpenProtocolParams`] used to open the [`ScopedProtocol`].
1541+
#[must_use]
1542+
pub const fn open_params(&self) -> OpenProtocolParams {
1543+
self.open_params
1544+
}
1545+
}
1546+
15391547
impl<P: Protocol + ?Sized> Drop for ScopedProtocol<P> {
15401548
fn drop(&mut self) {
15411549
let bt = boot_services_raw_panicking();
@@ -1598,6 +1606,14 @@ pub struct TplGuard {
15981606
old_tpl: Tpl,
15991607
}
16001608

1609+
impl TplGuard {
1610+
/// Returns the previous [`Tpl`].
1611+
#[must_use]
1612+
pub const fn old_tpl(&self) -> Tpl {
1613+
self.old_tpl
1614+
}
1615+
}
1616+
16011617
impl Drop for TplGuard {
16021618
fn drop(&mut self) {
16031619
let bt = boot_services_raw_panicking();
@@ -1659,7 +1675,7 @@ pub enum OpenProtocolAttributes {
16591675
}
16601676

16611677
/// Parameters passed to [`open_protocol`].
1662-
#[derive(Debug)]
1678+
#[derive(Clone, Copy, Debug)]
16631679
pub struct OpenProtocolParams {
16641680
/// The handle for the protocol to open.
16651681
pub handle: Handle,

0 commit comments

Comments
 (0)