Skip to content

Commit

Permalink
uefi: Replace TftpOpcode with PxeBaseCodeTftpOpcode from uefi-raw
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasbishop committed Feb 17, 2025
1 parent fd72002 commit 0426e9e
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions uefi/src/proto/network/pxe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::proto::unsafe_protocol;
use crate::util::ptr_write_unaligned_and_add;
use bitflags::bitflags;
use ptr_meta::Pointee;
use uefi_raw::protocol::network::pxe::PxeBaseCodeTftpOpcode;

use crate::{CStr8, Char8, Result, Status, StatusExt};

Expand Down Expand Up @@ -41,7 +42,7 @@ pub struct BaseCode {
) -> Status,
mtftp: unsafe extern "efiapi" fn(
this: &Self,
operation: TftpOpcode,
operation: PxeBaseCodeTftpOpcode,
buffer: *mut c_void,
overwrite: bool,
buffer_size: &mut u64,
Expand Down Expand Up @@ -156,7 +157,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::TftpGetFileSize,
PxeBaseCodeTftpOpcode::TFTP_GET_FILE_SIZE,
null_mut(),
false,
&mut buffer_size,
Expand Down Expand Up @@ -187,7 +188,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::TftpReadFile,
PxeBaseCodeTftpOpcode::TFTP_READ_FILE,
buffer_ptr,
false,
&mut buffer_size,
Expand Down Expand Up @@ -215,7 +216,7 @@ impl BaseCode {
unsafe {
(self.mtftp)(
self,
TftpOpcode::TftpWriteFile,
PxeBaseCodeTftpOpcode::TFTP_WRITE_FILE,
buffer_ptr,
overwrite,
&mut buffer_size,
Expand Down Expand Up @@ -243,7 +244,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::TftpReadDirectory,
PxeBaseCodeTftpOpcode::TFTP_READ_DIRECTORY,
buffer_ptr,
false,
&mut buffer_size,
Expand Down Expand Up @@ -316,7 +317,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::MtftpGetFileSize,
PxeBaseCodeTftpOpcode::MTFTP_GET_FILE_SIZE,
null_mut(),
false,
&mut buffer_size,
Expand Down Expand Up @@ -348,7 +349,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::MtftpReadFile,
PxeBaseCodeTftpOpcode::MTFTP_READ_FILE,
buffer_ptr,
false,
&mut buffer_size,
Expand Down Expand Up @@ -376,7 +377,7 @@ impl BaseCode {
let status = unsafe {
(self.mtftp)(
self,
TftpOpcode::MtftpReadDirectory,
PxeBaseCodeTftpOpcode::MTFTP_READ_DIRECTORY,
buffer_ptr,
false,
&mut buffer_size,
Expand Down Expand Up @@ -798,18 +799,6 @@ impl Server {
}
}

/// Corresponds to the `EFI_PXE_BASE_CODE_TFTP_OPCODE` type in the C API.
#[repr(C)]
enum TftpOpcode {
TftpGetFileSize = 1,
TftpReadFile,
TftpWriteFile,
TftpReadDirectory,
MtftpGetFileSize,
MtftpReadFile,
MtftpReadDirectory,
}

/// MTFTP connection parameters
///
/// Corresponds to the `EFI_PXE_BASE_CODE_MTFTP_INFO` type in the C API.
Expand Down

0 comments on commit 0426e9e

Please sign in to comment.