pub fn write_at(&mut self, offset: u64, buf: &[u8]) -> Result<usize> {
        if offset + buf.len() as u64 > self.size {
            return Err(
                io::Error::new(io::ErrorKind::UnexpectedEof, "write beyond end of image").into(),
            );
        }
        let seq = pos2chunk(offset);
        let off = offset & OFFSET_MASK;
        // writes that go over a page boundary are only partially written
        let buf = if pos2chunk(offset + buf.len() as u64 - 1) != seq {
            &buf[..CHUNKSZ - off as usize]
        } else {
            buf
        };
        self.write(seq, off as usize, buf)
    }
/// Saved dirty data to the CoW cache in memory. Data is never written to disk. Note that not
/// all bytes may be written. In this case, the returned number is less than buf.len() and the
/// write operation should be retried with the remainder.
Saved dirty data to the CoW cache in memory. Data is never written to disk. Note that not
all bytes may be written. In this case, the returned number is less than buf.len() and the
write operation should be retried with the remainder.
Saved dirty data to the CoW cache in memory . Data is never written to disk . Note that not all bytes may be written . In this case the returned number is less than buf . len () and the write operation should be retried with the remainder .
pub fn write_at(&mut self, offset: u64, buf: &[u8]) -> Result<usize> {
        if offset + buf.len() as u64 > self.size {
            return Err(
                io::Error::new(io::ErrorKind::UnexpectedEof, "write beyond end of image").into(),
            );
        }
        let seq = pos2chunk(offset);
        let off = offset & OFFSET_MASK;
        // writes that go over a page boundary are only partially written
        let buf = if pos2chunk(offset + buf.len() as u64 - 1) != seq {
            &buf[..CHUNKSZ - off as usize]
        } else {
            buf
        };
        self.write(seq, off as usize, buf)
    }
pub fn write_at ( & mut self , offset : u64 , buf : & [ u8 ] ) -> Result < usize > { if offset + buf . len ( ) as u64 > self . size { return Err ( io :: Error :: new ( io :: ErrorKind :: UnexpectedEof , " " ) . into ( ) , ) ; } let seq = pos2chunk ( offset ) ; let off = offset & OFFSET_MASK ; // writes that go over a page boundary are only partially written let buf = if pos2chunk ( offset + buf . len ( ) as u64 - 1 ) != seq { & buf [ .. CHUNKSZ - off as usize ] } else { buf } ; self . write ( seq , off as usize , buf ) }
Saved dirty data to the CoW cache in memory.
Saved dirty data to the CoW cache in memory .
&mut self
offset
u64
buf
&[u8]
&mut self
offset
u64
buf
&[u8]