Skip to content

Commit 83f11ca

Browse files
Merge pull request #1576 from rust-osdev/bishop-raw-pxe-3
uefi: Use uefi_raw's `PxeBaseCodeProtocol` to implement the internals of `pxe::BaseCode`
2 parents c42d70f + 95a3cab commit 83f11ca

File tree

2 files changed

+181
-198
lines changed

2 files changed

+181
-198
lines changed

uefi/src/proto/network/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ impl IpAddress {
3333
pub const fn new_v6(ip_addr: [u8; 16]) -> Self {
3434
Self(ip_addr)
3535
}
36+
37+
#[must_use]
38+
const fn as_raw_ptr(&self) -> *const uefi_raw::IpAddress {
39+
// The uefi-raw type is defined differently, but the layout is
40+
// compatible.
41+
self.0.as_ptr().cast()
42+
}
43+
44+
#[must_use]
45+
fn as_raw_ptr_mut(&mut self) -> *mut uefi_raw::IpAddress {
46+
// The uefi-raw type is defined differently, but the layout is
47+
// compatible.
48+
self.0.as_mut_ptr().cast()
49+
}
3650
}
3751

3852
impl From<core::net::Ipv4Addr> for IpAddress {

0 commit comments

Comments
 (0)