std: sys: fs: uefi: Implement File::tell

- Just a call to get_position
- Tested with OVMF on QEMU

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
This commit is contained in:
Ayush Singh 2026-01-09 10:31:18 +05:30
parent 3fda0e426c
commit 97fc739602
No known key found for this signature in database
GPG key ID: 05CEF5C789E55A74

View file

@ -364,7 +364,7 @@ impl File {
}
pub fn tell(&self) -> io::Result<u64> {
unsupported()
self.0.position()
}
pub fn duplicate(&self) -> io::Result<File> {
@ -734,6 +734,14 @@ mod uefi_fs {
if r.is_error() { Err(io::Error::from_raw_os_error(r.as_usize())) } else { Ok(()) }
}
pub(crate) fn position(&self) -> io::Result<u64> {
let file_ptr = self.protocol.as_ptr();
let mut pos = 0;
let r = unsafe { ((*file_ptr).get_position)(file_ptr, &mut pos) };
if r.is_error() { Err(io::Error::from_raw_os_error(r.as_usize())) } else { Ok(pos) }
}
pub(crate) fn delete(self) -> io::Result<()> {
let file_ptr = self.protocol.as_ptr();
let r = unsafe { ((*file_ptr).delete)(file_ptr) };