Skip to content

Commit 7afa6ce

Browse files
committed
uefi-raw: Revising EFI Shell Protocol definition
1 parent 4772497 commit 7afa6ce

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

uefi-raw/src/protocol/shell.rs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,42 @@ use super::device_path::DevicePathProtocol;
1010
use super::file_system::FileInfo;
1111
use super::shell_params::ShellFileHandle;
1212

13+
use bitflags::bitflags;
14+
1315
/// List Entry for File Lists
1416
#[derive(Debug)]
1517
#[repr(C)]
16-
pub struct ListEntry<'a> {
17-
pub f_link: *mut ListEntry<'a>,
18-
pub b_link: *mut ListEntry<'a>,
18+
pub struct ListEntry {
19+
pub f_link: *mut ListEntry,
20+
pub b_link: *mut ListEntry,
1921
}
2022

2123
/// ShellFileInfo for File Lists
2224
#[derive(Debug)]
2325
#[repr(C)]
24-
pub struct ShellFileInfo<'a> {
25-
pub link: ListEntry<'a>,
26+
pub struct ShellFileInfo {
27+
pub link: ListEntry,
2628
pub status: Status,
2729
pub full_name: *mut Char16,
2830
pub file_name: *mut Char16,
29-
pub shell_file_handle: Handle,
30-
pub file_info: FileInfo,
31+
pub handle: ShellFileHandle,
32+
pub info: FileInfo,
3133
}
3234

3335
/// Used to specify where component names should be taken from
3436
pub type ShellDeviceNameFlags = u32;
35-
pub const DEVICE_NAME_USE_COMPONENT_NAME: u32 = 0x0000001;
36-
pub const DEVICE_NAME_USE_DEVICE_PATH: u32 = 0x0000002;
37+
38+
bitflags! {
39+
/// Specifies the source of the component name
40+
#[repr(transparent)]
41+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
42+
pub struct DeviceName: u32 {
43+
/// Use Component Name
44+
const DEVICE_NAME_USE_COMPONENT_NAME = 0x0000001;
45+
/// Use Device Path
46+
const DEVICE_NAME_USE_DEVICE_PATH = 0x0000002;
47+
}
48+
}
3749

3850
/// Shell Protocol
3951
#[derive(Debug)]
@@ -64,23 +76,23 @@ pub struct ShellProtocol {
6476
help_text: *mut *mut Char16,
6577
) -> Status,
6678
pub get_device_path_from_map:
67-
unsafe extern "efiapi" fn(mapping: *const Char16) -> DevicePathProtocol,
79+
unsafe extern "efiapi" fn(mapping: *const Char16) -> *const DevicePathProtocol,
6880
pub get_map_from_device_path:
6981
unsafe extern "efiapi" fn(device_path: *mut *mut DevicePathProtocol) -> *const Char16,
7082
pub get_device_path_from_file_path:
71-
unsafe extern "efiapi" fn(path: *const Char16) -> DevicePathProtocol,
83+
unsafe extern "efiapi" fn(path: *const Char16) -> *const DevicePathProtocol,
7284
pub get_file_path_from_device_path:
7385
unsafe extern "efiapi" fn(path: *const DevicePathProtocol) -> *const Char16,
7486
pub set_map: unsafe extern "efiapi" fn(
75-
device_path: DevicePathProtocol,
87+
device_path: *const DevicePathProtocol,
7688
mapping: *const Char16,
7789
) -> Status,
7890

7991
pub get_cur_dir: unsafe extern "efiapi" fn(file_system_mapping: *const Char16) -> *const Char16,
8092
pub set_cur_dir:
8193
unsafe extern "efiapi" fn(file_system: *const Char16, dir: *const Char16) -> Status,
8294
pub open_file_list: unsafe extern "efiapi" fn(
83-
path: Char16,
95+
path: *const Char16,
8496
open_mode: u64,
8597
file_list: *mut *mut ShellFileInfo,
8698
) -> Status,
@@ -100,7 +112,7 @@ pub struct ShellProtocol {
100112
best_device_name: *mut *mut Char16,
101113
) -> Status,
102114

103-
pub get_file_info: unsafe extern "efiapi" fn(file_handle: ShellFileHandle) -> FileInfo,
115+
pub get_file_info: unsafe extern "efiapi" fn(file_handle: ShellFileHandle) -> *const FileInfo,
104116
pub set_file_info: unsafe extern "efiapi" fn(
105117
file_handle: ShellFileHandle,
106118
file_info: *const FileInfo,
@@ -126,7 +138,7 @@ pub struct ShellProtocol {
126138
buffer_size: *mut usize,
127139
buffer: *mut c_void,
128140
) -> Status,
129-
pub delete_file: unsafe extern "efiapi" fn(file_name: *const Char16) -> Status,
141+
pub delete_file: unsafe extern "efiapi" fn(file_handle: ShellFileHandle) -> Status,
130142
pub delete_file_by_name: unsafe extern "efiapi" fn(file_name: *const Char16) -> Status,
131143
pub get_file_position:
132144
unsafe extern "efiapi" fn(file_handle: ShellFileHandle, position: *mut u64) -> Status,

0 commit comments

Comments
 (0)