fn read(&mut self, buf: &mut [u8]) -> std::result::Result<usize, std::io::Error> {
        let sector_count =
            div_round_up!(buf.len() as u64, self.disk_spec.logical_sector_size as u64);
        let sector_index = self.current_offset / self.disk_spec.logical_sector_size as u64;

        vhdx_io::read(
            &mut self.file,
            buf,
            &self.disk_spec,
            &self.bat_entries,
            sector_index,
            sector_count,
        )
        .map_err(|e| {
            std::io::Error::new(
                std::io::ErrorKind::Other,
                format!(
                    "Failed reading {} sectors from VHDx at index {}: {}",
                    sector_count, sector_index, e
                ),
            )
        })
    }
/// Wrapper function to satisfy Read trait implementation for VHDx disk.
/// Convert the offset to sector index and buffer length to sector count.
Wrapper function to satisfy Read trait implementation for VHDx disk.
Convert the offset to sector index and buffer length to sector count.
Wrapper function to satisfy Read trait implementation for VHDx disk . Convert the offset to sector index and buffer length to sector count .
fn read(&mut self, buf: &mut [u8]) -> std::result::Result<usize, std::io::Error> {
        let sector_count =
            div_round_up!(buf.len() as u64, self.disk_spec.logical_sector_size as u64);
        let sector_index = self.current_offset / self.disk_spec.logical_sector_size as u64;
        vhdx_io::read(
            &mut self.file,
            buf,
            &self.disk_spec,
            &self.bat_entries,
            sector_index,
            sector_count,
        )
        .map_err(|e| {
            std::io::Error::new(
                std::io::ErrorKind::Other,
                format!(
                    "Failed reading {} sectors from VHDx at index {}: {}",
                    sector_count, sector_index, e
                ),
            )
        })
    }
fn read ( & mut self , buf : & mut [ u8 ] ) -> std :: result :: Result < usize , std :: io :: Error > { let sector_count = div_round_up ! ( buf len ( ) as u64 self disk_spec logical_sector_size as u64 ) ; let sector_index = self . current_offset / self . disk_spec . logical_sector_size as u64 ; vhdx_io :: read ( & mut self . file , buf , & self . disk_spec , & self . bat_entries , sector_index , sector_count , ) . map_err ( | e | { std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , format ! ( " " sector_count sector_index e ) , ) } ) }
Wrapper function to satisfy Read trait implementation for VHDx disk.
Wrapper function to satisfy Read trait implementation for VHDx disk .
&mut self
buf
&mut [u8]
&mut self
buf
&mut [u8]