mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
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:
@@ -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) };
|
||||
|
||||
Reference in New Issue
Block a user