File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,8 +320,8 @@ impl File {
320320 self . 0 . set_file_info ( file_info)
321321 }
322322
323- pub fn read ( & self , _buf : & mut [ u8 ] ) -> io:: Result < usize > {
324- unsupported ( )
323+ pub fn read ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
324+ self . 0 . read ( buf )
325325 }
326326
327327 pub fn read_vectored ( & self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
@@ -666,6 +666,19 @@ mod uefi_fs {
666666 Ok ( p)
667667 }
668668
669+ pub ( crate ) fn read ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
670+ let file_ptr = self . protocol . as_ptr ( ) ;
671+ let mut buf_size = buf. len ( ) ;
672+
673+ let r = unsafe { ( ( * file_ptr) . read ) ( file_ptr, & mut buf_size, buf. as_mut_ptr ( ) . cast ( ) ) } ;
674+
675+ if buf_size == 0 && r. is_error ( ) {
676+ Err ( io:: Error :: from_raw_os_error ( r. as_usize ( ) ) )
677+ } else {
678+ Ok ( buf_size)
679+ }
680+ }
681+
669682 pub ( crate ) fn read_dir_entry ( & self ) -> io:: Result < Option < UefiBox < file:: Info > > > {
670683 let file_ptr = self . protocol . as_ptr ( ) ;
671684 let mut buf_size = 0 ;
You can’t perform that action at this time.
0 commit comments