(&self, address: u64, buf: &mut [u8])
| 28 | |
| 29 | impl BackingRead for RawBacking { |
| 30 | fn read_at(&self, address: u64, buf: &mut [u8]) -> io::Result<()> { |
| 31 | if address >= self.virtual_size { |
| 32 | buf.fill(0); |
| 33 | return Ok(()); |
| 34 | } |
| 35 | let available = (self.virtual_size - address) as usize; |
| 36 | if available >= buf.len() { |
| 37 | pread_exact(self.fd.as_raw_fd(), buf, address) |
| 38 | } else { |
| 39 | pread_exact(self.fd.as_raw_fd(), &mut buf[..available], address)?; |
| 40 | buf[available..].fill(0); |
| 41 | Ok(()) |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /// QCOW2 image used as a backing file for another QCOW2 image. |
no test coverage detected