From 3c75868fb342ec7763bf94ddd6999afa292d9f8a Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 19 Dec 2023 14:15:30 +0000 Subject: [PATCH] efi: Consistently support filenames up to 256 characters Previously the path in the FileDevicePathProtocol was limited to 128 ascii characters. Signed-off-by: Rob Bradford --- src/efi/file.rs | 2 +- src/efi/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/efi/file.rs b/src/efi/file.rs index ce2b6a42..1ab42133 100644 --- a/src/efi/file.rs +++ b/src/efi/file.rs @@ -16,7 +16,7 @@ use crate::block::SectorBuf; #[repr(C)] pub struct FileDevicePathProtocol { pub device_path: DevicePathProtocol, - pub filename: [u16; 64], + pub filename: [u16; 128], } pub extern "efiapi" fn filesystem_open_volume( diff --git a/src/efi/mod.rs b/src/efi/mod.rs index dff8ac5b..2a085a6e 100644 --- a/src/efi/mod.rs +++ b/src/efi/mod.rs @@ -1067,9 +1067,9 @@ fn file_device_path(path: &str) -> *mut r_efi::protocols::device_path::Protocol device_path: DevicePathProtocol { r#type: r_efi::protocols::device_path::TYPE_MEDIA, sub_type: 4, // Media Path type file - length: [132, 0], + length: [(260u16 & 0xff) as u8, (260u16 >> 8) as u8], }, - filename: [0; 64], + filename: [0; 128], }, file::FileDevicePathProtocol { device_path: DevicePathProtocol { @@ -1077,7 +1077,7 @@ fn file_device_path(path: &str) -> *mut r_efi::protocols::device_path::Protocol sub_type: 0xff, // End of full path length: [4, 0], }, - filename: [0; 64], + filename: [0; 128], }, ];