fn deallocate_bytes(&mut self, address: u64, length: usize) -> std::io::Result<()> {
        let write_count: usize = self.limit_range_file(address, length);

        let mut nwritten: usize = 0;
        while nwritten < write_count {
            let curr_addr = address + nwritten as u64;
            let count = self.limit_range_cluster(curr_addr, write_count - nwritten);

            if count == self.raw_file.cluster_size() as usize {
                // Full cluster - deallocate the storage.
                self.deallocate_cluster(curr_addr)?;
            } else {
                // Partial cluster - zero out the relevant bytes if it was allocated.
                // Any space in unallocated clusters can be left alone, since
                // unallocated clusters already read back as zeroes.
                if let Some(offset) = self.file_offset_read(curr_addr)? {
                    // Partial cluster - zero it out.
                    self.raw_file.file_mut().write_zeroes_at(offset, count)?;
                }
            }

            nwritten += count;
        }
        Ok(())
    }
// Deallocate the storage for `length` bytes starting at `address`.
// Any future reads of this range will return all zeroes.
Deallocate the storage for `length` bytes starting at `address`.
Any future reads of this range will return all zeroes.
Deallocate the storage for ` length ` bytes starting at ` address ` . Any future reads of this range will return all zeroes .
fn deallocate_bytes(&mut self, address: u64, length: usize) -> std::io::Result<()> {
        let write_count: usize = self.limit_range_file(address, length);
        let mut nwritten: usize = 0;
        while nwritten < write_count {
            let curr_addr = address + nwritten as u64;
            let count = self.limit_range_cluster(curr_addr, write_count - nwritten);
            if count == self.raw_file.cluster_size() as usize {
                // Full cluster - deallocate the storage.
                self.deallocate_cluster(curr_addr)?;
            } else {
                // Partial cluster - zero out the relevant bytes if it was allocated.
                // Any space in unallocated clusters can be left alone, since
                // unallocated clusters already read back as zeroes.
                if let Some(offset) = self.file_offset_read(curr_addr)? {
                    // Partial cluster - zero it out.
                    self.raw_file.file_mut().write_zeroes_at(offset, count)?;
                }
            }
            nwritten += count;
        }
        Ok(())
    }
fn deallocate_bytes ( & mut self , address : u64 , length : usize ) -> std :: io :: Result < ( ) > { let write_count : usize = self . limit_range_file ( address , length ) ; let mut nwritten : usize = 0 ; while nwritten < write_count { let curr_addr = address + nwritten as u64 ; let count = self . limit_range_cluster ( curr_addr , write_count - nwritten ) ; if count == self . raw_file . cluster_size ( ) as usize { // Full cluster - deallocate the storage. self . deallocate_cluster ( curr_addr ) ? ; } else { // Partial cluster - zero out the relevant bytes if it was allocated. // Any space in unallocated clusters can be left alone, since // unallocated clusters already read back as zeroes. if let Some ( offset ) = self . file_offset_read ( curr_addr ) ? { // Partial cluster - zero it out. self . raw_file . file_mut ( ) . write_zeroes_at ( offset , count ) ? ; } } nwritten += count ; } Ok ( ( ) ) }
Deallocate the storage for `length` bytes starting at `address`.
Deallocate the storage for ` length ` bytes starting at ` address ` .
&mut self
address
u64
length
usize
&mut self
address
u64
length
usize