MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / set_dirty_bit

Method set_dirty_bit

block/src/qcow/header.rs:530–546  ·  view source on GitHub ↗

Set or clear the dirty bit for QCOW2 v3 images. When `dirty` is true, sets the bit to indicate the image is in use. When `dirty` is false, clears the bit to indicate a clean shutdown.

(
        &mut self,
        file: &mut F,
        dirty: bool,
    )

Source from the content-addressed store, hash-verified

528 /// When `dirty` is true, sets the bit to indicate the image is in use.
529 /// When `dirty` is false, clears the bit to indicate a clean shutdown.
530 pub fn set_dirty_bit<F: Seek + Write + FileSync>(
531 &mut self,
532 file: &mut F,
533 dirty: bool,
534 ) -> BlockResult<()> {
535 if self.version == 3 {
536 if dirty {
537 self.incompatible_features |= IncompatFeatures::DIRTY.bits();
538 } else {
539 self.incompatible_features &= !IncompatFeatures::DIRTY.bits();
540 }
541 self.write_incompatible_features(file)?;
542 file.fsync()
543 .map_err(|e| BlockError::new(BlockErrorKind::Io, Error::SyncingHeader(e)))?;
544 }
545 Ok(())
546 }
547
548 /// Set the corrupt bit for QCOW2 v3 images.
549 ///

Callers 3

parse_qcowFunction · 0.80
dropMethod · 0.80
shutdownMethod · 0.80

Calls 3

newFunction · 0.85
fsyncMethod · 0.45

Tested by

no test coverage detected