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
+9 -1
View File
@@ -364,7 +364,7 @@ pub fn size(&self) -> Option<io::Result<u64>> {
}
pub fn tell(&self) -> io::Result<u64> {
unsupported()
self.0.position()
}
pub fn duplicate(&self) -> io::Result<File> {
@@ -734,6 +734,14 @@ pub(crate) fn set_file_info(&self, mut info: UefiBox<file::Info>) -> io::Result<
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) };