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:
parent
3fda0e426c
commit
97fc739602
1 changed files with 9 additions and 1 deletions
|
|
@ -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) };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue